Enhance animation and control tests; improve rendering and shape loading validation
- Added tests for player animations in animation_archive_tests to ensure all animations are loaded correctly. - Updated entity_dispatch_entry_tests to validate animation direction updates and added tests for sixteen-direction animations. - Expanded isometric_controls_tests with comprehensive key event handling and action requests for various controller states. - Improved map_renderer_tests by adding viewport rendering tests to compare unbounded and bounded views. - Enhanced shape_archive_tests to validate shape frame loading and decoding consistency.
This commit is contained in:
parent
e00f9f3186
commit
a76b071049
28 changed files with 1608 additions and 154 deletions
|
|
@ -44,3 +44,15 @@ Use these rules when running shell commands from this workspace.
|
|||
- Avoid commands that rely on interactive input.
|
||||
- Prefer one focused command per terminal invocation so failures are easier to attribute.
|
||||
- When posting HTTP form data from PowerShell, prefer compact one-line request bodies over multiline literal blocks in the shared shell.
|
||||
|
||||
# GitHub Copilot Instructions for PowerShell
|
||||
|
||||
**Environment:** I am using **Windows** and all terminal commands *must* be compatible with **PowerShell** (or **PowerShell Core/PS7**).
|
||||
|
||||
**CRITICAL COMMAND SYNTAX:**
|
||||
* **NEVER** use `&&` for command chaining.
|
||||
* **ALWAYS** use the **semicolon (`;`)** for chaining or separating multiple commands on a single line.
|
||||
* **Good Example:** `npm install; npm start`
|
||||
* **Bad Example (Avoid):** `npm install && npm start`
|
||||
* Prefer built-in PowerShell cmdlets (e.g., `Get-ChildItem` instead of `ls` or `dir`) whenever possible, or use common aliases like `ls` if they are working.
|
||||
* Use Windows-style backslashes for paths and quote paths with spaces.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,15 +3,328 @@
|
|||
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||
<SAVE_STATE>
|
||||
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||
<A VALUE="Crusader:psx:" />
|
||||
<A VALUE="Crusader:psx:remorse:" />
|
||||
<A VALUE="Crusader:" />
|
||||
</ARRAY>
|
||||
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||
</SAVE_STATE>
|
||||
</PROJECT_DATA_XML_NAME>
|
||||
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true">
|
||||
<RUNNING_TOOL TOOL_NAME="CodeBrowser">
|
||||
<ROOT_NODE X_POS="57" Y_POS="112" WIDTH="1637" HEIGHT="931" EX_STATE="0">
|
||||
<SPLIT_NODE WIDTH="100" HEIGHT="100" DIVIDER_LOCATION="0" ORIENTATION="VERTICAL">
|
||||
<SPLIT_NODE WIDTH="1621" HEIGHT="816" DIVIDER_LOCATION="148" ORIENTATION="VERTICAL">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Entropy" OWNER="EntropyPlugin" TITLE="Entropy" ACTIVE="false" GROUP="Header" INSTANCE_ID="3207819926581772885" />
|
||||
<COMPONENT_INFO NAME="Overview" OWNER="OverviewPlugin" TITLE="Overview" ACTIVE="false" GROUP="Header" INSTANCE_ID="3207819926581772883" />
|
||||
</COMPONENT_NODE>
|
||||
<SPLIT_NODE WIDTH="1625" HEIGHT="836" DIVIDER_LOCATION="143" ORIENTATION="HORIZONTAL">
|
||||
<SPLIT_NODE WIDTH="232" HEIGHT="836" DIVIDER_LOCATION="640" ORIENTATION="VERTICAL">
|
||||
<SPLIT_NODE WIDTH="232" HEIGHT="532" DIVIDER_LOCATION="502" ORIENTATION="VERTICAL">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Program Tree" OWNER="ProgramTreePlugin" TITLE="Program Trees" ACTIVE="true" GROUP="Default" INSTANCE_ID="3756557308145916186" />
|
||||
</COMPONENT_NODE>
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Symbol Tree" OWNER="SymbolTreePlugin" TITLE="Symbol Tree" ACTIVE="true" GROUP="Default" INSTANCE_ID="3756557308145916181" />
|
||||
</COMPONENT_NODE>
|
||||
</SPLIT_NODE>
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="DataTypes Provider" OWNER="DataTypeManagerPlugin" TITLE="Data Type Manager" ACTIVE="true" GROUP="Default" INSTANCE_ID="3756557311851583771" />
|
||||
</COMPONENT_NODE>
|
||||
</SPLIT_NODE>
|
||||
<SPLIT_NODE WIDTH="1389" HEIGHT="836" DIVIDER_LOCATION="785" ORIENTATION="VERTICAL">
|
||||
<SPLIT_NODE WIDTH="1386" HEIGHT="638" DIVIDER_LOCATION="705" ORIENTATION="VERTICAL">
|
||||
<SPLIT_NODE WIDTH="1389" HEIGHT="653" DIVIDER_LOCATION="679" ORIENTATION="HORIZONTAL">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Listing" OWNER="CodeBrowserPlugin" TITLE="Listing: CRUSADER.EXE" ACTIVE="true" GROUP="Core" INSTANCE_ID="3756557310916253956" />
|
||||
</COMPONENT_NODE>
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Decompiler" OWNER="DecompilePlugin" TITLE="Decompile: Dispatch_CopyNextRecordFromRing" ACTIVE="true" GROUP="Default" INSTANCE_ID="3756261757801364123" />
|
||||
<COMPONENT_INFO NAME="Bytes" OWNER="ByteViewerPlugin" TITLE="Bytes: CRUSADER.EXE" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557308145916189" />
|
||||
<COMPONENT_INFO NAME="Data Window" OWNER="DataWindowPlugin" TITLE="Defined Data" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557312157767946" />
|
||||
<COMPONENT_INFO NAME="Defined Strings" OWNER="ViewStringsPlugin" TITLE="Defined Strings" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557312157767950" />
|
||||
<COMPONENT_INFO NAME="Equates Table" OWNER="EquateTablePlugin" TITLE="Equates Table" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557310916253954" />
|
||||
<COMPONENT_INFO NAME="External Programs" OWNER="ReferencesPlugin" TITLE="External Programs" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557310916253957" />
|
||||
<COMPONENT_INFO NAME="Functions Window" OWNER="FunctionWindowPlugin" TITLE="Functions" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557310916253960" />
|
||||
<COMPONENT_INFO NAME="Relocation Table" OWNER="RelocationTablePlugin" TITLE="Relocation Table" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557312157767949" />
|
||||
</COMPONENT_NODE>
|
||||
</SPLIT_NODE>
|
||||
<SPLIT_NODE WIDTH="1386" HEIGHT="189" DIVIDER_LOCATION="495" ORIENTATION="HORIZONTAL">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Data Type Preview" OWNER="DataTypePreviewPlugin" TITLE="Data Type Preview" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557311570565397" />
|
||||
</COMPONENT_NODE>
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Virtual Disassembler - Current Instruction" OWNER="DisassembledViewPlugin" TITLE="Disassembled View" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557310916253953" />
|
||||
</COMPONENT_NODE>
|
||||
</SPLIT_NODE>
|
||||
</SPLIT_NODE>
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Console" OWNER="ConsolePlugin" TITLE="Console" ACTIVE="true" GROUP="Default" INSTANCE_ID="3756557308145916188" />
|
||||
<COMPONENT_INFO NAME="Bookmarks" OWNER="BookmarkPlugin" TITLE="Bookmarks" ACTIVE="false" GROUP="Core.Bookmarks" INSTANCE_ID="3756557308145916185" />
|
||||
</COMPONENT_NODE>
|
||||
</SPLIT_NODE>
|
||||
</SPLIT_NODE>
|
||||
</SPLIT_NODE>
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Function Call Trees" OWNER="CallTreePlugin" TITLE="Function Call Trees" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557308145916182" />
|
||||
</COMPONENT_NODE>
|
||||
</SPLIT_NODE>
|
||||
<WINDOW_NODE X_POS="426" Y_POS="178" WIDTH="1033" HEIGHT="689">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Script Manager" OWNER="GhidraScriptMgrPlugin" TITLE="Script Manager" ACTIVE="false" GROUP="Script Group" INSTANCE_ID="3756557308145916183" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="423" Y_POS="144" WIDTH="927" HEIGHT="370">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Memory Map" OWNER="MemoryMapPlugin" TITLE="Memory Map" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557308145916164" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="383" Y_POS="7" WIDTH="1020" HEIGHT="1038">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Function Graph" OWNER="FunctionGraphPlugin" TITLE="Function Graph" ACTIVE="false" GROUP="Function Graph" INSTANCE_ID="3756557312157767951" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="550" Y_POS="206" WIDTH="655" HEIGHT="509">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Register Manager" OWNER="RegisterPlugin" TITLE="Register Manager" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557310916253959" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="287" Y_POS="186" WIDTH="1424" HEIGHT="666">
|
||||
<SPLIT_NODE WIDTH="1408" HEIGHT="559" DIVIDER_LOCATION="573" ORIENTATION="HORIZONTAL">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Symbol Table" OWNER="SymbolTablePlugin" TITLE="Symbol Table" ACTIVE="false" GROUP="symbolTable" INSTANCE_ID="3756557312157767947" />
|
||||
</COMPONENT_NODE>
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Symbol References" OWNER="SymbolTablePlugin" TITLE="Symbol References" ACTIVE="false" GROUP="symbolTable" INSTANCE_ID="3756557312157767948" />
|
||||
</COMPONENT_NODE>
|
||||
</SPLIT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="-1" Y_POS="-1" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Checksum Generator" OWNER="ComputeChecksumsPlugin" TITLE="Checksum Generator" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557310916253955" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="-1" Y_POS="-1" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Function Tags" OWNER="FunctionTagPlugin" TITLE="Function Tags" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557311851583772" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="-1" Y_POS="-1" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Comment Window" OWNER="CommentWindowPlugin" TITLE="Comments" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557312157767945" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="-1" Y_POS="-1" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Python" OWNER="InterpreterPanelPlugin" TITLE="Python" ACTIVE="false" GROUP="Default" INSTANCE_ID="3207819978370941531" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="0" Y_POS="0" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="PyGhidra" OWNER="PyGhidra" TITLE="PyGhidra" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557312157767944" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="0" Y_POS="0" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Source Files and Transforms" OWNER="SourceFilesTablePlugin" TITLE="Source Files and Transforms" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557310916253958" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="0" Y_POS="0" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Bundle Manager" OWNER="GhidraScriptMgrPlugin" TITLE="Bundle Manager" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557308145916184" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="0" Y_POS="0" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Jython" OWNER="Jython" TITLE="Jython" ACTIVE="false" GROUP="Default" INSTANCE_ID="3756557311851583773" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
<WINDOW_NODE X_POS="0" Y_POS="0" WIDTH="0" HEIGHT="0">
|
||||
<COMPONENT_NODE TOP_INFO="0">
|
||||
<COMPONENT_INFO NAME="Function Call Graph" OWNER="FunctionCallGraphPlugin" TITLE="Function Call Graph" ACTIVE="false" GROUP="Function Call Graph" INSTANCE_ID="3756557311570565398" />
|
||||
</COMPONENT_NODE>
|
||||
</WINDOW_NODE>
|
||||
</ROOT_NODE>
|
||||
<DATA_STATE>
|
||||
<PLUGIN NAME="NavigationHistoryPlugin">
|
||||
<XML NAME="HISTORY_LIST_0">
|
||||
<SAVE_STATE>
|
||||
<STATE NAME="CURRENT_LOC_INDEX" TYPE="int" VALUE="1" />
|
||||
<STATE NAME="LOCATION_COUNT" TYPE="int" VALUE="2" />
|
||||
<STATE NAME="MEMENTO_CLASS0" TYPE="string" VALUE="ghidra.app.plugin.core.gotoquery.DefaultNavigatableLocationMemento" />
|
||||
<STATE NAME="MEMENTO_CLASS1" TYPE="string" VALUE="ghidra.app.plugin.core.gotoquery.DefaultNavigatableLocationMemento" />
|
||||
<XML NAME="MEMENTO_DATA0">
|
||||
<SAVE_STATE>
|
||||
<XML NAME="MEMENTO0">
|
||||
<SAVE_STATE>
|
||||
<STATE NAME="CURSOR_OFFSET" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="MEMENTO_CLASS" TYPE="string" VALUE="ghidra.app.plugin.core.codebrowser.CodeViewerLocationMemento" />
|
||||
<STATE NAME="NAV_ID" TYPE="long" VALUE="3756261767657978500" />
|
||||
<STATE NAME="PROGRAM_ID" TYPE="long" VALUE="3721129048497902283" />
|
||||
<STATE NAME="PROGRAM_PATH_" TYPE="string" VALUE="Crusader:/CRUSADER.EXE" />
|
||||
<STATE NAME="_ADDRESS" TYPE="string" VALUE="1000:0000" />
|
||||
<STATE NAME="_BYTE_ADDR" TYPE="string" VALUE="1000:0000" />
|
||||
<STATE NAME="_CHAR_OFFSET" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_CLASSNAME" TYPE="string" VALUE="ghidra.program.util.MemoryBlockStartFieldLocation" />
|
||||
<STATE NAME="_COLUMN" TYPE="int" VALUE="0" />
|
||||
<ARRAY NAME="_COMMENT" TYPE="string">
|
||||
<A VALUE="//" />
|
||||
<A VALUE="// Code1" />
|
||||
<A VALUE="// ram:1000:0000-ram:1000:83ff" />
|
||||
<A VALUE="//" />
|
||||
</ARRAY>
|
||||
<STATE NAME="_ROW" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_TYPE" TYPE="int" VALUE="-1" />
|
||||
</SAVE_STATE>
|
||||
</XML>
|
||||
<STATE NAME="MEMENTO_CLASS" TYPE="string" VALUE="ghidra.app.plugin.core.gotoquery.DefaultNavigatableLocationMemento" />
|
||||
<STATE NAME="NUM_MEMENTOS" TYPE="int" VALUE="1" />
|
||||
<STATE NAME="PROGRAM_ID" TYPE="long" VALUE="3721129048497902283" />
|
||||
<STATE NAME="PROGRAM_PATH_" TYPE="string" VALUE="Crusader:/CRUSADER.EXE" />
|
||||
<STATE NAME="_ADDRESS" TYPE="string" VALUE="1000:0000" />
|
||||
<STATE NAME="_BYTE_ADDR" TYPE="string" VALUE="1000:0000" />
|
||||
<STATE NAME="_CHAR_OFFSET" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_CLASSNAME" TYPE="string" VALUE="ghidra.program.util.MemoryBlockStartFieldLocation" />
|
||||
<STATE NAME="_COLUMN" TYPE="int" VALUE="0" />
|
||||
<ARRAY NAME="_COMMENT" TYPE="string">
|
||||
<A VALUE="//" />
|
||||
<A VALUE="// Code1" />
|
||||
<A VALUE="// ram:1000:0000-ram:1000:83ff" />
|
||||
<A VALUE="//" />
|
||||
</ARRAY>
|
||||
<STATE NAME="_ROW" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_TYPE" TYPE="int" VALUE="-1" />
|
||||
</SAVE_STATE>
|
||||
</XML>
|
||||
<XML NAME="MEMENTO_DATA1">
|
||||
<SAVE_STATE>
|
||||
<XML NAME="MEMENTO0">
|
||||
<SAVE_STATE>
|
||||
<STATE NAME="CURSOR_OFFSET" TYPE="int" VALUE="311" />
|
||||
<STATE NAME="MEMENTO_CLASS" TYPE="string" VALUE="ghidra.app.plugin.core.codebrowser.CodeViewerLocationMemento" />
|
||||
<STATE NAME="NAV_ID" TYPE="long" VALUE="3756261767657978500" />
|
||||
<STATE NAME="PROGRAM_ID" TYPE="long" VALUE="3721129048497902283" />
|
||||
<STATE NAME="PROGRAM_PATH_" TYPE="string" VALUE="Crusader:/CRUSADER.EXE" />
|
||||
<STATE NAME="_ADDRESS" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_BYTE_ADDR" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_CHAR_OFFSET" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_CLASSNAME" TYPE="string" VALUE="ghidra.program.util.FunctionReturnTypeFieldLocation" />
|
||||
<STATE NAME="_COLUMN" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_FUNC_ADDRESS" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_RETURN_TYPE" TYPE="string" VALUE="undefined" />
|
||||
<STATE NAME="_ROW" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_SIGNATURE" TYPE="string" VALUE="undefined __cdecl16far Dispatch_CopyNextRecordFromRing(undefined2 param_1, undefined2 param_2, undefined4 param_3)" />
|
||||
</SAVE_STATE>
|
||||
</XML>
|
||||
<STATE NAME="MEMENTO_CLASS" TYPE="string" VALUE="ghidra.app.plugin.core.gotoquery.DefaultNavigatableLocationMemento" />
|
||||
<STATE NAME="NUM_MEMENTOS" TYPE="int" VALUE="1" />
|
||||
<STATE NAME="PROGRAM_ID" TYPE="long" VALUE="3721129048497902283" />
|
||||
<STATE NAME="PROGRAM_PATH_" TYPE="string" VALUE="Crusader:/CRUSADER.EXE" />
|
||||
<STATE NAME="_ADDRESS" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_BYTE_ADDR" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_CHAR_OFFSET" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_CLASSNAME" TYPE="string" VALUE="ghidra.program.util.FunctionReturnTypeFieldLocation" />
|
||||
<STATE NAME="_COLUMN" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_FUNC_ADDRESS" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_RETURN_TYPE" TYPE="string" VALUE="undefined" />
|
||||
<STATE NAME="_ROW" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_SIGNATURE" TYPE="string" VALUE="undefined __cdecl16far Dispatch_CopyNextRecordFromRing(undefined2 param_1, undefined2 param_2, undefined4 param_3)" />
|
||||
</SAVE_STATE>
|
||||
</XML>
|
||||
<STATE NAME="NAV_ID" TYPE="long" VALUE="-1" />
|
||||
</SAVE_STATE>
|
||||
</XML>
|
||||
<STATE NAME="LIST_COUNT" TYPE="int" VALUE="1" />
|
||||
</PLUGIN>
|
||||
<PLUGIN NAME="ProgramTreePlugin">
|
||||
<STATE NAME="Current Viewname" TYPE="string" VALUE="Program Tree" />
|
||||
<ARRAY NAME="GroupNameProgram Tree0" TYPE="string">
|
||||
<A VALUE="CRUSADER.EXE" />
|
||||
</ARRAY>
|
||||
<STATE NAME="NavigationToggleState" TYPE="boolean" VALUE="false" />
|
||||
<STATE NAME="NumberOfGroupsProgram Tree" TYPE="int" VALUE="1" />
|
||||
<STATE NAME="NumberOfViews" TYPE="int" VALUE="1" />
|
||||
<STATE NAME="TreeName-0" TYPE="string" VALUE="Program Tree" />
|
||||
</PLUGIN>
|
||||
<PLUGIN NAME="DecompilePlugin">
|
||||
<STATE NAME="INDEX" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="NAV_ID" TYPE="long" VALUE="3756261757801364123" />
|
||||
<STATE NAME="Num Disconnected" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="Y_OFFSET" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_ADDRESS" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_BYTE_ADDR" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_CHAR_OFFSET" TYPE="int" VALUE="33" />
|
||||
<STATE NAME="_CLASSNAME" TYPE="string" VALUE="ghidra.program.util.CommentFieldLocation" />
|
||||
<STATE NAME="_COLUMN" TYPE="int" VALUE="0" />
|
||||
<ARRAY NAME="_COMMENT" TYPE="string">
|
||||
<A VALUE="Copies the next 0x18-byte dispatch record out of the 25-slot ring buffer and advances the read index; wrapper 1360:12b2 calls this with the current gump/context." />
|
||||
</ARRAY>
|
||||
<STATE NAME="_ROW" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_TYPE" TYPE="int" VALUE="1" />
|
||||
</PLUGIN>
|
||||
<PLUGIN NAME="ByteViewerPlugin">
|
||||
<STATE NAME="Block Column" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="Block Num" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="Block Offset" TYPE="string" VALUE="0" />
|
||||
<STATE NAME="Index" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="NAV_ID" TYPE="long" VALUE="3756261757801364125" />
|
||||
<STATE NAME="Num Disconnected" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="X Offset" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="Y Offset" TYPE="int" VALUE="0" />
|
||||
</PLUGIN>
|
||||
<PLUGIN NAME="ProgramManagerPlugin">
|
||||
<STATE NAME="CURRENT_FILE" TYPE="string" VALUE="CRUSADER.EXE" />
|
||||
<STATE NAME="LOCATION_0" TYPE="string" VALUE="/K:/ghidra/Crusader_Decomp/" />
|
||||
<STATE NAME="NUM_PROGRAMS" TYPE="int" VALUE="1" />
|
||||
<STATE NAME="PATHNAME_0" TYPE="string" VALUE="/CRUSADER.EXE" />
|
||||
<STATE NAME="PROJECT_NAME_0" TYPE="string" VALUE="Crusader" />
|
||||
<STATE NAME="VERSION_0" TYPE="int" VALUE="-1" />
|
||||
<STATE NAME="_ADDRESS" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_BYTE_ADDR" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_CHAR_OFFSET" TYPE="int" VALUE="33" />
|
||||
<STATE NAME="_CLASSNAME" TYPE="string" VALUE="ghidra.program.util.CommentFieldLocation" />
|
||||
<STATE NAME="_COLUMN" TYPE="int" VALUE="0" />
|
||||
<ARRAY NAME="_COMMENT" TYPE="string">
|
||||
<A VALUE="Copies the next 0x18-byte dispatch record out of the 25-slot ring buffer and advances the read index; wrapper 1360:12b2 calls this with the current gump/context." />
|
||||
</ARRAY>
|
||||
<STATE NAME="_ROW" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_TYPE" TYPE="int" VALUE="1" />
|
||||
</PLUGIN>
|
||||
<PLUGIN NAME="FunctionGraphPlugin">
|
||||
<SAVE_STATE NAME="COMPLEX_LAYOUT_NAME" TYPE="SaveState">
|
||||
<COMPLEX_LAYOUT_NAME>
|
||||
<STATE NAME="LAYOUT_CLASS_NAME" TYPE="string" VALUE="ghidra.app.plugin.core.functiongraph.graph.layout.DecompilerNestedLayoutProvider" />
|
||||
<STATE NAME="LAYOUT_NAME" TYPE="string" VALUE="Nested Code Layout" />
|
||||
</COMPLEX_LAYOUT_NAME>
|
||||
</SAVE_STATE>
|
||||
<STATE NAME="DISPLAY_POPUPS" TYPE="boolean" VALUE="true" />
|
||||
<STATE NAME="DISPLAY_SATELLITE" TYPE="boolean" VALUE="true" />
|
||||
<STATE NAME="DOCK_SATELLITE" TYPE="boolean" VALUE="true" />
|
||||
<STATE NAME="DOCK_SATELLITE_POSITION" TYPE="string" VALUE="LOWER_RIGHT" />
|
||||
<STATE NAME="Disconnected Count" TYPE="int" VALUE="0" />
|
||||
<ENUM NAME="EDGE_HOVER_HIGHLIGHT" TYPE="enum" CLASS="ghidra.app.plugin.core.functiongraph.EdgeDisplayType" VALUE="ScopedFlowsFromVertex" />
|
||||
<ENUM NAME="EDGE_SELECTION_HIGHLIGHT" TYPE="enum" CLASS="ghidra.app.plugin.core.functiongraph.EdgeDisplayType" VALUE="AllCycles" />
|
||||
<STATE NAME="NAV_ID" TYPE="long" VALUE="3756261768991767183" />
|
||||
</PLUGIN>
|
||||
<PLUGIN NAME="CodeBrowserPlugin">
|
||||
<STATE NAME="INDEX" TYPE="int" VALUE="394072" />
|
||||
<STATE NAME="NAV_ID" TYPE="long" VALUE="3756261767657978500" />
|
||||
<STATE NAME="Num Disconnected" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="Y_OFFSET" TYPE="int" VALUE="-13" />
|
||||
<STATE NAME="_ADDRESS" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_BYTE_ADDR" TYPE="string" VALUE="1320:0d0b" />
|
||||
<STATE NAME="_CHAR_OFFSET" TYPE="int" VALUE="33" />
|
||||
<STATE NAME="_CLASSNAME" TYPE="string" VALUE="ghidra.program.util.CommentFieldLocation" />
|
||||
<STATE NAME="_COLUMN" TYPE="int" VALUE="0" />
|
||||
<ARRAY NAME="_COMMENT" TYPE="string">
|
||||
<A VALUE="Copies the next 0x18-byte dispatch record out of the 25-slot ring buffer and advances the read index; wrapper 1360:12b2 calls this with the current gump/context." />
|
||||
</ARRAY>
|
||||
<STATE NAME="_ROW" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="_TYPE" TYPE="int" VALUE="1" />
|
||||
</PLUGIN>
|
||||
</DATA_STATE>
|
||||
</RUNNING_TOOL>
|
||||
</WORKSPACE>
|
||||
</TOOL_MANAGER>
|
||||
</PROJECT>
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
67
build_output.txt
Normal file
67
build_output.txt
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
**********************************************************************
|
||||
** Visual Studio 2026 Developer Command Prompt v18.5.0
|
||||
** Copyright (c) 2026 Microsoft Corporation
|
||||
**********************************************************************
|
||||
[vcvarsall.bat] Environment initialized for: 'x64'
|
||||
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.22631.
|
||||
-- Configuring done (0.0s)
|
||||
-- Generating done (0.2s)
|
||||
-- Build files have been written to: K:/ghidra/Crusader_Decomp/rebuild/remorse/out/build
|
||||
MSBuild version 18.5.4+cb4e32d21 for .NET Framework
|
||||
|
||||
remorse_core.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\remorse_core.lib
|
||||
combat_tactics_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\combat_tactics_tests.exe
|
||||
entity_dispatch_entry_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\entity_dispatch_entry_tests.exe
|
||||
file_system_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\file_system_tests.exe
|
||||
fixed_map_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\fixed_map_tests.exe
|
||||
flex_archive_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\flex_archive_tests.exe
|
||||
glob_archive_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\glob_archive_tests.exe
|
||||
map_renderer_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\map_renderer_tests.exe
|
||||
palette_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\palette_tests.exe
|
||||
remorse_map_preview.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\remorse_map_preview.exe
|
||||
remorse_rebuild.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\remorse_rebuild.exe
|
||||
shape_archive_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\shape_archive_tests.exe
|
||||
type_flags_tests.vcxproj -> K:\ghidra\Crusader_Decomp\rebuild\remorse\out\build\Debug\type_flags_tests.exe
|
||||
Test project K:/ghidra/Crusader_Decomp/rebuild/remorse/out/build
|
||||
Start 1: entity_dispatch_entry_tests
|
||||
1/10 Test #1: entity_dispatch_entry_tests ...... Passed 0.01 sec
|
||||
Start 2: file_system_tests
|
||||
2/10 Test #2: file_system_tests ................ Passed 0.01 sec
|
||||
Start 3: palette_tests
|
||||
3/10 Test #3: palette_tests .................... Passed 0.01 sec
|
||||
Start 4: flex_archive_tests
|
||||
4/10 Test #4: flex_archive_tests ............... Passed 0.01 sec
|
||||
Start 5: fixed_map_tests
|
||||
5/10 Test #5: fixed_map_tests .................. Passed 0.01 sec
|
||||
Start 6: glob_archive_tests
|
||||
6/10 Test #6: glob_archive_tests ............... Passed 0.02 sec
|
||||
Start 7: type_flags_tests
|
||||
7/10 Test #7: type_flags_tests ................. Passed 0.01 sec
|
||||
Start 8: shape_archive_tests
|
||||
8/10 Test #8: shape_archive_tests .............. Passed 0.10 sec
|
||||
Start 9: map_renderer_tests
|
||||
9/10 Test #9: map_renderer_tests ............... Passed 0.62 sec
|
||||
Start 10: combat_tactics_tests
|
||||
10/10 Test #10: combat_tactics_tests ............. Passed 0.01 sec
|
||||
|
||||
100% tests passed, 0 tests failed out of 10
|
||||
|
||||
Total Test time (real) = 0.80 sec
|
||||
Crusader: No Remorse rebuild harness
|
||||
Program: CRUSADER.EXE
|
||||
Export root: K:\\ghidra\\Crusader_Decomp\\exports\\src_remorse
|
||||
Function files: 2984
|
||||
Fallback function files: 9
|
||||
Global buckets: 57
|
||||
Global definitions: 15403
|
||||
Status: host runtime scaffold is alive; exported game code is not linked yet.
|
||||
Game data root: K:\ghidra\Crusader_Decomp
|
||||
GAMEPAL.PAL bytes: 768
|
||||
GAMEPAL.PAL colors: 256
|
||||
COMBAT.DAT populated entries: 14
|
||||
COMBAT.DAT tactics: 14
|
||||
FIXED.DAT maps: 256
|
||||
FIXED.DAT first non-empty map: 1
|
||||
FIXED.DAT first non-empty entries: 7547
|
||||
GLOB.FLX objects: 3072
|
||||
TYPEFLAG.DAT shapes: 2048
|
||||
86
docs/pentagram-rendering-comparison.md
Normal file
86
docs/pentagram-rendering-comparison.md
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
# Pentagram Rendering Compared With The Windows Rebuild
|
||||
|
||||
## Scope
|
||||
|
||||
This note compares the checked-in Pentagram renderer with the current native renderer in `rebuild/remorse`. It describes source-level behavior, not a claim that Pentagram is a pixel-perfect Crusader reference or that its code can be dropped into the rebuild unchanged. The Pentagram tree was inspected read-only; no game data or generated scene data was copied between repositories.
|
||||
|
||||
## Summary
|
||||
|
||||
Pentagram renders the current world view from live map items on each paint. It activates map chunks around the camera, adds only those chunk items to a per-frame display list, rejects fully clipped sprites before sorting, resolves overlapping-item order, and draws each frame directly to a clipped software surface.
|
||||
|
||||
The rebuild instead constructs a player-centered bitmap, stores it as a scene backing image, and paints a crop of that image plus a separate player patch. A full-scene refresh reconstructs the item/node list and sort order, then replaces the backing image. The camera-prefetch change starts that refresh before the crop is exhausted, but it is still a whole-scene refresh rather than Pentagram-style active-area rendering.
|
||||
|
||||
The main transferable idea is therefore **spatially bounded live rendering**, not a different graphics API. Pentagram's order resolver and game-specific item rules still need Crusader verification before reuse.
|
||||
|
||||
## Pipeline Comparison
|
||||
|
||||
| Concern | Pentagram | Current Windows rebuild |
|
||||
|---|---|---|
|
||||
| World candidates | `CurrentMap` stores items in a 64 x 64 grid. `GameMapGump::PaintThis` visits active (`fast`) chunks only. | `collectSceneItems` stages fixed/live items and expands glob contents for the render. Full-scene options currently have no world rectangle, so the full item set participates in each scene render. |
|
||||
| Camera/visibility | `CameraProcess::GetLerped` updates a screen-space fast area. `CurrentMap::updateFastArea` uses coarse chunk bounds plus a projected chunk-rectangle check and a margin around the viewport. | A 2560 x 1440 player-centered backing image is cropped for the 1280 x 760 client. Near the crop margin, the UI asks the worker to build a new backing image around the player. |
|
||||
| Sprite culling | `ItemSorter::AddItem` gets frame bounds and calls `RenderSurface::CheckClipped` before adding a sprite to the dependency/sort list. The software painter also clips rows and pixels. | Scene nodes are prepared and sorted before `MapSceneRenderer::render` tests their rectangles against the output crop. The output loop avoids painting off-crop nodes, but most have already incurred node preparation and sort work. |
|
||||
| Draw order | `ItemSorter` incrementally builds overlap dependencies from item bounding boxes, including occlusion tests, then recursively paints dependencies before their dependents. | `prepareRenderNodes` builds a complete vector of sort items and `resolveRenderOrder` computes a full order for the collected render set. |
|
||||
| Allocation reuse | `ItemSorter` recycles `SortItem` objects and each item's dependency-list nodes between display lists. | Vectors are reserved per render, but scene items, render nodes, sort items, and order are rebuilt on every render. Decoded frames are cached by shape/frame in `MapSceneRenderer`; the parsed-frame table is local to a render call. |
|
||||
| Shape representation | `ShapeArchive::cache` loads a `Shape` on demand and retains it in the archive. Each `Shape` retains `ShapeFrame` metadata; `ShapeFrame` keeps line offsets and compressed RLE bytes, which the software painter walks directly. | Shape frames are decoded into pixel buffers and palette colors for rendering. The decoded-frame cache persists on the renderer, while scene nodes and ordering do not. |
|
||||
| Pixel destination | The normal `RenderSurface::SetVideoMode` path requests an SDL software surface. `SoftRenderSurface` paints shape RLE directly into it; `EndPainting` presents with `SDL_Flip`. | The renderer fills a 2560 x 1440 `RenderedMapImage`, converts it to BGR DIB pixels, and `paintWindow` copies the visible crop, overlays the player patch, then calls `StretchDIBits`. |
|
||||
| Update cadence | `GUIApp::paint` paints the desktop/gump tree each frame. `GameMapGump` obtains an interpolated camera position and builds/paints the world display list for that view. | The UI paints the cached scene crop each window paint. A background worker handles player patches and full backing-image refreshes; ordinary movement does not rebuild the full image unless a recenter or world mutation requires it. |
|
||||
|
||||
## Pentagram Details
|
||||
|
||||
### Active Map Area
|
||||
|
||||
`CurrentMap` keeps a chunk grid and a separate fast-area bitset. For Crusader, the chunk size is 1024 world units; the same class uses 512 for Ultima VIII. `updateFastArea` expands the camera's from/to bounds by viewport and chunk margins, checks a coarse chunk range, then calls `ChunkOnScreen` to test projected chunk bounds. `setChunkFast` and `unsetChunkFast` notify items entering or leaving the active area.
|
||||
|
||||
`CameraProcess::GetLerped` updates this area using the camera's interpolated interval. This keeps world activation ahead of camera movement rather than waiting until a fixed offscreen bitmap is exhausted.
|
||||
|
||||
### Display List And Visibility
|
||||
|
||||
`GameMapGump::PaintThis` calls `BeginDisplayList` with the interpolated camera, loops the chunk grid, skips chunks that are not fast, and submits items from active chunks. It also applies runtime filters for roofs, editor objects, and the special invisible-avatar case.
|
||||
|
||||
`ItemSorter::AddItem` obtains the shape frame and its dimensions, computes world and projected bounding boxes, and rejects fully clipped sprite rectangles before doing overlap/dependency work. Visible candidates are compared with existing candidates; overlap and occlusion relationships become dependency links. `PaintDisplayList` walks those links so objects behind an occluder paint first and fully occluded nodes are skipped.
|
||||
|
||||
This is not a simple global depth sort. It models Crusader/U8 item overlap rules using footpad bounds and projected geometry. It is also not automatically faster for every workload: each accepted item compares against earlier list entries, so a crowded active area can make insertion expensive. Pentagram gets its benefit primarily from limiting the candidate set and clipping before dependency construction.
|
||||
|
||||
### Shape And Pixel Path
|
||||
|
||||
`ShapeArchive::getShape` calls `cache`; a loaded `Shape` is retained in the archive's indexed shape vector. `Shape` creates frame objects once. `ShapeFrame` stores dimensions, offsets, line offsets, and an RLE data pointer. `SoftRenderSurface.inl` walks those runs and maps palette indices directly to destination pixels, with per-line and per-pixel clipping. It does not first expand every frame into a full RGB bitmap.
|
||||
|
||||
The standard surface is software-backed in the checked-in implementation: `RenderSurface::SetVideoMode(..., use_opengl=true)` reports OpenGL disabled, and the normal path selects `SDL_SWSURFACE` plus `SoftRenderSurface`. There is conditional D3D code behind an experimental compile flag, but it is not the default path.
|
||||
|
||||
## Differences That Matter For The Rebuild
|
||||
|
||||
1. **Selection happens too late in the rebuild.** The current full render creates nodes and resolves order for the full map before the final output-crop intersection. Pentagram's fast chunks reduce the set before its display list is sorted, and its clip test rejects off-surface frames before dependency insertion.
|
||||
2. **The rebuild has a backing-image boundary.** Crossing its prefetch threshold triggers a full scene render and replacement. Pentagram shifts the active world area with the camera and paints the current surface every frame; it does not need to rebuild a large player-centered bitmap to move the view.
|
||||
3. **The rebuild repeats preparation work.** Decoded pixels are retained, but scene collection, render-node construction, and order resolution are repeated for each full refresh. Pentagram also rebuilds a display list each paint, but does so only for active chunks and reuses its node/dependency allocations.
|
||||
4. **The pixel strategies differ.** Pentagram pays the RLE walk and palette conversion while drawing clipped pixels. The rebuild pays frame decode and buffer memory up front, then copies RGB pixels during rasterization and DIB presentation. Which wins depends on active-item count, sprite coverage, and movement; source inspection alone does not establish a universal timing winner.
|
||||
5. **Their sorting contracts are related, not identical.** The rebuild already ports several `ItemSorter` concepts, but Pentagram's `SortItem` flags, overlap tests, transparency behavior, roof rules, and insertion/dependency order should be compared case-by-case before claiming parity.
|
||||
|
||||
One instrumented map-1 launch of the rebuild after widening the initial scene selection produced 16,542 render candidates, 16,540 decoded nodes, and 1,355 painted nodes. The initial scene published in about 0.76 seconds on that run. This is evidence that scene creation is currently sub-second on this machine, but it also shows that most prepared nodes did not touch the initial viewport. It does not measure repeated camera recentering or establish how long a crowded region takes.
|
||||
|
||||
## Practical Directions
|
||||
|
||||
1. Add a native spatial index over map chunks or projected bounds. Query only chunks intersecting the camera's visible area plus a measured overscan margin; update membership before the player reaches the edge. Preserve a conservative overlap margin for tall sprites and glob contents.
|
||||
2. Use conservative sprite bounds from TYPEFLAG dimensions and frame metadata to reject offscreen candidates before full pixel decoding and order resolution. Keep the final per-pixel clip as the correctness boundary.
|
||||
3. Reuse stable render-node and sorting storage, or cache static-map preparation separately from mutable/live items. Invalidate only when relevant map content changes; do not reuse a stale sorted list across changed flags, positions, frames, globs, or roofs.
|
||||
4. Keep avatar animation work independent in priority from whole-scene refreshes. The current worker now publishes the player patch before a full scene render and coalesces camera-prefetch requests; measure whether that removes the observed animation stall before adding a second concurrent renderer.
|
||||
5. Instrument per-frame counts and durations: chunks visited/active, items submitted, rejected by clip, decoded-frame cache hits/misses, sort comparisons, nodes painted, and time in collection/sort/raster/presentation. This will identify whether chunk activation, early culling, cache reuse, or incremental redraw has the best payoff.
|
||||
|
||||
Pentagram's 6 x 5 dirty-tile renderer documented in the original Crusader draw-list analysis is a separate original-executable mechanism; it should not be inferred from Pentagram's `CurrentMap` fast chunks. Fast chunks activate world objects, while Pentagram's checked-in `GameMapGump` still paints its display list to the current render surface each frame.
|
||||
|
||||
## Source References
|
||||
|
||||
### Pentagram
|
||||
|
||||
- [`GameMapGump::PaintThis`](../../../misc/pentagram/gumps/GameMapGump.cpp)
|
||||
- [`ItemSorter::BeginDisplayList`, `AddItem`, and `PaintDisplayList`](../../../misc/pentagram/world/ItemSorter.cpp)
|
||||
- [`CurrentMap::updateFastArea`, `ChunkOnScreen`, and fast-area transitions`](../../../misc/pentagram/world/CurrentMap.cpp)
|
||||
- [`CameraProcess::GetLerped`](../../../misc/pentagram/world/CameraProcess.cpp)
|
||||
- [`ShapeArchive::getShape` and `cache`](../../../misc/pentagram/graphics/ShapeArchive.cpp)
|
||||
- [`Shape` frame loading](../../../misc/pentagram/graphics/Shape.cpp), [`ShapeFrame`](../../../misc/pentagram/graphics/ShapeFrame.cpp), and [`SoftRenderSurface` RLE painter](../../../misc/pentagram/graphics/SoftRenderSurface.inl)
|
||||
- [`RenderSurface` backend selection](../../../misc/pentagram/graphics/RenderSurface.cpp), [`GUIApp::paint`](../../../misc/pentagram/kernel/GUIApp.cpp), and [`BaseSoftRenderSurface::EndPainting`](../../../misc/pentagram/graphics/BaseSoftRenderSurface.cpp)
|
||||
|
||||
### Native Rebuild
|
||||
|
||||
- [`MapSceneRenderer::render`, item collection, and node preparation](../rebuild/remorse/src/map_renderer.cpp)
|
||||
- [`fullSceneOptions`, `startLiveRenderer`, `paintWindow`, and camera-prefetch requests](../rebuild/remorse/src/windowed_game_main.cpp)
|
||||
- [Original draw-list/tile-visibility notes](raw-0007-rendering.md)
|
||||
|
|
@ -123,6 +123,19 @@ Work:
|
|||
|
||||
Exit criteria: the user can launch the host build, view a map, move the camera/avatar test object, and observe stable tick/update behavior.
|
||||
|
||||
#### ScummVM-Style Live Viewport, Zoom, And Smooth Camera
|
||||
|
||||
After live item state and source draw-order behavior are available, replace the fixed player-centered scene bitmap as the primary world-rendering path with a live viewport renderer based on ScummVM's useful architecture: select nearby world candidates, clip before sorting, build a reusable display list, and paint the current view each frame. Retain the fixed-scene/offline renderer as a diagnostic and regression oracle during migration. Do not copy `CurrentMap` fast-area activation directly for render culling: ScummVM's fast-area enter/leave callbacks also affect gameplay objects.
|
||||
|
||||
1. **Bound render candidates:** index fixed, live, and expanded-glob items by world chunk or another measured spatial structure. Query the camera's visible world bounds plus an overscan margin; keep this render set separate from gameplay activation and process scheduling.
|
||||
2. **Cull before sorting:** compute conservative projected frame bounds, reject candidates outside the viewport clip before decoded-frame misses and dependency comparisons, and retain final per-pixel clipping. Preserve Crusader-specific overlap/order rules and add regressions for tall sprites, roofs, transparency, flipped frames, inventory items, and player overlays.
|
||||
3. **Reuse per-frame work:** reuse display-list, node, dependency, and frame-cache storage. Invalidate cached geometry/order on position, frame, flag, roof, glob-hatch, or world-mutation changes. Measure candidate counts, clip rejects, sorter comparisons, allocations/cache hits, and collection/sort/raster/presentation time before selecting an indexed-frame or palette-expanded cache policy.
|
||||
4. **Separate camera projection:** represent camera position and zoom independently of avatar/world state. Centralize world-to-screen projection and its inverse; derive the queried world bounds and sprite clip bounds from viewport dimensions and zoom. Keep HUD and window controls in screen space. Preserve a pixel-art-friendly sampling policy and test zoom limits, viewport resize, and edge clipping.
|
||||
5. **Add optional smooth follow:** keep the recovered/legacy camera behavior as the parity mode and add a selectable host-only smooth-follow mode. Interpolate camera position using elapsed time toward a configurable target/offset, independent of the fixed simulation tick; apply zoom around a stable screen anchor so zoom changes do not jump the avatar. Camera motion must not alter gameplay coordinates, animation state, or simulation tick counts.
|
||||
6. **Integrate animation and presentation:** choose animation frames from simulation state and render interpolation without blocking camera updates on a full-scene rebuild. Keep mutable/player animation responsive while scene candidates are gathered and painted; remove the backing-image recenter dependency from the normal viewport path only after the live path meets parity and performance gates.
|
||||
|
||||
Exit criteria: deterministic tests cover camera projection/inverse bounds, zoom in/out and resize, smooth-camera convergence at different frame rates, and unchanged world/avatar state under camera-only motion. A retail map regression checks item ordering, clipping, animation, and screen-edge behavior at minimum/default/maximum zoom. Profiling demonstrates bounded candidate/sort work and no camera-induced animation stalls. The smooth-follow mode remains opt-in and is documented as a modernization, not original-binary parity.
|
||||
|
||||
### Phase 6: USECODE / VM Runtime
|
||||
|
||||
Goal: execute game scripts from original `EUSECODE.FLX`.
|
||||
|
|
@ -277,7 +290,7 @@ The `Item_Grab` creation branch applies the verified `FUN_11d0_3f95(itemNumber,
|
|||
|
||||
The first Phase 6 resource slice is compiled into `remorse_core`: a bounded `EUSECODE.FLX` class/name/event-body reader follows the owner-loaded `classId + 2`, 13-byte name-table, `+0x14` six-byte row, and `codeBase + relativeOffset - 1` body rules verified in `docs/raw-000a-000d.md`. Retail tests confirm `EVENT` (`class 0x361`, slot `0x0a`, code base `0xd4`, body length `0x1fd6`) and `RECHFLNS` (`class 0x138`, release slot `9`, body length `102`, owner mask `0x200`). Raw extracted `CARD_NS`, `BOX_NS`, and `RECHFLNS` bodies confirm a 14-byte metadata prefix followed by the first opcode at offset `0x0e`; its exact field meanings remain unknown. The named offset is shared by the host task runner and tested against these retail bodies. Retail integration tests execute `CARD_NS` spawning `SWITCH` and `BOX_NS` through timer yields to a changed item frame and rendered scene. The Windows diagnostic release callback also resolves and queues an eligible body, but this is host-side dispatch and task initialization, not `Usecode_ItemCallEvent` or `EntityVmContext::CreateFromSlotIndex`. The interpreter covers only a subset of opcodes/services, and unsupported operations halt tasks; original context memory, far-pointer execution, general event dispatch, and runtime parity remain open. The recovered `CreateFromSlotIndex` call selects a class/slot and passes a four-byte parameter into `Inter_1418_0244` (`1418:0244`) and `Interpreter_1418_00e8` (`1418:00e8`). Even the short `RECHFLNS` release event branches through item surface-weight logic and `FREE.slot_33`; the current host service table does not complete that path.
|
||||
|
||||
The walk/run modifier choice is the isolated branch from `Controller_PickNextAnimByKeyevent` (`1130:12d6`) and `KeyEvent_IsShiftDown` (`11c8:016c`): bits `1|2` select Shift, bit `0x40` selects Caps Lock, and walk is selected when their Boolean states match. The same selector's Num Lock-off directional scan branch (`0x47/48/49/4b/4d/4f/50/51`) is now compiled in the controls helper, regression-tested across all eight mappings, and called by Win32 movement polling. Win32 still supplies modifiers and held-key state; NPC state, weapon-dependent actions, original keyboard events, and the remainder of the controller selector are not ported. Retail ANIM.DAT regression checks retain the signed reverse steps in the decoder while testing the host-only forward movement filter across all four affected walk directions.
|
||||
The Windows controller slice now consumes queued key events through the registered host keyboard-process subscription. It preserves the original event-mode (`KeyEvent +0x08`) and press/release (`+0x09`) bytes, translates Shift/Caps Lock and Alt/Ctrl modifier bits, and implements the recovered Num Lock-off eight-direction mappings plus Num Lock-on relative turns and facing-aligned forward/reverse requests. Walk/run selection follows `Controller_PickNextAnimByKeyevent` (`1130:12d6`) and `KeyEvent_IsShiftDown` (`11c8:016c`): bits `1|2` select Shift, bit `0x40` selects Caps Lock, and walk is selected when their Boolean states match. The current action subset maps the recovered Alt/Ctrl animation indices, loads the corresponding player clips from ANIM.DAT, advances valid stationary animation frames, and retires one-shot animation processes on clip completion or blocked movement. Focused tests cover event transitions, modifier isolation, Num Lock modes, action selection, and retail clip/frame references. This remains a host controller model: `Controller_PickNextAnimByKeyevent`'s full NPC busy/dead/stasis branches, weapon-dependent paired actions, crosshair/target updates, complete turn handling, original controller process dispatch, vertical jump response, and exact original collision response are not ported. Host 40 Hz timing and map collision remain approximations; the source scheduler does not yet drive this player path.
|
||||
|
||||
On Windows, `remorse_game.exe`, `remorse_rebuild.exe`, and `remorse_map_preview.exe` configure crash reports at startup. All CTest binaries now link a test-only startup initializer for the same diagnostics, so an assertion before `main` cannot open an Abort/Retry/Debug modal that blocks the build terminal. The timeout-bounded child probes exercise both a Debug CRT assertion and C++ termination, verifying prompt-free nonzero exits. The terminate handler reports active C++ exception messages to the Visual Studio Debug output and stderr when available. Escaped/unhandled Windows exceptions log their code/address and suppress the fault popup. The GUI executable has no console stderr by default, so attach a debugger to see that output. This does not replace a full crash dump or catch process termination that bypasses user-mode handlers.
|
||||
|
||||
|
|
@ -535,6 +548,18 @@ python rebuild/remorse/tools/import_export_slice.py classes/Remorse/EntityDispat
|
|||
|
||||
After the first source-backed interaction, complete the original player/item loop, save/load, combat, mission flow, audio, frontend, and retail-map coverage. Keep the current preview and window as test hosts until recovered runtime behavior replaces their stand-ins.
|
||||
|
||||
## Track B Recovery Work Order
|
||||
|
||||
Use this sequence to move the normal Windows launch path from host-modeled behavior back to the intended decompiled-source port. Keep the current executable, data readers, preview, and tests; treat host gameplay implementations as temporary until their original call paths replace them.
|
||||
|
||||
1. **Freeze and classify the normal path:** do not add more host-only gameplay behavior to the default launch path. For startup, ticking, input, movement, interaction, and drawing, record the controlling original function/address, current host implementation, required host-service boundary, and status as translated, verified, or stand-in. Keep diagnostic-only behavior behind `--diagnostics`.
|
||||
2. **Prove the source-to-build pipeline:** choose a small, already-understood exported function used by the runtime (for example, a process sleep/timer primitive), clean its types, globals, layout, and calling convention, then compile and link that implementation into `remorse_core`. Replace the matching host-authored behavior with this compiled function and test its state changes against the export and Ghidra evidence. The import helper is staging only; do not count a staged export or isolated test as integrated.
|
||||
3. **Restore the original startup and tick path:** port the minimum dependency chain for `Game_Start` (`1020:0000`), teleporter placement/waiting, kernel scheduler, timer, and item/NPC ownership. Route normal startup and simulation through these compiled functions; retain modeled startup and host polling only as diagnostics until parity checks pass.
|
||||
4. **Move player behavior onto that path:** replace host-created avatar/controller state, movement-step policy, and approximate collision with the recovered item, keyboard, controller, animation, and collision call chain. Feed Win32 input and timing into explicit host-service adapters; the game logic must not depend directly on Win32 APIs.
|
||||
5. **Reconnect presentation and interaction:** render the live mutable world through recovered draw-list/order and camera behavior, then complete one reachable map-1 interaction through original item search, event dispatch, VM execution, and a visible world mutation. Keep the static preview as a regression oracle, not the normal gameplay renderer.
|
||||
6. **Gate each replacement:** for every slice, record source address, exported function, unresolved decompiler assumptions, host substitutions, and tests; verify it is compiled into and called by `remorse_game`. Remove a stand-in from the normal path only after deterministic behavior checks pass. Update the function counts and parity status in this roadmap as slices land.
|
||||
7. **Preserve the portability path:** keep recovered game logic and resource formats platform-neutral, with Win32 window/input/timing services behind replaceable interfaces. Once the original loop works through those interfaces, select and validate a portable host such as SDL; do not count the current Win32-only window as multi-platform support.
|
||||
|
||||
## Near-Term Next Actions
|
||||
|
||||
1. **Close the event path:** identify and reach an eligible retail `use` target from the actual level-start pad at `(30328, 29656, 16)`. The exact production-equivalent search at egg `0x1e` still returns one candidate and no eligible event, but that is the intermediate staging point, not the current avatar location; rerun the search from the destination. Map-wide evidence includes the inactive/map-array `PANELNS`, a `CARD_NS` whose authorized state requires keycard 6, and a frame-0 `CHEST_EW` at staged `(1087, 2559, 0)` whose recovered handler attempts a legal shape swap to `0x054b` before animating. The host implements `Item.setShape` (`0x24`), but `FREE.slot_2d`'s family check, `Item.legal_create`, and temporary-item lifecycle are still missing; the chest's collision route is unverified. Next prove reachability and implement only the required recovered services, then exercise owner selection, context creation, VM execution, and a process/world-state effect. The BOX_NS regression still verifies candidate-driven selection and visible frame output from a fixture origin only; it does not close this action or establish `Usecode_ItemCallEvent` parity.
|
||||
|
|
|
|||
86
docs/scummvm-rendering-comparison.md
Normal file
86
docs/scummvm-rendering-comparison.md
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
# ScummVM Rendering Compared With The Windows Rebuild
|
||||
|
||||
## Scope
|
||||
|
||||
This note compares the current ScummVM Ultima 8 engine's Crusader rendering path with `rebuild/remorse`. ScummVM is a modern reimplementation, not an exact transcription of every original runtime behavior. Its source is useful as an implementation and data-format reference, but original-binary parity still requires separate verification. The ScummVM checkout was inspected read-only; no ScummVM code or game data was copied into this repository.
|
||||
|
||||
## Summary
|
||||
|
||||
ScummVM renders the current viewport from live world items. `CurrentMap` maintains a camera-relative fast area over a 64 x 64 chunk grid. `GameMapGump` collects objects from active chunks, and `ItemSorter` rejects completely clipped frame rectangles before constructing overlap dependencies and drawing. Shape data is cached by the archive; raw RLE frames are expanded once into retained 8-bit indexed `ShapeFrame` surfaces. Each paint maps those indexed pixels through the shape palette into ScummVM's managed screen surface.
|
||||
|
||||
The native rebuild instead collects a map scene, prepares and orders render nodes, draws a player-centered backing bitmap, and copies a crop of that bitmap to the window. It currently processes the full map item set for full-scene renders, then uses a background worker to recenter the bitmap and render the player patch. It caches decoded frames, but rebuilds the node/order structures for each full scene render.
|
||||
|
||||
The strongest ScummVM ideas for the rebuild are active-area candidate selection and early frame-rectangle culling. Its fast-area machinery also drives item lifecycle behavior, and its sorter is game-specific; neither should be copied as a rendering-only optimization without preserving those contracts.
|
||||
|
||||
## Pipeline Comparison
|
||||
|
||||
| Concern | ScummVM | Current Windows rebuild |
|
||||
|---|---|---|
|
||||
| World candidates | `CurrentMap` stores map items by chunk. `GameMapGump::PaintThis` visits the 64 x 64 grid and submits items only from chunks marked fast. | `collectSceneItems` stages fixed/live records and expands globs. Full-scene options currently omit `worldRect`, so all renderable map items enter full-scene preparation. |
|
||||
| Camera and active area | `CameraProcess::GetLerped` updates `CurrentMap::updateFastArea` over the camera's from/to positions. Coarse chunk bounds are refined using projected chunk rectangles and a viewport margin. | `paintWindow` crops a 2560 x 1440 player-centered backing image. Near a crop margin it queues a background full-scene recenter. |
|
||||
| Early visibility | `ItemSorter::AddItem` fetches frame dimensions, computes the projected frame rectangle, and rejects a rectangle outside the render clip before overlap/dependency sorting. | `prepareRenderNodes` prepares and orders items before `MapSceneRenderer::render` intersects node rectangles with the output crop. The raster loop avoids off-crop pixels, but off-crop nodes have already been prepared and sorted. |
|
||||
| Occlusion/order | `SortItem::below`, `overlap`, and `occludes` drive dependency links and painter order. ScummVM adds Crusader-specific sprite and inventory-item ordering fields/rules. | A complete sort-item vector is passed to `resolveRenderOrder`; this ports several Pentagram/ScummVM geometry rules but is rebuilt for each full render. |
|
||||
| Sort storage | `GameMapGump` constructs `ItemSorter(2048)`. `BeginDisplayList` recycles the prior list into an unused pool; more nodes are allocated if needed. Per-item dependency storage is also reused. | Render vectors reserve capacity per call, but scene items, nodes, sort items, and the resolved order are reconstructed each full render. |
|
||||
| Shape cache | `ShapeArchive::getShape` lazily caches a `Shape` by shape number. `Shape` builds `ShapeFrame` objects once; each frame retains a decoded CLUT8 pixel surface. | `MapSceneRenderer` retains decoded `DecodedShapeFrame` entries by shape/frame, including palette-expanded pixel colors. Parsed frame collections are local to a render call. |
|
||||
| Pixel path | `RenderSurface::Paint` walks the cached indexed frame surface and maps pixels through the palette into a `Graphics::ManagedSurface`. The engine paints the gump tree, ends painting, and calls `Graphics::Screen::update()`. | The renderer creates a `RenderedMapImage`, converts it to BGR DIB pixels, copies the visible crop, overlays a separate player patch, and calls `StretchDIBits`. |
|
||||
| Update cadence | `Ultima8Engine::paint` paints the desktop/gump tree each frame; `GameMapGump` rebuilds and paints the current display list at the interpolated camera position. | The window paints the cached bitmap on `WM_PAINT`; a worker handles player patches and occasional full-scene recentering. Player patch work is now published before a full refresh. |
|
||||
|
||||
## ScummVM Details
|
||||
|
||||
### Camera-Relative Fast Area
|
||||
|
||||
`CurrentMap` uses a 64 x 64 chunk grid. Its chunk size is 1024 world units for Crusader and 512 for Ultima VIII. `updateFastArea` builds a projected screen-space region from the camera's `from`/`to` positions and map-gump dimensions, expands it by a coarse margin, then checks candidate chunks with `ChunkOnScreen`. Chunks changing state call `setChunkFast` or `unsetChunkFast`, which notify their items through `enterFastArea` and `leaveFastArea`.
|
||||
|
||||
The camera calls this update while interpolating. Therefore the active area follows camera movement before the viewport reaches its new position. Importantly, fast-area transitions are also gameplay lifecycle events: eggs and other items can perform work on entry/exit. A native renderer should initially build a separate render-candidate index unless it is also ready to model those world-state transitions.
|
||||
|
||||
### Clipped Display List And Crusader Ordering
|
||||
|
||||
`GameMapGump::PaintThis` obtains the interpolated camera, determines a roof Z limit, begins a display list with the surface clip rectangle, and submits eligible items from fast chunks. It filters roof/editor content and preserves a special path for the invisible main actor. `ItemSorter::AddItem` computes footpad and frame bounds, then skips a frame that does not intersect the clip before scanning existing visible entries for overlap and ordering dependencies.
|
||||
|
||||
`SortItem::below` includes geometry-based ordering plus special cases for Crusader sprites, inventory items, translucent/animated/flat pieces, roofs, and other shape flags. `PaintDisplayList` recursively paints dependencies and skips occluded nodes. There is an experimental occlusion grouping path behind `SORTITEM_OCCLUSION_EXPERIMENTAL`; it is not the default contract. Like Pentagram, insertion compares a new visible item against prior list entries, so reducing the active/clipped candidate count is central to keeping this sorter practical.
|
||||
|
||||
### Cached Indexed Frames And Managed Surface
|
||||
|
||||
`ShapeArchive::cache` loads a shape on first use and retains it in the archive's shape vector. `Shape` parses each raw frame into an intermediate `RawShapeFrame`, constructs a `ShapeFrame`, then releases the intermediate. `ShapeFrame` expands RLE into a `Graphics::Surface` in CLUT8 format and retains that indexed image. `RenderSurface::Paint` maps the indexed pixels through the shape's native palette into the active 8-, 16-, or 32-bit surface path supported by that method.
|
||||
|
||||
This differs from both nearby implementations: Pentagram's software painter walks RLE runs while drawing, while the rebuild stores palette-expanded decoded pixels in its renderer cache. ScummVM pays a one-time indexed-frame expansion and keeps palette mapping separate from frame pixels.
|
||||
|
||||
`Ultima8Engine::paint` wraps gump rendering with `BeginPainting`/`EndPainting` and then calls `_screen->update()`. The render surface is backed by ScummVM's `Graphics::ManagedSurface`/`Graphics::Screen`; this source path is a CPU pixel renderer feeding ScummVM's presentation system, not a dedicated GPU scene renderer.
|
||||
|
||||
ScummVM also has useful diagnostic hooks: `PAINT_TIMING` can report average paint time, and the debugger command `RenderSurface::benchmark <shape> <frame> <iterations>` measures normal, translucent, mirrored, invisible, and highlighted shape draws. Those hooks can guide a controlled comparison, but no ScummVM benchmark was run for this note.
|
||||
|
||||
## Differences That Matter For The Rebuild
|
||||
|
||||
1. **Candidate selection precedes ordering in ScummVM.** The rebuild's output crop is applied after node preparation and global ordering. A native chunk/spatial index plus conservative frame bounds could reject most map items before decode and sorting.
|
||||
2. **ScummVM keeps rendering in world coordinates.** It doesn't depend on a player-centered cached map image with a recenter edge. The rebuild's current prefetch avoids waiting for that edge, but a full scene refresh still rebuilds the map-wide candidate/node/order pipeline.
|
||||
3. **ScummVM separates frame color indices from screen format.** Its retained CLUT8 frames use less memory than a same-sized RGB cache and can be mapped for the current output format. The tradeoff is palette lookup during each draw. Benchmark memory, decode time, and raster time before changing the rebuild's RGB cache.
|
||||
4. **Its active area is simulation-visible.** `enterFastArea`/`leaveFastArea` have item callbacks. Rendering-only culling should not deactivate gameplay objects or scripts by accident.
|
||||
5. **The sorter is not an interchangeable library.** ScummVM's current comparison paths include Crusader-specific `_sprite`/`_invitem` flags, clip handling, and ordering corrections. Preserve local tests and compare these cases one by one rather than copying the entire class.
|
||||
6. **The display-list pool doesn't eliminate sort cost.** It avoids repeated node allocation, but each paint still gathers active items, tests visible candidates pairwise, resolves dependencies, and rasterizes the display list. Benefits depend on keeping the fast area bounded.
|
||||
|
||||
## Practical Directions
|
||||
|
||||
1. Build a native chunk index over fixed/live map records and glob-expanded placements. Query the viewport plus a configurable overscan margin; keep its membership separate from gameplay activation until item enter/leave behavior is ported.
|
||||
2. Move conservative projected frame-rectangle rejection ahead of node creation, decoded-frame misses, and dependency comparisons. Keep final pixel clipping for correctness.
|
||||
3. Reuse node and dependency storage, or cache static geometry/order and update only mutable entries. Invalidate on position/frame/flag changes, glob hatch changes, roofs, transparency, and world-script mutations.
|
||||
4. Benchmark the three frame representations explicitly: Pentagram's direct RLE walk, ScummVM's cached CLUT8 frame, and the rebuild's palette-expanded decoded frame. Measure a representative map and movement, not only an isolated sprite.
|
||||
5. Record active chunk/item counts, clip rejects, frame-cache hits/misses, sorter comparisons, painted nodes, pixel coverage, and separate collection/sort/raster/present times. The rebuild's instrumented map-1 run previously produced 16,542 candidates, 16,540 decoded nodes, and 1,355 painted nodes in about 0.76 seconds for initial publication; repeated full recenter cost and animation contention need separate measurements.
|
||||
|
||||
The original Crusader executable's 6 x 5 dirty-tile draw system is a separate mechanism documented in [raw-0007-rendering.md](raw-0007-rendering.md). ScummVM's fast chunks control which world items are active and considered; they are not that original screen-tile dirty map.
|
||||
|
||||
## Source References
|
||||
|
||||
### ScummVM
|
||||
|
||||
- [`GameMapGump::PaintThis`](../../../misc/scummvm/engines/ultima/ultima8/gumps/game_map_gump.cpp)
|
||||
- [`ItemSorter::BeginDisplayList`, `AddItem`, and `PaintDisplayList`](../../../misc/scummvm/engines/ultima/ultima8/world/item_sorter.cpp)
|
||||
- [`SortItem` geometry and ordering rules](../../../misc/scummvm/engines/ultima/ultima8/world/sort_item.cpp)
|
||||
- [`CurrentMap::updateFastArea` and chunk transitions](../../../misc/scummvm/engines/ultima/ultima8/world/current_map.cpp), [`CameraProcess`](../../../misc/scummvm/engines/ultima/ultima8/world/camera_process.cpp)
|
||||
- [`ShapeArchive` lazy shape cache](../../../misc/scummvm/engines/ultima/ultima8/gfx/shape_archive.cpp), [`Shape` frame construction](../../../misc/scummvm/engines/ultima/ultima8/gfx/shape.cpp), and [`ShapeFrame` indexed decode](../../../misc/scummvm/engines/ultima/ultima8/gfx/shape_frame.cpp)
|
||||
- [`RenderSurface`](../../../misc/scummvm/engines/ultima/ultima8/gfx/render_surface.cpp), [`Ultima8Engine::paint`](../../../misc/scummvm/engines/ultima/ultima8/ultima8.cpp), and [`RenderSurface::benchmark`](../../../misc/scummvm/engines/ultima/ultima8/misc/debugger.cpp)
|
||||
|
||||
### Native Rebuild
|
||||
|
||||
- [`MapSceneRenderer::render`, item collection, and node preparation](../rebuild/remorse/src/map_renderer.cpp)
|
||||
- [`fullSceneOptions`, `startLiveRenderer`, and `paintWindow`](../rebuild/remorse/src/windowed_game_main.cpp)
|
||||
- [Existing map-renderer format and sorting notes](map-rendering.md)
|
||||
17
play-remorse-rebuild.bat
Normal file
17
play-remorse-rebuild.bat
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@echo off
|
||||
setlocal
|
||||
set "ROOT=%~dp0"
|
||||
set "GAME=%ROOT%rebuild\remorse\out\build-controller-verify\remorse_game.exe"
|
||||
|
||||
if not exist "%GAME%" (
|
||||
echo Could not find the rebuild executable:
|
||||
echo %GAME%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%ROOT%"
|
||||
"%GAME%" %*
|
||||
set "RESULT=%ERRORLEVEL%"
|
||||
popd
|
||||
exit /b %RESULT%
|
||||
28
py_mcp_query.py
Normal file
28
py_mcp_query.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import json
|
||||
|
||||
addrs = ["000d:44df","000d:4c99","000d:7000","000d:46ec"]
|
||||
results = {}
|
||||
|
||||
try:
|
||||
import ghidra_mcp
|
||||
except Exception as e:
|
||||
print(json.dumps({"error": "missing ghidra_mcp module", "exc": str(e)}))
|
||||
raise SystemExit(1)
|
||||
|
||||
for a in addrs:
|
||||
entry = {}
|
||||
try:
|
||||
entry['decompile'] = ghidra_mcp.decompile_function(a)
|
||||
except Exception as e:
|
||||
entry['decompile_error'] = str(e)
|
||||
try:
|
||||
entry['disassemble'] = ghidra_mcp.disassemble_function(a)
|
||||
except Exception as e:
|
||||
entry['disassemble_error'] = str(e)
|
||||
try:
|
||||
entry['xrefs'] = ghidra_mcp.get_xrefs(a)
|
||||
except Exception as e:
|
||||
entry['xrefs_error'] = str(e)
|
||||
results[a] = entry
|
||||
|
||||
print(json.dumps(results))
|
||||
|
|
@ -145,6 +145,8 @@ public:
|
|||
EntityVmContextProcessEntry* createUsecodeProcess(u8 activeGroup, u16 (&groupCounts)[32]);
|
||||
bool startAnimPrimitiveProcess(u16 processId, LiveFixedMapItems& items,
|
||||
const AnimationClip& clip, u8 frameSkip = 0);
|
||||
std::optional<u8> updateAnimPrimitiveDirection(u16 processId, LiveFixedMapItems& items,
|
||||
u8 direction);
|
||||
std::optional<bool> advanceGroundedAnimPrimitive(u16 processId, LiveFixedMapItems& items,
|
||||
const AnimationClip& clip, const std::vector<ShapeTypeInfo>& shapes,
|
||||
const FastAreaRange& fastArea);
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ struct NpcAnimationState {
|
|||
u16 lastAnimation = 0xffff;
|
||||
u8 frame = 0;
|
||||
u8 moreFlags = 0;
|
||||
u8 direction = 0;
|
||||
};
|
||||
|
||||
class LiveFixedMapItems {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,15 @@
|
|||
#include "remorse/compat.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace remorse {
|
||||
|
||||
inline constexpr std::array<u8, 25> controllerAnimationIndices{
|
||||
0, 1, 2, 3, 4, 0x0b, 0x10, 0x17, 0x18, 0x1c, 0x1d, 0x20, 0x22,
|
||||
0x24, 0x26, 0x28, 0x29, 0x2e, 0x30, 0x37, 0x38, 0x3a, 0x3b, 0x3d, 0x3e};
|
||||
|
||||
struct WorldPositionD {
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
|
|
@ -20,6 +25,48 @@ inline bool controllerWalkRequested(u16 modifiers)
|
|||
return shiftDown == capsLockOn;
|
||||
}
|
||||
|
||||
inline bool controllerAllowsInPlaceDirectionUpdate(u8 animation)
|
||||
{
|
||||
switch (animation) {
|
||||
case 1: case 3: case 4: case 7: case 8: case 10: case 12: case 13: case 15:
|
||||
case 25: case 34: case 35: case 36: case 37: case 38: case 39: case 42: case 43:
|
||||
case 44: case 45: case 46: case 47: case 48: case 49: case 50: case 54:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool controllerLastAnimationIsRunning(u8 animation)
|
||||
{
|
||||
switch (animation) {
|
||||
case 1: case 3: case 34: case 35: case 38: case 48: case 49: case 56:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool controllerLastAnimationIsRunningJumping(u8 animation)
|
||||
{
|
||||
switch (animation) {
|
||||
case 3: case 48: case 49: case 56:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool controllerLastAnimationIsNotCombat(u8 animation)
|
||||
{
|
||||
switch (animation) {
|
||||
case 0: case 1: case 11: case 16: case 32: case 55: case 58: case 59:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline std::optional<u8> controllerDirectionFromScan(u8 scanCode)
|
||||
{
|
||||
// Controller_PickNextAnimByKeyevent (1130:12d6), directional keys with Num Lock off.
|
||||
|
|
@ -39,41 +86,324 @@ inline std::optional<u8> controllerDirectionFromScan(u8 scanCode)
|
|||
struct ControllerMovementRequest {
|
||||
u8 animation = 0;
|
||||
u8 direction = 14;
|
||||
bool oneShot = false;
|
||||
bool updateDirectionInPlace = false;
|
||||
};
|
||||
|
||||
enum class ControllerCommand : u8 {
|
||||
FireWeapon,
|
||||
SelectNextItem,
|
||||
CycleWeaponForward,
|
||||
OpenInventory
|
||||
};
|
||||
|
||||
struct ControllerCommandRequest {
|
||||
ControllerCommand command = ControllerCommand::FireWeapon;
|
||||
};
|
||||
|
||||
struct ControllerActorState {
|
||||
u16 npcNumber = 1;
|
||||
u16 mapNumber = 1;
|
||||
u8 direction = 14;
|
||||
u8 lastAnimation = 0;
|
||||
bool controllerEnabled = true;
|
||||
bool dead = false;
|
||||
bool avatarInStasis = false;
|
||||
bool kneeling = false;
|
||||
bool activeWeapon = false;
|
||||
bool busy = false;
|
||||
bool lastAnimationNotCombat = true;
|
||||
bool avatarSomethingCombatty = false;
|
||||
};
|
||||
|
||||
class ControllerMovementState {
|
||||
public:
|
||||
void setActorState(const ControllerActorState& state)
|
||||
{
|
||||
if (state.direction != actor_.direction) {
|
||||
lastDirection_ = state.direction;
|
||||
}
|
||||
actor_ = state;
|
||||
setFacingDirection(state.direction);
|
||||
crouched_ = state.kneeling;
|
||||
}
|
||||
|
||||
void handleDirectionalKey(u8 scanCode, u16 modifiers, bool pressed)
|
||||
{
|
||||
modifiers_ = modifiers;
|
||||
const auto direction = controllerDirectionFromScan(scanCode);
|
||||
if (!direction) {
|
||||
handleKeyEvent(scanCode, modifiers, 1, pressed ? 1 : 0, pressed ? 1 : 0);
|
||||
}
|
||||
|
||||
void handleKeyEvent(u8 scanCode, u16 modifiers, u8 eventMode, u8 keyState,
|
||||
u16 keyAction = 1, u16 eventFlags = 0)
|
||||
{
|
||||
if (!actor_.controllerEnabled || actor_.npcNumber == 0 || actor_.dead ||
|
||||
(actor_.npcNumber == 1 && actor_.avatarInStasis)) {
|
||||
return;
|
||||
}
|
||||
modifiers_ = modifiers;
|
||||
if (eventMode == 0) {
|
||||
return;
|
||||
}
|
||||
if (keyState != 0 && keyAction == 1 && actor_.npcNumber == 1 &&
|
||||
(scanCode == 0x0f || scanCode == 0x24)) {
|
||||
if (!actor_.busy || (actor_.lastAnimation != 56 &&
|
||||
controllerLastAnimationIsRunningJumping(actor_.lastAnimation))) {
|
||||
pendingAction_ = ControllerMovementRequest{56, actor_.direction, true};
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (keyState != 0 && keyAction == 1 && actor_.npcNumber == 1) {
|
||||
if ((scanCode == 0x39 || scanCode == 0x52) && actor_.mapNumber != 0x40 &&
|
||||
!actor_.busy && (scanCode != 0x52 || eventFlags == 0)) {
|
||||
pendingCommand_ = ControllerCommandRequest{ControllerCommand::FireWeapon};
|
||||
return;
|
||||
}
|
||||
if (scanCode == 0x4a) {
|
||||
pendingCommand_ = ControllerCommandRequest{ControllerCommand::SelectNextItem};
|
||||
return;
|
||||
}
|
||||
if (scanCode == 0x37 && eventFlags == 0) {
|
||||
pendingCommand_ = ControllerCommandRequest{ControllerCommand::CycleWeaponForward};
|
||||
return;
|
||||
}
|
||||
if (scanCode == 0x4e || (scanCode == 0x53 && eventFlags == 0)) {
|
||||
pendingCommand_ = ControllerCommandRequest{ControllerCommand::OpenInventory};
|
||||
return;
|
||||
}
|
||||
}
|
||||
const auto held = std::find(heldScans_.begin(), heldScans_.end(), scanCode);
|
||||
if (held != heldScans_.end()) {
|
||||
heldScans_.erase(held);
|
||||
}
|
||||
if (pressed && (modifiers & 0x20) == 0) {
|
||||
constexpr u16 actionModifierMask = 0x0f00;
|
||||
if ((modifiers & actionModifierMask) != 0) {
|
||||
if (keyState != 0) {
|
||||
queueModifiedAction(scanCode, modifiers, keyAction);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const bool numLockOn = (modifiers & 0x20) != 0;
|
||||
if (keyState != 0 && !numLockOn && actor_.mapNumber != 0x40 && !actor_.busy &&
|
||||
actor_.avatarSomethingCombatty && (scanCode == 0x4b || scanCode == 0x4d)) {
|
||||
const int turn = scanCode == 0x4b ? -1 : 1;
|
||||
lastDirection_ = static_cast<u8>((actor_.direction + turn + 16) & 0x0f);
|
||||
pendingAction_ = ControllerMovementRequest{
|
||||
static_cast<u8>(actor_.kneeling ? 0x2e : 4), lastDirection_, true};
|
||||
return;
|
||||
}
|
||||
if (numLockOn && (scanCode == 0x4b || scanCode == 0x4d)) {
|
||||
if (keyState != 0) {
|
||||
if (actor_.busy) {
|
||||
if (controllerAllowsInPlaceDirectionUpdate(actor_.lastAnimation)) {
|
||||
pendingInPlaceDirection_ = static_cast<u8>(scanCode == 0x4b ? 0x12 : 0x11);
|
||||
}
|
||||
} else {
|
||||
const int turn = scanCode == 0x4b ? -turnStep_ : turnStep_;
|
||||
lastDirection_ = static_cast<u8>((facingDirection_ + turn + 16) & 0x0f);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (numLockOn && scanCode != 0x48 && scanCode != 0x50) {
|
||||
return;
|
||||
}
|
||||
const auto direction = controllerDirectionFromScan(scanCode);
|
||||
if (!direction) {
|
||||
if (keyState != 0) {
|
||||
queueModifiedAction(scanCode, modifiers, keyAction);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (keyState != 0) {
|
||||
heldScans_.push_back(scanCode);
|
||||
}
|
||||
if (keyState != 0) {
|
||||
queueModifiedAction(scanCode, modifiers, keyAction);
|
||||
}
|
||||
}
|
||||
|
||||
ControllerMovementRequest request() const
|
||||
{
|
||||
if (!actor_.controllerEnabled || actor_.npcNumber == 0 || actor_.dead ||
|
||||
(actor_.npcNumber == 1 && actor_.avatarInStasis)) {
|
||||
return {0, actor_.direction};
|
||||
}
|
||||
if (pendingInPlaceDirection_) {
|
||||
return {actor_.lastAnimation, *pendingInPlaceDirection_, false, true};
|
||||
}
|
||||
if (heldScans_.empty()) {
|
||||
return {0, lastDirection_};
|
||||
}
|
||||
lastDirection_ = *controllerDirectionFromScan(heldScans_.back());
|
||||
return {static_cast<u8>(controllerWalkRequested(modifiers_) ? 1 : 3), lastDirection_};
|
||||
const u8 runAnimation = actor_.activeWeapon ? 0x30 : 3;
|
||||
const u8 scanCode = heldScans_.back();
|
||||
const bool numLockOn = (modifiers_ & 0x20) != 0;
|
||||
const u8 requestedDirection = numLockOn && (scanCode == 0x48 || scanCode == 0x50)
|
||||
? facingDirection_ : *controllerDirectionFromScan(scanCode);
|
||||
lastDirection_ = requestedDirection;
|
||||
const bool walkRequested = controllerWalkRequested(modifiers_);
|
||||
if (actor_.mapNumber == 0x40) {
|
||||
if (controllerLastAnimationIsRunning(actor_.lastAnimation)) {
|
||||
return {static_cast<u8>(walkRequested ? 1 : runAnimation), requestedDirection};
|
||||
}
|
||||
if (requestedDirection == actor_.direction) {
|
||||
return {static_cast<u8>(walkRequested ? 1 : 0x26), requestedDirection};
|
||||
}
|
||||
return {0, requestedDirection};
|
||||
}
|
||||
if (!walkRequested && requestedDirection == actor_.direction &&
|
||||
!controllerLastAnimationIsRunning(actor_.lastAnimation)) {
|
||||
return {0x22, requestedDirection};
|
||||
}
|
||||
if ((modifiers_ & 0x20) != 0) {
|
||||
if (scanCode == 0x48) {
|
||||
return {static_cast<u8>(walkRequested ? 1 : runAnimation), requestedDirection};
|
||||
}
|
||||
if (scanCode == 0x50) {
|
||||
return {2, requestedDirection};
|
||||
}
|
||||
}
|
||||
return {static_cast<u8>(walkRequested ? 1 : runAnimation), requestedDirection};
|
||||
}
|
||||
|
||||
void clear() { heldScans_.clear(); }
|
||||
std::optional<u8> takeInPlaceDirectionUpdate()
|
||||
{
|
||||
auto direction = pendingInPlaceDirection_;
|
||||
pendingInPlaceDirection_.reset();
|
||||
return direction;
|
||||
}
|
||||
|
||||
void setFacingDirection(u8 direction)
|
||||
{
|
||||
if (direction <= 15) {
|
||||
facingDirection_ = direction;
|
||||
}
|
||||
}
|
||||
|
||||
void setTurnStep(u8 step)
|
||||
{
|
||||
turnStep_ = step == 1 ? 1 : 2;
|
||||
}
|
||||
|
||||
std::optional<ControllerMovementRequest> takeActionRequest()
|
||||
{
|
||||
auto action = pendingAction_;
|
||||
pendingAction_.reset();
|
||||
return action;
|
||||
}
|
||||
|
||||
std::optional<ControllerCommandRequest> takeCommandRequest()
|
||||
{
|
||||
auto command = pendingCommand_;
|
||||
pendingCommand_.reset();
|
||||
return command;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
heldScans_.clear();
|
||||
pendingAction_.reset();
|
||||
pendingCommand_.reset();
|
||||
pendingInPlaceDirection_.reset();
|
||||
modifiers_ = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
void queueModifiedAction(u8 scanCode, u16 modifiers, u16 keyAction)
|
||||
{
|
||||
constexpr u16 altMask = 0x0a00;
|
||||
constexpr u16 ctrlMask = 0x0500;
|
||||
constexpr u8 animationNone = 0x40;
|
||||
u8 animation = animationNone;
|
||||
u8 actionDirection = lastDirection_;
|
||||
if (scanCode == 0x4c) {
|
||||
if (keyAction == 1) {
|
||||
animation = crouched_ ? 0x29 : 0x28;
|
||||
}
|
||||
} else if ((modifiers & (altMask | ctrlMask)) == 0 && scanCode == 0x35) {
|
||||
if (actor_.mapNumber != 0x40 && !controllerLastAnimationIsRunning(actor_.lastAnimation)) {
|
||||
animation = 0x24;
|
||||
}
|
||||
} else if ((modifiers & altMask) != 0) {
|
||||
const bool numLockOn = (modifiers & 0x20) != 0;
|
||||
const auto scanDirection = controllerDirectionFromScan(scanCode);
|
||||
if (numLockOn && scanDirection) {
|
||||
int newDirection = *scanDirection;
|
||||
if (scanCode == 0x4b) {
|
||||
newDirection = 0x12;
|
||||
} else if (scanCode == 0x4d) {
|
||||
newDirection = 0x11;
|
||||
}
|
||||
const int direction = actor_.direction;
|
||||
const int directionDelta = newDirection < direction
|
||||
? direction - newDirection : direction + 0x10 - newDirection;
|
||||
if (0x10 - directionDelta < directionDelta) {
|
||||
animation = 0x1d;
|
||||
actionDirection = static_cast<u8>((newDirection - 4) & 0x0f);
|
||||
} else {
|
||||
animation = 0x1c;
|
||||
actionDirection = static_cast<u8>((newDirection + 4) & 0x0f);
|
||||
}
|
||||
} else {
|
||||
switch (scanCode) {
|
||||
case 0x48: animation = 0x24; break;
|
||||
case 0x4b: animation = 0x1c; break;
|
||||
case 0x4d: animation = 0x1d; break;
|
||||
case 0x50: animation = 2; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
} else if ((modifiers & ctrlMask) != 0) {
|
||||
const auto requestedDirection = controllerDirectionFromScan(scanCode);
|
||||
if ((modifiers & 0x20) == 0 && requestedDirection &&
|
||||
(scanCode == 0x47 || scanCode == 0x49 || scanCode == 0x4f || scanCode == 0x51)) {
|
||||
const int direction = actor_.direction;
|
||||
const int directionDelta = *requestedDirection < direction
|
||||
? direction - *requestedDirection : direction + 0x10 - *requestedDirection;
|
||||
if (0x10 - directionDelta < directionDelta) {
|
||||
animation = 0x18;
|
||||
actionDirection = static_cast<u8>((*requestedDirection - 4) & 0x0f);
|
||||
} else {
|
||||
animation = 0x17;
|
||||
actionDirection = static_cast<u8>((*requestedDirection + 4) & 0x0f);
|
||||
}
|
||||
} else switch (scanCode) {
|
||||
case 0x48:
|
||||
if (crouched_) {
|
||||
animation = 0x29;
|
||||
} else if (!actor_.lastAnimationNotCombat) {
|
||||
animation = 0x0b;
|
||||
} else if (actor_.npcNumber == 1) {
|
||||
animation = 0x3a;
|
||||
}
|
||||
break;
|
||||
case 0x4b: animation = crouched_ ? 0x17 : 0x3d; break;
|
||||
case 0x4d: animation = crouched_ ? 0x18 : 0x3e; break;
|
||||
case 0x50:
|
||||
if (keyAction == 1) {
|
||||
animation = crouched_ ? 0x29 : 0x28;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (animation != animationNone) {
|
||||
pendingAction_ = ControllerMovementRequest{animation, actionDirection, true};
|
||||
if (animation == 0x28 || animation == 0x29) {
|
||||
crouched_ = !crouched_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<u8> heldScans_;
|
||||
std::optional<ControllerMovementRequest> pendingAction_;
|
||||
std::optional<ControllerCommandRequest> pendingCommand_;
|
||||
std::optional<u8> pendingInPlaceDirection_;
|
||||
u16 modifiers_ = 0;
|
||||
mutable u8 lastDirection_ = 14;
|
||||
u8 facingDirection_ = 14;
|
||||
u8 turnStep_ = 2;
|
||||
bool crouched_ = false;
|
||||
ControllerActorState actor_{};
|
||||
};
|
||||
|
||||
inline std::optional<AnimationDisplacement> hostMovementStep(
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ struct ShapeArchive {
|
|||
|
||||
std::optional<ShapeArchive> loadShapeArchive(const std::filesystem::path& path);
|
||||
std::optional<std::vector<ShapeFrame>> loadShapeFrames(const ShapeArchive& archive, u32 shapeIndex);
|
||||
std::optional<DecodedShapeFrame> decodeShapeFrame(const ShapeFrame& frame);
|
||||
std::optional<DecodedShapeFrame> decodeShapeFrame(const ShapeArchive& archive, u32 shapeIndex, u32 frameIndex);
|
||||
|
||||
} // namespace remorse
|
||||
|
|
|
|||
|
|
@ -367,6 +367,37 @@ bool ProcessKernel::startAnimPrimitiveProcess(u16 processId, LiveFixedMapItems&
|
|||
return true;
|
||||
}
|
||||
|
||||
std::optional<u8> ProcessKernel::updateAnimPrimitiveDirection(u16 processId,
|
||||
LiveFixedMapItems& items, u8 direction)
|
||||
{
|
||||
auto* process = processAt(processId);
|
||||
if (direction > 0x12 || process == nullptr ||
|
||||
allocationSizeAt(processId) != sizeof(AnimPrimitiveProcessEntry) ||
|
||||
(readLe16(*process, 0x16) & 0x08) != 0 || process->bytes[0x3a] == 0 ||
|
||||
std::none_of(ownedAnimPrimitiveProcesses_.begin(), ownedAnimPrimitiveProcesses_.end(),
|
||||
[process](const auto& owned) { return &owned->base == process; })) {
|
||||
return std::nullopt;
|
||||
}
|
||||
auto* npc = items.editNpcAnimation(readLe16(*process, 0x04));
|
||||
if (npc == nullptr) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const bool relative = direction >= 0x10;
|
||||
const bool turnClockwise = direction == 0x11;
|
||||
const bool turnCounterclockwise = direction == 0x12;
|
||||
direction = relative ? npc->direction : direction;
|
||||
if ((process->bytes[0x4d] & 0x40) == 0) {
|
||||
direction = static_cast<u8>(direction & 0x0e);
|
||||
}
|
||||
if (turnClockwise || turnCounterclockwise) {
|
||||
const u8 step = (process->bytes[0x4d] & 0x40) == 0 ? 2 : 1;
|
||||
direction = static_cast<u8>((direction + (turnClockwise ? step : 16 - step)) & 0x0f);
|
||||
}
|
||||
process->bytes[0x38] = direction;
|
||||
npc->direction = direction;
|
||||
return direction;
|
||||
}
|
||||
|
||||
std::optional<bool> ProcessKernel::advanceGroundedAnimPrimitive(u16 processId,
|
||||
LiveFixedMapItems& items, const AnimationClip& clip,
|
||||
const std::vector<ShapeTypeInfo>& shapes, const FastAreaRange& fastArea)
|
||||
|
|
@ -400,9 +431,13 @@ std::optional<bool> ProcessKernel::advanceGroundedAnimPrimitive(u16 processId,
|
|||
}
|
||||
const u8 direction = process->bytes[0x38];
|
||||
const auto metadata = getAnimationFrame(clip, direction, nextFrame);
|
||||
if (!metadata || (metadata->bytes[5] & 2) == 0) {
|
||||
if (!metadata) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if ((metadata->bytes[5] & 2) == 0) {
|
||||
npc->frame = nextFrame;
|
||||
return true;
|
||||
}
|
||||
const auto step = decodeAnimationDisplacement(*metadata, direction, (clip.header[2] & 0x10) != 0);
|
||||
if (!step) {
|
||||
return std::nullopt;
|
||||
|
|
|
|||
|
|
@ -501,6 +501,7 @@ bool LiveFixedMapItems::initializeAvatar()
|
|||
avatar_->data.shape = 1;
|
||||
avatar_->data.npcNumber = 1;
|
||||
npcAnimations_.resize(2);
|
||||
npcAnimations_[1].direction = 14;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace remorse {
|
||||
namespace {
|
||||
|
|
@ -71,16 +72,6 @@ RgbColor scalePaletteColor(const RgbColor& color)
|
|||
return scaled;
|
||||
}
|
||||
|
||||
std::optional<GlobObject> findGlobObject(const std::vector<GlobObject>& globs, u32 index)
|
||||
{
|
||||
for (const GlobObject& object : globs) {
|
||||
if (object.index == index) {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::vector<SceneItem> collectSceneItems(
|
||||
const FixedMap& fixedMap,
|
||||
const std::vector<ShapeTypeInfo>& typeFlags,
|
||||
|
|
@ -88,6 +79,12 @@ std::vector<SceneItem> collectSceneItems(
|
|||
const MapRenderOptions& options,
|
||||
const LiveFixedMapItems* liveItems)
|
||||
{
|
||||
std::unordered_map<u32, const GlobObject*> globsByIndex;
|
||||
globsByIndex.reserve(globs.size());
|
||||
for (const GlobObject& glob : globs) {
|
||||
globsByIndex.try_emplace(glob.index, &glob);
|
||||
}
|
||||
|
||||
std::vector<SceneItem> pending;
|
||||
pending.reserve(fixedMap.entries.size());
|
||||
std::vector<const StagedFixedMapItem*> liveByRecord;
|
||||
|
|
@ -145,9 +142,9 @@ std::vector<SceneItem> collectSceneItems(
|
|||
const auto* stagedEgg = liveByRecord.empty() || index >= liveByRecord.size()
|
||||
? nullptr : liveByRecord[index];
|
||||
const auto glob = stagedEgg && liveItems->isGlobHatched(stagedEgg->itemNumber)
|
||||
? std::nullopt : findGlobObject(globs, item.quality);
|
||||
if (glob) {
|
||||
for (const GlobObjectEntry& entry : glob->entries) {
|
||||
? globsByIndex.end() : globsByIndex.find(item.quality);
|
||||
if (glob != globsByIndex.end()) {
|
||||
for (const GlobObjectEntry& entry : glob->second->entries) {
|
||||
pending.push_back(SceneItem{
|
||||
(item.x & globCoordMask) + (static_cast<s32>(entry.x) << globCoordShift) + globCoordOffset,
|
||||
(item.y & globCoordMask) + (static_cast<s32>(entry.y) << globCoordShift) + globCoordOffset,
|
||||
|
|
@ -184,6 +181,7 @@ s32 screenY(const SceneItem& item)
|
|||
|
||||
const DecodedShapeFrame* cachedDecode(
|
||||
const ShapeArchive& archive,
|
||||
std::map<u32, std::vector<ShapeFrame>>& parsedFrames,
|
||||
std::map<std::pair<u32, u32>, DecodedShapeFrame>& cache,
|
||||
u32 shape,
|
||||
u32 frame)
|
||||
|
|
@ -193,7 +191,18 @@ const DecodedShapeFrame* cachedDecode(
|
|||
if (found != cache.end()) {
|
||||
return &found->second;
|
||||
}
|
||||
const auto decoded = decodeShapeFrame(archive, shape, frame);
|
||||
auto parsed = parsedFrames.find(shape);
|
||||
if (parsed == parsedFrames.end()) {
|
||||
auto frames = loadShapeFrames(archive, shape);
|
||||
if (!frames) {
|
||||
return nullptr;
|
||||
}
|
||||
parsed = parsedFrames.emplace(shape, std::move(*frames)).first;
|
||||
}
|
||||
if (frame >= parsed->second.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto decoded = decodeShapeFrame(parsed->second[frame]);
|
||||
if (!decoded) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -203,6 +212,7 @@ const DecodedShapeFrame* cachedDecode(
|
|||
std::vector<RenderNode> prepareRenderNodes(
|
||||
const std::vector<SceneItem>& items,
|
||||
const ShapeArchive& shapeArchive,
|
||||
std::map<u32, std::vector<ShapeFrame>>& parsedFrames,
|
||||
const std::vector<ShapeTypeInfo>& typeFlags,
|
||||
std::map<std::pair<u32, u32>, DecodedShapeFrame>& cache)
|
||||
{
|
||||
|
|
@ -212,7 +222,8 @@ std::vector<RenderNode> prepareRenderNodes(
|
|||
sortItems.reserve(items.size());
|
||||
for (const SceneItem& item : items) {
|
||||
const auto* decoded = item.decodedOverride != nullptr
|
||||
? item.decodedOverride : cachedDecode(shapeArchive, cache, item.shape, item.frame);
|
||||
? item.decodedOverride : cachedDecode(
|
||||
shapeArchive, parsedFrames, cache, item.shape, item.frame);
|
||||
if (!decoded) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -371,7 +382,8 @@ std::optional<RenderedMapImage> MapSceneRenderer::render(const MapRenderOptions&
|
|||
items.push_back(sceneSprite);
|
||||
}
|
||||
}
|
||||
auto nodes = prepareRenderNodes(items, shapes, typeFlags, decodedFrames);
|
||||
std::map<u32, std::vector<ShapeFrame>> parsedFrames;
|
||||
auto nodes = prepareRenderNodes(items, shapes, parsedFrames, typeFlags, decodedFrames);
|
||||
if (nodes.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,21 +185,27 @@ std::optional<std::vector<ShapeFrame>> loadShapeFrames(const ShapeArchive& archi
|
|||
return frames;
|
||||
}
|
||||
|
||||
std::optional<DecodedShapeFrame> decodeShapeFrame(const ShapeArchive& archive, u32 shapeIndex, u32 frameIndex)
|
||||
std::optional<DecodedShapeFrame> decodeShapeFrame(const ShapeFrame& frame)
|
||||
{
|
||||
const auto frames = loadShapeFrames(archive, shapeIndex);
|
||||
if (!frames || frameIndex >= frames->size()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto pixels = decodePixels((*frames)[frameIndex]);
|
||||
const auto pixels = decodePixels(frame);
|
||||
if (!pixels) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
DecodedShapeFrame decoded;
|
||||
decoded.frame = (*frames)[frameIndex];
|
||||
decoded.frame = frame;
|
||||
decoded.pixels = *pixels;
|
||||
return decoded;
|
||||
}
|
||||
|
||||
std::optional<DecodedShapeFrame> decodeShapeFrame(
|
||||
const ShapeArchive& archive, u32 shapeIndex, u32 frameIndex)
|
||||
{
|
||||
const auto frames = loadShapeFrames(archive, shapeIndex);
|
||||
if (!frames || frameIndex >= frames->size()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return decodeShapeFrame((*frames)[frameIndex]);
|
||||
}
|
||||
|
||||
} // namespace remorse
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ struct AppState {
|
|||
remorse::StandProcessEntry* diagnosticStand = nullptr;
|
||||
remorse::KeyboardProcessEntry* diagnosticKeyboard = nullptr;
|
||||
remorse::ControllerMovementState controllerMovement;
|
||||
std::optional<remorse::ControllerCommandRequest> lastControllerCommand;
|
||||
std::optional<remorse::ControllerMovementRequest> activeOneShotMovement;
|
||||
remorse::u16 animationProcessId = 0;
|
||||
std::optional<remorse::LiveFixedMapItems> liveItems;
|
||||
std::optional<remorse::StagedFixedMapItem> diagnosticItem;
|
||||
|
|
@ -82,14 +84,12 @@ struct AppState {
|
|||
std::condition_variable renderWake;
|
||||
bool renderRequested = false;
|
||||
bool renderFullRequested = false;
|
||||
std::uint64_t renderGeneration = 0;
|
||||
bool renderFullInFlight = false;
|
||||
bool renderStop = false;
|
||||
std::optional<remorse::RenderedMapImage> scene;
|
||||
std::optional<remorse::RenderedMapImage> playerPatch;
|
||||
std::optional<remorse::MapSceneRenderer> renderer;
|
||||
std::optional<remorse::AnimationClip> standAnimation;
|
||||
std::optional<remorse::AnimationClip> walkAnimation;
|
||||
std::optional<remorse::AnimationClip> runAnimation;
|
||||
std::array<std::optional<remorse::AnimationClip>, 0x40> playerAnimations;
|
||||
std::vector<std::optional<remorse::DecodedShapeFrame>> playerFrames;
|
||||
remorse::CollisionBody playerCollisionBody{};
|
||||
std::vector<remorse::CollisionBody> collisionBodies;
|
||||
|
|
@ -111,7 +111,10 @@ struct AppState {
|
|||
remorse::u8 playerAnimation = 0;
|
||||
remorse::u8 playerDirection = 14;
|
||||
remorse::u8 playerFrame = 0;
|
||||
bool playerKneeling = false;
|
||||
bool playerHasActiveWeapon = false;
|
||||
std::wstring loadError;
|
||||
bool loadErrorShown = false;
|
||||
bool sceneLoaded = false;
|
||||
std::thread sceneThread;
|
||||
std::thread renderThread;
|
||||
|
|
@ -153,6 +156,29 @@ void setLoadFailure(AppState& state, const std::wstring& message)
|
|||
state.sceneLoaded = true;
|
||||
}
|
||||
|
||||
void reportLoadFailure(HWND window, AppState& state, const std::wstring& message)
|
||||
{
|
||||
setLoadFailure(state, message);
|
||||
if (!PostMessageW(window, sceneReadyMessage, 0, 0)) {
|
||||
InvalidateRect(window, nullptr, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void displayLoadFailure(HWND window, AppState& state)
|
||||
{
|
||||
std::wstring message;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(state.sceneMutex);
|
||||
if (state.loadError.empty() || state.loadErrorShown) {
|
||||
return;
|
||||
}
|
||||
state.loadErrorShown = true;
|
||||
message = state.loadError;
|
||||
}
|
||||
InvalidateRect(window, nullptr, FALSE);
|
||||
MessageBoxW(window, message.c_str(), L"Crusader map loading failed", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
remorse::WorldPoint avatarWorld(const AppState& state)
|
||||
{
|
||||
const auto* avatar = state.liveItems ? state.liveItems->findItem(1) : nullptr;
|
||||
|
|
@ -176,19 +202,25 @@ remorse::MapRenderOptions playerPatchOptions(remorse::u32 mapIndex,
|
|||
return options;
|
||||
}
|
||||
|
||||
remorse::MapRenderOptions fullSceneOptions(remorse::u32 mapIndex,
|
||||
const remorse::WorldPoint& center)
|
||||
{
|
||||
remorse::MapRenderOptions options;
|
||||
options.mapIndex = mapIndex;
|
||||
options.maxWidth = backingWidth;
|
||||
options.maxHeight = backingHeight;
|
||||
options.includeRoofs = true;
|
||||
options.viewCenter = center;
|
||||
return options;
|
||||
}
|
||||
|
||||
std::optional<remorse::MapRenderSprite> playerRenderSprite(const AppState& state)
|
||||
{
|
||||
const remorse::AnimationClip* clip = nullptr;
|
||||
if (state.playerAnimation == 1 && state.walkAnimation) {
|
||||
clip = &*state.walkAnimation;
|
||||
} else if (state.playerAnimation == 3 && state.runAnimation) {
|
||||
clip = &*state.runAnimation;
|
||||
} else if (state.standAnimation) {
|
||||
clip = &*state.standAnimation;
|
||||
}
|
||||
if (!clip) {
|
||||
if (state.playerAnimation >= state.playerAnimations.size() ||
|
||||
!state.playerAnimations[state.playerAnimation]) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const remorse::AnimationClip* clip = &*state.playerAnimations[state.playerAnimation];
|
||||
|
||||
const remorse::u8 frameIndex = state.playerAnimation == 0 ? 0 : state.playerFrame;
|
||||
const auto metadata = remorse::getAnimationFrame(*clip, state.playerDirection, frameIndex);
|
||||
|
|
@ -438,7 +470,8 @@ void runUsecodeTasks(AppState& state)
|
|||
|
||||
void loadSceneAsync(HWND window, AppState& state)
|
||||
{
|
||||
state.sceneThread = std::thread([window, &state]() {
|
||||
try {
|
||||
state.sceneThread = std::thread([window, &state]() {
|
||||
try {
|
||||
const auto fixedPath = remorse::resolveGameDataPath(
|
||||
state.root, std::filesystem::path("STATIC") / "FIXED.DAT");
|
||||
|
|
@ -458,7 +491,7 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
}
|
||||
|
||||
const auto archive = remorse::loadFixedMapArchive(*fixedPath);
|
||||
const auto map = archive ? remorse::loadFixedMap(*archive, state.mapIndex) : std::nullopt;
|
||||
auto map = archive ? remorse::loadFixedMap(*archive, state.mapIndex) : std::nullopt;
|
||||
if (!map || map->entries.empty()) {
|
||||
setLoadFailure(state, L"The selected map could not be loaded or contains no records.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
|
|
@ -470,9 +503,8 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto shapeTypes = remorse::loadTypeFlags(*typeFlagsPath);
|
||||
const auto globObjects = remorse::loadGlobObjects(*globPath);
|
||||
auto globObjects = remorse::loadGlobObjects(*globPath);
|
||||
if (!shapeTypes || !globObjects || shapeTypes->size() <= 1) {
|
||||
setLoadFailure(state, L"Collision shape metadata could not be loaded.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
|
|
@ -508,22 +540,23 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
}
|
||||
|
||||
const auto animationArchive = remorse::loadAnimationArchive(*animationPath);
|
||||
const auto shapeArchive = remorse::loadShapeArchive(*shapesPath);
|
||||
auto shapeArchive = remorse::loadShapeArchive(*shapesPath);
|
||||
const auto palette = remorse::loadPalette256(*palettePath);
|
||||
const auto standAnimation = animationArchive
|
||||
? remorse::loadAnimationClip(*animationArchive, 1, 0) : std::nullopt;
|
||||
const auto walkAnimation = animationArchive
|
||||
? remorse::loadAnimationClip(*animationArchive, 1, 1) : std::nullopt;
|
||||
const auto runAnimation = animationArchive
|
||||
? remorse::loadAnimationClip(*animationArchive, 1, 3) : std::nullopt;
|
||||
std::array<std::optional<remorse::AnimationClip>, 0x40> playerAnimations;
|
||||
if (animationArchive) {
|
||||
for (const remorse::u8 index : remorse::controllerAnimationIndices) {
|
||||
playerAnimations[index] = remorse::loadAnimationClip(
|
||||
*animationArchive, 1, index);
|
||||
}
|
||||
}
|
||||
const auto shapeFrames = shapeArchive
|
||||
? remorse::loadShapeFrames(*shapeArchive, 1) : std::nullopt;
|
||||
if (!shapeArchive || !palette || !standAnimation || !walkAnimation || !runAnimation || !shapeFrames) {
|
||||
if (!shapeArchive || !palette || !playerAnimations[0] || !playerAnimations[1] ||
|
||||
!playerAnimations[3] || !shapeFrames) {
|
||||
setLoadFailure(state, L"The player stand, walk, or run animation could not be loaded.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::optional<remorse::DecodedShapeFrame>> playerFrames(shapeFrames->size());
|
||||
const auto cacheAnimationFrames = [&](const remorse::AnimationClip& clip) {
|
||||
for (remorse::u8 direction = 0; direction < 16; ++direction) {
|
||||
|
|
@ -538,7 +571,7 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
return false;
|
||||
}
|
||||
if (!playerFrames[shapeFrame]) {
|
||||
auto decoded = remorse::decodeShapeFrame(*shapeArchive, 1, shapeFrame);
|
||||
auto decoded = remorse::decodeShapeFrame((*shapeFrames)[shapeFrame]);
|
||||
if (!decoded) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -548,13 +581,13 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
}
|
||||
return true;
|
||||
};
|
||||
if (!cacheAnimationFrames(*standAnimation) || !cacheAnimationFrames(*walkAnimation) ||
|
||||
!cacheAnimationFrames(*runAnimation)) {
|
||||
setLoadFailure(state, L"A player animation references a missing shape frame.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
return;
|
||||
for (const auto& clip : playerAnimations) {
|
||||
if (clip && !cacheAnimationFrames(*clip)) {
|
||||
setLoadFailure(state, L"A player animation references a missing shape frame.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
remorse::s32 minX = map->entries.front().x;
|
||||
remorse::s32 minY = map->entries.front().y;
|
||||
remorse::s32 maxX = minX;
|
||||
|
|
@ -586,12 +619,7 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
? remorse::WorldPoint{startingEgg->data.x * 2, startingEgg->data.y * 2,
|
||||
startingEgg->data.z}
|
||||
: remorse::WorldPoint{(minX + maxX) / 2, (minY + maxY) / 2, 0};
|
||||
remorse::MapRenderOptions options;
|
||||
options.mapIndex = state.mapIndex;
|
||||
options.maxWidth = backingWidth;
|
||||
options.maxHeight = backingHeight;
|
||||
options.includeRoofs = true;
|
||||
options.viewCenter = spawn;
|
||||
remorse::MapRenderOptions options = fullSceneOptions(state.mapIndex, spawn);
|
||||
remorse::LiveFixedMapItems liveItems(std::move(*stagedItems), std::move(containedItems));
|
||||
liveItems.initializeAvatar();
|
||||
if (startingEgg) {
|
||||
|
|
@ -625,11 +653,11 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
directStart.data.z = static_cast<remorse::u8>(spawn.z);
|
||||
liveItems.teleportAvatar(directStart, static_cast<remorse::u8>(state.mapIndex));
|
||||
}
|
||||
auto renderer = remorse::loadMapSceneRenderer(state.root, state.mapIndex);
|
||||
if (renderer) {
|
||||
hatchGlobsInFastArea(liveItems, *renderer, remorse::calculateFastAreaRange(spawn));
|
||||
}
|
||||
const auto initialMetadata = remorse::getAnimationFrame(*standAnimation, 14, 0);
|
||||
remorse::MapSceneRenderer renderer{
|
||||
std::move(*map), std::move(*globObjects), std::move(*shapeArchive),
|
||||
*palette, *shapeTypes, {}};
|
||||
hatchGlobsInFastArea(liveItems, renderer, remorse::calculateFastAreaRange(spawn));
|
||||
const auto initialMetadata = remorse::getAnimationFrame(*playerAnimations[0], 14, 0);
|
||||
if (!initialMetadata) {
|
||||
setLoadFailure(state, L"The player stand frame could not be resolved.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
|
|
@ -645,27 +673,25 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
static_cast<remorse::u8>(initialShapeFrame),
|
||||
remorse::isAnimationFrameFlipped(*initialMetadata), &*playerFrames[initialShapeFrame],
|
||||
&*palette};
|
||||
auto scene = renderer ? renderer->render(options, &liveItems) : std::nullopt;
|
||||
auto scene = renderer.render(options, &liveItems);
|
||||
if (!scene) {
|
||||
setLoadFailure(state, L"Map graphics or palette data could not be loaded.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
return;
|
||||
}
|
||||
auto playerPatch = renderer ? renderer->render(
|
||||
playerPatchOptions(state.mapIndex, spawn), &liveItems, &initialPlayer) : std::nullopt;
|
||||
auto playerPatch = renderer.render(
|
||||
playerPatchOptions(state.mapIndex, spawn), &liveItems, &initialPlayer);
|
||||
if (!playerPatch) {
|
||||
setLoadFailure(state, L"The initial player render patch could not be built.");
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::uint8_t> dibPixels(scene->pixels.size() * 3);
|
||||
for (std::size_t index = 0; index < scene->pixels.size(); ++index) {
|
||||
dibPixels[index * 3] = scene->pixels[index].blue;
|
||||
dibPixels[index * 3 + 1] = scene->pixels[index].green;
|
||||
dibPixels[index * 3 + 2] = scene->pixels[index].red;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(state.sceneMutex);
|
||||
state.spawn = spawn;
|
||||
|
|
@ -685,9 +711,9 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
state.playerPatch = std::move(playerPatch);
|
||||
state.renderer = std::move(renderer);
|
||||
state.dibPixels = std::move(dibPixels);
|
||||
state.standAnimation = *standAnimation;
|
||||
state.walkAnimation = *walkAnimation;
|
||||
state.runAnimation = *runAnimation;
|
||||
state.playerAnimations = std::move(playerAnimations);
|
||||
state.controllerMovement.setTurnStep(
|
||||
state.playerAnimations[1]->directionCount == 8 ? 2 : 1);
|
||||
state.playerFrames = std::move(playerFrames);
|
||||
state.playerPalette = *palette;
|
||||
state.liveItems.emplace(std::move(liveItems));
|
||||
|
|
@ -699,7 +725,12 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
setLoadFailure(state, L"An unexpected error occurred while building the map scene.");
|
||||
}
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
});
|
||||
});
|
||||
} catch (const std::exception& error) {
|
||||
reportLoadFailure(window, state, widen(error.what()));
|
||||
} catch (...) {
|
||||
reportLoadFailure(window, state, L"Could not start the map-loading worker thread.");
|
||||
}
|
||||
}
|
||||
|
||||
bool hatchGlobsInFastArea(remorse::LiveFixedMapItems& items,
|
||||
|
|
@ -728,13 +759,14 @@ bool hatchGlobsInFastArea(remorse::LiveFixedMapItems& items,
|
|||
|
||||
void startLiveRenderer(HWND window, AppState& state)
|
||||
{
|
||||
state.renderThread = std::thread([window, &state]() {
|
||||
try {
|
||||
state.renderThread = std::thread([window, &state]() {
|
||||
try {
|
||||
for (;;) {
|
||||
std::optional<remorse::LiveFixedMapItems> snapshot;
|
||||
std::optional<remorse::MapRenderSprite> playerSprite;
|
||||
remorse::WorldPoint center{};
|
||||
bool fullRender = false;
|
||||
std::uint64_t generation = 0;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(state.sceneMutex);
|
||||
state.renderWake.wait(lock, [&state]() { return state.renderStop || state.renderRequested; });
|
||||
|
|
@ -744,27 +776,34 @@ void startLiveRenderer(HWND window, AppState& state)
|
|||
state.renderRequested = false;
|
||||
fullRender = state.renderFullRequested;
|
||||
state.renderFullRequested = false;
|
||||
generation = state.renderGeneration;
|
||||
state.renderFullInFlight = fullRender;
|
||||
snapshot.emplace(*state.liveItems);
|
||||
center = avatarWorld(state);
|
||||
playerSprite = playerRenderSprite(state);
|
||||
}
|
||||
auto playerPatch = state.renderer->render(playerPatchOptions(state.mapIndex, center),
|
||||
&*snapshot, playerSprite ? &*playerSprite : nullptr);
|
||||
if (!playerPatch) {
|
||||
reportLoadFailure(window, state, L"The live player-patch renderer returned no image.");
|
||||
return;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(state.sceneMutex);
|
||||
if (state.renderStop) {
|
||||
return;
|
||||
}
|
||||
state.playerPatch = std::move(playerPatch);
|
||||
}
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
|
||||
std::optional<remorse::RenderedMapImage> scene;
|
||||
std::vector<std::uint8_t> pixels;
|
||||
if (fullRender) {
|
||||
remorse::MapRenderOptions options;
|
||||
options.mapIndex = state.mapIndex;
|
||||
options.maxWidth = backingWidth;
|
||||
options.maxHeight = backingHeight;
|
||||
options.includeRoofs = true;
|
||||
options.viewCenter = center;
|
||||
const remorse::s32 radius = static_cast<remorse::s32>(
|
||||
backingWidth + backingHeight * 2 + 512);
|
||||
options.worldRect = remorse::WorldRect{
|
||||
center.x - radius, center.y - radius, center.x + radius, center.y + radius};
|
||||
remorse::MapRenderOptions options = fullSceneOptions(state.mapIndex, center);
|
||||
scene = state.renderer->render(options, &*snapshot);
|
||||
if (!scene) {
|
||||
continue;
|
||||
reportLoadFailure(window, state, L"The live full-map renderer returned no image.");
|
||||
return;
|
||||
}
|
||||
pixels.resize(scene->pixels.size() * 3);
|
||||
for (std::size_t index = 0; index < scene->pixels.size(); ++index) {
|
||||
|
|
@ -772,37 +811,36 @@ void startLiveRenderer(HWND window, AppState& state)
|
|||
pixels[index * 3 + 1] = scene->pixels[index].green;
|
||||
pixels[index * 3 + 2] = scene->pixels[index].red;
|
||||
}
|
||||
}
|
||||
auto playerPatch = state.renderer->render(playerPatchOptions(state.mapIndex, center),
|
||||
&*snapshot, playerSprite ? &*playerSprite : nullptr);
|
||||
if (!playerPatch) {
|
||||
continue;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(state.sceneMutex);
|
||||
if (state.renderStop) {
|
||||
return;
|
||||
}
|
||||
if (state.renderGeneration != generation && state.renderFullRequested) {
|
||||
state.renderRequested = true;
|
||||
continue;
|
||||
}
|
||||
if (fullRender) {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(state.sceneMutex);
|
||||
if (state.renderStop) {
|
||||
return;
|
||||
}
|
||||
state.scene = std::move(scene);
|
||||
state.dibPixels = std::move(pixels);
|
||||
state.renderFullInFlight = false;
|
||||
}
|
||||
state.playerPatch = std::move(playerPatch);
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
}
|
||||
PostMessageW(window, sceneReadyMessage, 0, 0);
|
||||
}
|
||||
});
|
||||
} catch (const std::exception& error) {
|
||||
reportLoadFailure(window, state, widen(error.what()));
|
||||
} catch (...) {
|
||||
reportLoadFailure(window, state, L"An unexpected error occurred in the live map renderer.");
|
||||
}
|
||||
});
|
||||
} catch (const std::exception& error) {
|
||||
reportLoadFailure(window, state, widen(error.what()));
|
||||
} catch (...) {
|
||||
reportLoadFailure(window, state, L"Could not start the live map-rendering worker thread.");
|
||||
}
|
||||
}
|
||||
|
||||
void requestLiveRender(AppState& state, bool fullRender)
|
||||
void requestLiveRender(AppState& state, bool fullRender, bool forceFullRender = false)
|
||||
{
|
||||
state.renderRequested = true;
|
||||
state.renderFullRequested = state.renderFullRequested || fullRender;
|
||||
++state.renderGeneration;
|
||||
state.renderFullRequested = state.renderFullRequested ||
|
||||
(fullRender && (!state.renderFullInFlight || forceFullRender));
|
||||
state.renderWake.notify_one();
|
||||
}
|
||||
|
||||
|
|
@ -904,9 +942,16 @@ void paintWindow(HWND window, AppState& state)
|
|||
const auto avatarScreen = remorse::projectToScreen(avatarWorld(state));
|
||||
const int centeredLeft = avatarScreen.x - state.scene->sourceLeft - viewWidth / 2;
|
||||
const int centeredTop = avatarScreen.y - state.scene->sourceTop - viewHeight / 2;
|
||||
const int sourceLeft = std::clamp(centeredLeft, 0, static_cast<int>(state.scene->width) - viewWidth);
|
||||
const int sourceTop = std::clamp(centeredTop, 0, static_cast<int>(state.scene->height) - viewHeight);
|
||||
if ((sourceLeft != centeredLeft || sourceTop != centeredTop) && state.renderThread.joinable()) {
|
||||
const int maxSourceLeft = static_cast<int>(state.scene->width) - viewWidth;
|
||||
const int maxSourceTop = static_cast<int>(state.scene->height) - viewHeight;
|
||||
const int sourceLeft = std::clamp(centeredLeft, 0, maxSourceLeft);
|
||||
const int sourceTop = std::clamp(centeredTop, 0, maxSourceTop);
|
||||
const int prefetchMarginX = std::max(1, viewWidth / 4);
|
||||
const int prefetchMarginY = std::max(1, viewHeight / 4);
|
||||
const bool nearingSceneEdge = centeredLeft < prefetchMarginX ||
|
||||
centeredLeft > maxSourceLeft - prefetchMarginX ||
|
||||
centeredTop < prefetchMarginY || centeredTop > maxSourceTop - prefetchMarginY;
|
||||
if (nearingSceneEdge && state.renderThread.joinable()) {
|
||||
requestLiveRender(state, true);
|
||||
}
|
||||
|
||||
|
|
@ -1058,19 +1103,78 @@ void updatePlayer(HWND window, AppState& state)
|
|||
bool changed = false;
|
||||
while (state.simulationAccumulator >= simulationTickSeconds) {
|
||||
state.simulationAccumulator -= simulationTickSeconds;
|
||||
remorse::ControllerActorState controllerActor;
|
||||
controllerActor.mapNumber = static_cast<remorse::u16>(state.mapIndex);
|
||||
controllerActor.direction = state.playerDirection;
|
||||
controllerActor.lastAnimation = state.playerAnimation;
|
||||
controllerActor.lastAnimationNotCombat = remorse::controllerLastAnimationIsNotCombat(
|
||||
state.playerAnimation);
|
||||
controllerActor.kneeling = state.playerKneeling;
|
||||
controllerActor.activeWeapon = state.playerHasActiveWeapon;
|
||||
controllerActor.busy = state.animationProcessId != 0 &&
|
||||
state.diagnosticKernel.processAt(state.animationProcessId) != nullptr;
|
||||
state.controllerMovement.setActorState(controllerActor);
|
||||
state.diagnosticKernel.dispatchPendingKeyEvents([](remorse::EntityDispatchEntryBase& entry,
|
||||
remorse::u16 selector, remorse::u16 filter, remorse::KeyEvent& event, void* context) {
|
||||
auto& app = *static_cast<AppState*>(context);
|
||||
if (entry.bytes[0] == 0xa6 && entry.bytes[1] == 0x3a && selector == 0x10 && filter == 0) {
|
||||
app.controllerMovement.handleDirectionalKey(event.scanCode, event.modifiers, event.field8 != 0);
|
||||
app.controllerMovement.handleKeyEvent(
|
||||
event.scanCode, event.modifiers, event.field8, event.field9,
|
||||
event.fieldA, event.field6);
|
||||
}
|
||||
}, &state);
|
||||
if (auto command = state.controllerMovement.takeCommandRequest()) {
|
||||
state.lastControllerCommand = command;
|
||||
if (command->command == remorse::ControllerCommand::CycleWeaponForward) {
|
||||
state.playerHasActiveWeapon = !state.playerHasActiveWeapon;
|
||||
controllerActor.activeWeapon = state.playerHasActiveWeapon;
|
||||
state.controllerMovement.setActorState(controllerActor);
|
||||
}
|
||||
}
|
||||
if (state.useRequested) {
|
||||
state.useRequested = false;
|
||||
changed = startNearbyUsecode(state) || changed;
|
||||
}
|
||||
runUsecodeTasks(state);
|
||||
const auto movement = state.controllerMovement.request();
|
||||
if (state.activeOneShotMovement && (state.animationProcessId == 0 ||
|
||||
state.diagnosticKernel.processAt(state.animationProcessId) == nullptr)) {
|
||||
state.activeOneShotMovement.reset();
|
||||
state.animationProcessId = 0;
|
||||
state.playerAnimation = 0;
|
||||
state.playerFrame = 0;
|
||||
}
|
||||
if (const auto action = state.controllerMovement.takeActionRequest()) {
|
||||
state.activeOneShotMovement = action;
|
||||
if (action->animation == 0x28) {
|
||||
state.playerKneeling = true;
|
||||
} else if (action->animation == 0x29) {
|
||||
state.playerKneeling = false;
|
||||
}
|
||||
}
|
||||
auto movement = state.activeOneShotMovement
|
||||
? *state.activeOneShotMovement : state.controllerMovement.request();
|
||||
bool directionUpdatedInPlace = false;
|
||||
if (movement.updateDirectionInPlace) {
|
||||
const auto requestedDirection = state.controllerMovement.takeInPlaceDirectionUpdate();
|
||||
if (requestedDirection && state.liveItems && state.animationProcessId != 0) {
|
||||
const auto updatedDirection = state.diagnosticKernel.updateAnimPrimitiveDirection(
|
||||
state.animationProcessId, *state.liveItems, *requestedDirection);
|
||||
if (updatedDirection) {
|
||||
movement.animation = state.playerAnimation;
|
||||
movement.direction = *updatedDirection;
|
||||
directionUpdatedInPlace = true;
|
||||
}
|
||||
}
|
||||
if (!directionUpdatedInPlace) {
|
||||
movement = state.activeOneShotMovement
|
||||
? *state.activeOneShotMovement : state.controllerMovement.request();
|
||||
}
|
||||
}
|
||||
if (movement.animation >= state.playerAnimations.size() ||
|
||||
!state.playerAnimations[movement.animation]) {
|
||||
state.activeOneShotMovement.reset();
|
||||
movement = state.controllerMovement.request();
|
||||
}
|
||||
state.diagnosticKernel.deliverSystemTimerEvent();
|
||||
bool gravityMoved = false;
|
||||
if (state.diagnostics) {
|
||||
|
|
@ -1129,22 +1233,27 @@ void updatePlayer(HWND window, AppState& state)
|
|||
}
|
||||
changed = changed || state.diagnostics || gravityMoved;
|
||||
if (movement.animation == 0) {
|
||||
const bool facingChanged = state.playerDirection != movement.direction;
|
||||
state.playerDirection = movement.direction;
|
||||
const bool playerSpriteChanged = state.playerAnimation != 0 || state.playerFrame != 0;
|
||||
if (state.animationProcessId != 0) {
|
||||
auto* process = state.diagnosticKernel.processAt(state.animationProcessId);
|
||||
process->bytes[0x18] |= 4;
|
||||
state.diagnosticKernel.terminateProcess(state.animationProcessId, state.diagnosticGroupCounts);
|
||||
if (process != nullptr) {
|
||||
process->bytes[0x18] |= 4;
|
||||
state.diagnosticKernel.terminateProcess(state.animationProcessId, state.diagnosticGroupCounts);
|
||||
}
|
||||
state.animationProcessId = 0;
|
||||
}
|
||||
changed = changed || state.playerAnimation != 0 || state.playerFrame != 0;
|
||||
state.playerAnimation = 0;
|
||||
state.playerFrame = 0;
|
||||
changed = changed || facingChanged;
|
||||
const bool usecodeMutation = state.usecodeWorldMutationPending;
|
||||
state.usecodeWorldMutationPending = false;
|
||||
changed = changed || usecodeMutation;
|
||||
if (state.renderThread.joinable() &&
|
||||
(gravityMoved || usecodeMutation || playerSpriteChanged)) {
|
||||
requestLiveRender(state, gravityMoved || usecodeMutation);
|
||||
(gravityMoved || usecodeMutation || playerSpriteChanged || facingChanged)) {
|
||||
requestLiveRender(state, gravityMoved || usecodeMutation, true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1153,10 +1262,9 @@ void updatePlayer(HWND window, AppState& state)
|
|||
const remorse::u8 previousPlayerDirection = state.playerDirection;
|
||||
const remorse::u8 previousPlayerFrame = state.playerFrame;
|
||||
const remorse::u8 requestedAnimation = movement.animation;
|
||||
const remorse::AnimationClip& clip = requestedAnimation == 1
|
||||
? *state.walkAnimation : *state.runAnimation;
|
||||
if (state.animationProcessId == 0 || state.playerAnimation != requestedAnimation ||
|
||||
state.playerDirection != movement.direction) {
|
||||
const remorse::AnimationClip& clip = *state.playerAnimations[requestedAnimation];
|
||||
if (!directionUpdatedInPlace && (state.animationProcessId == 0 ||
|
||||
state.playerAnimation != requestedAnimation || state.playerDirection != movement.direction)) {
|
||||
if (state.animationProcessId != 0) {
|
||||
auto* process = state.diagnosticKernel.processAt(state.animationProcessId);
|
||||
process->bytes[0x18] |= 4;
|
||||
|
|
@ -1179,12 +1287,22 @@ void updatePlayer(HWND window, AppState& state)
|
|||
[](remorse::EntityDispatchEntryBase& entry, void* context) {
|
||||
auto& app = *static_cast<AppState*>(context);
|
||||
if (&entry == app.diagnosticKernel.processAt(app.animationProcessId)) {
|
||||
const remorse::AnimationClip& activeClip = app.playerAnimation == 1
|
||||
? *app.walkAnimation : *app.runAnimation;
|
||||
const remorse::AnimationClip& activeClip = *app.playerAnimations[app.playerAnimation];
|
||||
const auto* item = app.liveItems->findItem(1);
|
||||
app.diagnosticKernel.advanceGroundedAnimPrimitive(app.animationProcessId,
|
||||
const auto advanced = app.diagnosticKernel.advanceGroundedAnimPrimitive(app.animationProcessId,
|
||||
*app.liveItems, activeClip, app.shapeTypes,
|
||||
remorse::calculateFastAreaRange({item->data.x, item->data.y, item->data.z}));
|
||||
if (app.activeOneShotMovement && (!advanced || !*advanced)) {
|
||||
auto* finished = app.diagnosticKernel.processAt(app.animationProcessId);
|
||||
if (finished != nullptr) {
|
||||
finished->bytes[0x18] |= 4;
|
||||
app.diagnosticKernel.terminateProcess(
|
||||
app.animationProcessId, app.diagnosticGroupCounts);
|
||||
}
|
||||
app.animationProcessId = 0;
|
||||
app.playerAnimation = 0;
|
||||
app.playerFrame = 0;
|
||||
}
|
||||
}
|
||||
}, &state);
|
||||
state.fastArea = fastArea;
|
||||
|
|
@ -1203,7 +1321,7 @@ void updatePlayer(HWND window, AppState& state)
|
|||
state.playerDirection != previousPlayerDirection || state.playerFrame != previousPlayerFrame;
|
||||
if (state.renderThread.joinable() &&
|
||||
(moved || hatched || usecodeMutation || gravityMoved || playerSpriteChanged)) {
|
||||
requestLiveRender(state, hatched || usecodeMutation || gravityMoved);
|
||||
requestLiveRender(state, hatched || usecodeMutation || gravityMoved, true);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
|
@ -1233,6 +1351,7 @@ LRESULT CALLBACK windowProcedure(HWND window, UINT message, WPARAM wParam, LPARA
|
|||
return 0;
|
||||
case WM_TIMER:
|
||||
if (wParam == timerId) {
|
||||
displayLoadFailure(window, *state);
|
||||
updatePlayer(window, *state);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1272,7 +1391,15 @@ LRESULT CALLBACK windowProcedure(HWND window, UINT message, WPARAM wParam, LPARA
|
|||
wParam == 'Z' || wParam == 'C') event.modifiers &= ~0x20;
|
||||
if (GetKeyState(VK_LSHIFT) & 0x8000) event.modifiers |= 1;
|
||||
if (GetKeyState(VK_RSHIFT) & 0x8000) event.modifiers |= 2;
|
||||
event.field8 = message == WM_KEYDOWN ? 1 : 0;
|
||||
if (GetKeyState(VK_LMENU) & 0x8000 || GetKeyState(VK_RMENU) & 0x8000) {
|
||||
event.modifiers |= 0x0a00;
|
||||
}
|
||||
if (GetKeyState(VK_LCONTROL) & 0x8000 || GetKeyState(VK_RCONTROL) & 0x8000) {
|
||||
event.modifiers |= 0x0500;
|
||||
}
|
||||
event.field8 = 1;
|
||||
event.field9 = message == WM_KEYDOWN ? 1 : 0;
|
||||
event.fieldA = message == WM_KEYDOWN ? 1 : 0;
|
||||
std::lock_guard<std::mutex> lock(state->kernelMutex);
|
||||
state->diagnosticKernel.queuePendingKeyEvent(event);
|
||||
}
|
||||
|
|
@ -1319,12 +1446,16 @@ LRESULT CALLBACK windowProcedure(HWND window, UINT message, WPARAM wParam, LPARA
|
|||
paintWindow(window, *state);
|
||||
return 0;
|
||||
case sceneReadyMessage: {
|
||||
bool shouldStartRenderer = false;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(state->sceneMutex);
|
||||
if (state->sceneLoaded && state->renderer && !state->renderThread.joinable()) {
|
||||
startLiveRenderer(window, *state);
|
||||
}
|
||||
shouldStartRenderer = state->sceneLoaded && state->renderer.has_value() &&
|
||||
!state->renderThread.joinable();
|
||||
}
|
||||
if (shouldStartRenderer) {
|
||||
startLiveRenderer(window, *state);
|
||||
}
|
||||
displayLoadFailure(window, *state);
|
||||
InvalidateRect(window, nullptr, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "remorse/shape_archive.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <array>
|
||||
#include <filesystem>
|
||||
|
||||
namespace {
|
||||
|
|
@ -100,6 +101,14 @@ int main()
|
|||
assert(stand.has_value() && stand->frameCount > 0);
|
||||
assert(walk.has_value() && walk->frameCount == 17);
|
||||
assert(run.has_value() && run->frameCount == 12);
|
||||
std::array<std::optional<remorse::AnimationClip>, 0x40> playerAnimations;
|
||||
for (const remorse::u8 index : remorse::controllerAnimationIndices) {
|
||||
playerAnimations[index] = remorse::loadAnimationClip(
|
||||
*animationArchive, 1, index);
|
||||
}
|
||||
for (const remorse::u8 animation : remorse::controllerAnimationIndices) {
|
||||
assert(playerAnimations[animation] && playerAnimations[animation]->frameCount != 0);
|
||||
}
|
||||
for (const remorse::AnimationClip* clip : {&*walk, &*run}) {
|
||||
assert(clip->header[1] == 5);
|
||||
for (remorse::u8 direction = 0; direction < 16; ++direction) {
|
||||
|
|
@ -148,7 +157,10 @@ int main()
|
|||
const auto playerFrames = remorse::loadShapeFrames(*shapeArchive, 1);
|
||||
assert(playerFrames.has_value() && playerFrames->size() >= walk->frameCount);
|
||||
std::vector<bool> referencedFrames(playerFrames->size(), false);
|
||||
for (const remorse::AnimationClip* clip : {&*stand, &*walk, &*run}) {
|
||||
for (const auto& clip : playerAnimations) {
|
||||
if (!clip) {
|
||||
continue;
|
||||
}
|
||||
for (remorse::u8 direction = 0; direction < 16; ++direction) {
|
||||
for (remorse::u8 frame = 0; frame < clip->frameCount; ++frame) {
|
||||
const auto metadata = remorse::getAnimationFrame(*clip, direction, frame);
|
||||
|
|
@ -159,14 +171,13 @@ int main()
|
|||
}
|
||||
}
|
||||
}
|
||||
bool decodedReferencedFrame = false;
|
||||
for (std::size_t frame = 0; frame < referencedFrames.size(); ++frame) {
|
||||
if (referencedFrames[frame]) {
|
||||
assert(remorse::decodeShapeFrame(*shapeArchive, 1, static_cast<remorse::u32>(frame)).has_value());
|
||||
decodedReferencedFrame = true;
|
||||
break;
|
||||
assert(remorse::decodeShapeFrame((*playerFrames)[frame]).has_value());
|
||||
}
|
||||
}
|
||||
assert(decodedReferencedFrame);
|
||||
assert(std::any_of(referencedFrames.begin(), referencedFrames.end(), [](bool referenced) {
|
||||
return referenced;
|
||||
}));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -997,6 +997,10 @@ int main()
|
|||
assert(animationKernel.startAnimPrimitiveProcess(3, animationItems, walking));
|
||||
const auto* npcAnimation = animationItems.findNpcAnimation(1);
|
||||
assert(npcAnimation && npcAnimation->lastAnimation == 1 && npcAnimation->frame == 0);
|
||||
assert(animationKernel.updateAnimPrimitiveDirection(3, animationItems, 7) == 6);
|
||||
assert(animation->extra[6] == 6 && npcAnimation->frame == 0 && npcAnimation->direction == 6);
|
||||
assert(animationKernel.updateAnimPrimitiveDirection(3, animationItems, 0x11) == 8);
|
||||
assert(animationKernel.updateAnimPrimitiveDirection(3, animationItems, 0x12) == 6);
|
||||
assert(!animationKernel.startAnimPrimitiveProcess(3, animationItems, walking));
|
||||
auto* repeatedWalk = animationKernel.createAnimPrimitiveProcess(1, 1, 1, 6, walking, animationGroups);
|
||||
assert(animationKernel.startAnimPrimitiveProcess(4, animationItems, walking));
|
||||
|
|
@ -1004,6 +1008,21 @@ int main()
|
|||
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::ProcessKernel sixteenDirectionKernel;
|
||||
remorse::u16 sixteenDirectionGroups[32]{};
|
||||
for (int reservedSlot = 0; reservedSlot < 3; ++reservedSlot) {
|
||||
sixteenDirectionKernel.createProcess(1, sixteenDirectionGroups);
|
||||
}
|
||||
auto sixteenWalking = walking;
|
||||
sixteenWalking.header[3] |= 0x40;
|
||||
auto* sixteenDirection = sixteenDirectionKernel.createAnimPrimitiveProcess(1, 1, 1, 6,
|
||||
sixteenWalking, sixteenDirectionGroups);
|
||||
remorse::LiveFixedMapItems sixteenItems({});
|
||||
assert(sixteenItems.initializeAvatar());
|
||||
assert(sixteenDirectionKernel.startAnimPrimitiveProcess(3, sixteenItems, sixteenWalking));
|
||||
assert(sixteenDirectionKernel.updateAnimPrimitiveDirection(3, sixteenItems, 0x11) == 15);
|
||||
assert(sixteenDirection->extra[6] == 15);
|
||||
assert(sixteenDirectionKernel.updateAnimPrimitiveDirection(3, sixteenItems, 0x12) == 14);
|
||||
remorse::StagedFixedMapItem animationSpawn{};
|
||||
animationSpawn.data.x = 512;
|
||||
animationSpawn.data.y = 512;
|
||||
|
|
@ -1022,6 +1041,11 @@ int main()
|
|||
walking, animationShapes, animationArea) == true);
|
||||
assert(animationItems.findItem(1)->data.x == 514 && animationItems.findItem(1)->data.y == 514);
|
||||
assert(movingNpc.frame == 1);
|
||||
nextWalkFrame.bytes[5] = 0;
|
||||
assert(animationKernel.advanceGroundedAnimPrimitive(3, animationItems,
|
||||
walking, animationShapes, animationArea) == true);
|
||||
assert(animationItems.findItem(1)->data.x == 514 && movingNpc.frame == 2);
|
||||
nextWalkFrame.bytes[5] = 2;
|
||||
nextWalkFrame.bytes[4] = 100;
|
||||
movingNpc.frame = 0;
|
||||
remorse::StagedFixedMapItem animationWall{};
|
||||
|
|
|
|||
|
|
@ -9,12 +9,258 @@ int main()
|
|||
assert(controller.request().animation == 0);
|
||||
controller.handleDirectionalKey(0x48, 0, true);
|
||||
assert(controller.request().animation == 1 && controller.request().direction == 14);
|
||||
controller.handleKeyEvent(0x50, 0, 0, 1);
|
||||
assert(controller.request().direction == 14);
|
||||
controller.handleKeyEvent(0x48, 0x0a00, 1, 1);
|
||||
const auto jump = controller.takeActionRequest();
|
||||
assert(jump && jump->animation == 0x24 && jump->direction == 14 && jump->oneShot);
|
||||
remorse::ControllerMovementState keypadKneelController;
|
||||
keypadKneelController.handleKeyEvent(0x4c, 0, 1, 1, 0);
|
||||
assert(!keypadKneelController.takeActionRequest());
|
||||
keypadKneelController.handleKeyEvent(0x4c, 0, 1, 1, 1);
|
||||
assert(keypadKneelController.takeActionRequest()->animation == 0x28);
|
||||
keypadKneelController.handleKeyEvent(0x4c, 0, 1, 1, 1);
|
||||
assert(keypadKneelController.takeActionRequest()->animation == 0x29);
|
||||
remorse::ControllerMovementState ctrlDownKneelController;
|
||||
ctrlDownKneelController.handleKeyEvent(0x50, 0x0100, 1, 1, 0);
|
||||
assert(!ctrlDownKneelController.takeActionRequest());
|
||||
ctrlDownKneelController.handleKeyEvent(0x50, 0x0100, 1, 1, 1);
|
||||
assert(ctrlDownKneelController.takeActionRequest()->animation == 0x28);
|
||||
ctrlDownKneelController.handleKeyEvent(0x50, 0x0100, 1, 1, 1);
|
||||
assert(ctrlDownKneelController.takeActionRequest()->animation == 0x29);
|
||||
remorse::ControllerMovementState commandController;
|
||||
commandController.handleKeyEvent(0x39, 0, 1, 1, 1);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::FireWeapon);
|
||||
commandController.handleKeyEvent(0x52, 0, 1, 1, 1);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::FireWeapon);
|
||||
commandController.handleKeyEvent(0x52, 0x0100, 1, 1, 1, 0);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::FireWeapon);
|
||||
commandController.handleKeyEvent(0x4a, 0, 1, 1, 1);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::SelectNextItem);
|
||||
commandController.handleKeyEvent(0x37, 0, 1, 1, 1, 1);
|
||||
assert(!commandController.takeCommandRequest());
|
||||
commandController.handleKeyEvent(0x37, 0, 1, 1, 1, 0);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::CycleWeaponForward);
|
||||
commandController.handleKeyEvent(0x4e, 0, 1, 1, 1);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::OpenInventory);
|
||||
commandController.handleKeyEvent(0x53, 0x0100, 1, 1, 1, 0);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::OpenInventory);
|
||||
commandController.handleKeyEvent(0x53, 0, 1, 1, 1, 1);
|
||||
assert(!commandController.takeCommandRequest());
|
||||
commandController.handleKeyEvent(0x53, 0, 1, 1, 1, 0);
|
||||
assert(commandController.takeCommandRequest()->command == remorse::ControllerCommand::OpenInventory);
|
||||
commandController.handleKeyEvent(0x39, 0, 1, 1, 0);
|
||||
assert(!commandController.takeCommandRequest());
|
||||
remorse::ControllerActorState restrictedCommandActor;
|
||||
restrictedCommandActor.mapNumber = 0x40;
|
||||
commandController.setActorState(restrictedCommandActor);
|
||||
commandController.handleKeyEvent(0x39, 0, 1, 1, 1);
|
||||
assert(!commandController.takeCommandRequest());
|
||||
restrictedCommandActor.mapNumber = 1;
|
||||
restrictedCommandActor.npcNumber = 2;
|
||||
commandController.setActorState(restrictedCommandActor);
|
||||
commandController.handleKeyEvent(0x4a, 0, 1, 1, 1);
|
||||
assert(!commandController.takeCommandRequest());
|
||||
remorse::ControllerMovementState altNumLockRight;
|
||||
remorse::ControllerActorState altTurnActor;
|
||||
altTurnActor.direction = 14;
|
||||
altNumLockRight.setActorState(altTurnActor);
|
||||
altNumLockRight.handleKeyEvent(0x4d, 0x0a20, 1, 1);
|
||||
const auto altTurn = altNumLockRight.takeActionRequest();
|
||||
assert(altTurn && altTurn->animation == 0x1d && altTurn->direction == 13);
|
||||
remorse::ControllerMovementState jumpController;
|
||||
jumpController.handleKeyEvent(0x35, 0, 1, 1);
|
||||
const auto slashJump = jumpController.takeActionRequest();
|
||||
assert(slashJump && slashJump->animation == 0x24 && slashJump->oneShot);
|
||||
jumpController.handleKeyEvent(0x35, 0, 1, 0);
|
||||
assert(!jumpController.takeActionRequest());
|
||||
remorse::ControllerMovementState modifierReleaseController;
|
||||
modifierReleaseController.handleKeyEvent(0x48, 0, 1, 1);
|
||||
assert(modifierReleaseController.request().animation == 1);
|
||||
modifierReleaseController.handleKeyEvent(0x1d, 0x0100, 1, 1);
|
||||
modifierReleaseController.handleKeyEvent(0x48, 0x0100, 1, 0);
|
||||
assert(modifierReleaseController.request().animation == 0);
|
||||
remorse::ControllerMovementState combatTurnController;
|
||||
remorse::ControllerActorState combatTurnActor;
|
||||
combatTurnActor.avatarSomethingCombatty = true;
|
||||
combatTurnActor.direction = 14;
|
||||
combatTurnController.setActorState(combatTurnActor);
|
||||
combatTurnController.handleKeyEvent(0x4b, 0, 1, 1);
|
||||
const auto combatTurn = combatTurnController.takeActionRequest();
|
||||
assert(combatTurn && combatTurn->animation == 4 && combatTurn->direction == 13);
|
||||
combatTurnActor.kneeling = true;
|
||||
combatTurnActor.direction = 13;
|
||||
combatTurnController.setActorState(combatTurnActor);
|
||||
combatTurnController.handleKeyEvent(0x4d, 0, 1, 1);
|
||||
const auto kneelingCombatTurn = combatTurnController.takeActionRequest();
|
||||
assert(kneelingCombatTurn && kneelingCombatTurn->animation == 0x2e && kneelingCombatTurn->direction == 14);
|
||||
remorse::ControllerMovementState ctrlDiagonalController;
|
||||
remorse::ControllerActorState ctrlDiagonalActor;
|
||||
ctrlDiagonalActor.direction = 14;
|
||||
ctrlDiagonalController.setActorState(ctrlDiagonalActor);
|
||||
ctrlDiagonalController.handleKeyEvent(0x47, 0x0100, 1, 1);
|
||||
const auto ctrlDiagonalLeft = ctrlDiagonalController.takeActionRequest();
|
||||
assert(ctrlDiagonalLeft && ctrlDiagonalLeft->animation == 0x17 && ctrlDiagonalLeft->direction == 0);
|
||||
ctrlDiagonalController.handleKeyEvent(0x49, 0x0100, 1, 1);
|
||||
const auto ctrlDiagonalRight = ctrlDiagonalController.takeActionRequest();
|
||||
assert(ctrlDiagonalRight && ctrlDiagonalRight->animation == 0x18 && ctrlDiagonalRight->direction == 12);
|
||||
ctrlDiagonalController.handleKeyEvent(0x47, 0x0120, 1, 1);
|
||||
assert(!ctrlDiagonalController.takeActionRequest());
|
||||
modifierReleaseController.handleKeyEvent(0x48, 0x0100, 1, 1);
|
||||
assert(modifierReleaseController.takeActionRequest()->animation == 0x3a);
|
||||
modifierReleaseController.handleKeyEvent(0x48, 0x0100, 1, 0);
|
||||
assert(modifierReleaseController.request().animation == 0);
|
||||
controller.handleKeyEvent(0x4b, 0x0500, 1, 1);
|
||||
const auto combatStep = controller.takeActionRequest();
|
||||
assert(combatStep && combatStep->animation == 0x3d && combatStep->oneShot);
|
||||
controller.handleKeyEvent(0x4c, 0x0500, 1, 1);
|
||||
const auto crouch = controller.takeActionRequest();
|
||||
assert(crouch && crouch->animation == 0x28);
|
||||
controller.handleKeyEvent(0x4c, 0x0500, 1, 1);
|
||||
assert(controller.takeActionRequest()->animation == 0x29);
|
||||
remorse::ControllerMovementState numLockController;
|
||||
numLockController.setFacingDirection(14);
|
||||
numLockController.setTurnStep(2);
|
||||
numLockController.handleKeyEvent(0x4d, 0x20, 1, 1);
|
||||
assert(numLockController.request().animation == 0 && numLockController.request().direction == 0);
|
||||
numLockController.setFacingDirection(0);
|
||||
numLockController.handleKeyEvent(0x48, 0x21, 1, 1);
|
||||
assert(numLockController.request().animation == 3 && numLockController.request().direction == 0);
|
||||
numLockController.handleKeyEvent(0x50, 0x20, 1, 1);
|
||||
assert(numLockController.request().animation == 2 && numLockController.request().direction == 0);
|
||||
numLockController.handleKeyEvent(0x50, 0x20, 1, 0);
|
||||
assert(numLockController.request().animation == 1 && numLockController.request().direction == 0);
|
||||
remorse::ControllerMovementState gatedController;
|
||||
remorse::ControllerActorState actorState;
|
||||
actorState.controllerEnabled = false;
|
||||
gatedController.setActorState(actorState);
|
||||
gatedController.handleDirectionalKey(0x48, 0, true);
|
||||
assert(gatedController.request().animation == 0);
|
||||
actorState.controllerEnabled = true;
|
||||
actorState.avatarInStasis = true;
|
||||
gatedController.setActorState(actorState);
|
||||
gatedController.handleDirectionalKey(0x48, 0, true);
|
||||
assert(gatedController.request().animation == 0);
|
||||
actorState.npcNumber = 2;
|
||||
gatedController.setActorState(actorState);
|
||||
gatedController.handleDirectionalKey(0x48, 0, true);
|
||||
assert(gatedController.request().animation == 1);
|
||||
assert(remorse::controllerAllowsInPlaceDirectionUpdate(0x30));
|
||||
assert(!remorse::controllerAllowsInPlaceDirectionUpdate(0x28));
|
||||
constexpr remorse::u8 nonCombatAnimations[] = {0, 1, 11, 16, 32, 55, 58, 59};
|
||||
for (const remorse::u8 animation : nonCombatAnimations) {
|
||||
assert(remorse::controllerLastAnimationIsNotCombat(animation));
|
||||
}
|
||||
assert(!remorse::controllerLastAnimationIsNotCombat(4));
|
||||
assert(!remorse::controllerLastAnimationIsNotCombat(3));
|
||||
assert(remorse::controllerLastAnimationIsRunningJumping(3));
|
||||
assert(remorse::controllerLastAnimationIsRunningJumping(48));
|
||||
assert(remorse::controllerLastAnimationIsRunningJumping(49));
|
||||
assert(remorse::controllerLastAnimationIsRunningJumping(56));
|
||||
assert(!remorse::controllerLastAnimationIsRunningJumping(34));
|
||||
remorse::ControllerMovementState jumpKeyController;
|
||||
jumpKeyController.handleKeyEvent(0x0f, 0, 1, 1, 1);
|
||||
assert(jumpKeyController.takeActionRequest()->animation == 56);
|
||||
remorse::ControllerActorState busyRunner;
|
||||
busyRunner.busy = true;
|
||||
busyRunner.lastAnimation = 3;
|
||||
jumpKeyController.setActorState(busyRunner);
|
||||
jumpKeyController.handleKeyEvent(0x24, 0, 1, 1, 1);
|
||||
assert(jumpKeyController.takeActionRequest()->animation == 56);
|
||||
busyRunner.lastAnimation = 56;
|
||||
jumpKeyController.setActorState(busyRunner);
|
||||
jumpKeyController.handleKeyEvent(0x0f, 0, 1, 1, 1);
|
||||
assert(!jumpKeyController.takeActionRequest());
|
||||
busyRunner.lastAnimation = 4;
|
||||
jumpKeyController.setActorState(busyRunner);
|
||||
jumpKeyController.handleKeyEvent(0x0f, 0, 1, 1, 1);
|
||||
assert(!jumpKeyController.takeActionRequest());
|
||||
remorse::ControllerMovementState busyTurnController;
|
||||
actorState.npcNumber = 1;
|
||||
actorState.avatarInStasis = false;
|
||||
actorState.busy = true;
|
||||
actorState.lastAnimation = 1;
|
||||
busyTurnController.setActorState(actorState);
|
||||
busyTurnController.handleKeyEvent(0x4d, 0x20, 1, 1);
|
||||
const auto busyTurn = busyTurnController.request();
|
||||
assert(busyTurn.updateDirectionInPlace && busyTurn.animation == 1 && busyTurn.direction == 0x11);
|
||||
assert(busyTurnController.takeInPlaceDirectionUpdate() == 0x11);
|
||||
actorState.lastAnimation = 0x28;
|
||||
busyTurnController.setActorState(actorState);
|
||||
busyTurnController.handleKeyEvent(0x4d, 0x20, 1, 1);
|
||||
assert(!busyTurnController.takeInPlaceDirectionUpdate());
|
||||
assert(busyTurnController.request().animation == 0 && busyTurnController.request().direction == 14);
|
||||
remorse::ControllerMovementState clearedBusyTurnController;
|
||||
actorState.lastAnimation = 1;
|
||||
clearedBusyTurnController.setActorState(actorState);
|
||||
clearedBusyTurnController.handleKeyEvent(0x4d, 0x20, 1, 1);
|
||||
assert(clearedBusyTurnController.request().updateDirectionInPlace);
|
||||
clearedBusyTurnController.clear();
|
||||
assert(!clearedBusyTurnController.request().updateDirectionInPlace);
|
||||
remorse::ControllerMovementState armedRunController;
|
||||
actorState.busy = false;
|
||||
actorState.activeWeapon = true;
|
||||
actorState.mapNumber = 1;
|
||||
actorState.direction = 14;
|
||||
actorState.lastAnimation = 0;
|
||||
armedRunController.setActorState(actorState);
|
||||
armedRunController.handleKeyEvent(0x48, 0x01, 1, 1);
|
||||
assert(armedRunController.request().animation == 0x22);
|
||||
actorState.lastAnimation = 48;
|
||||
armedRunController.setActorState(actorState);
|
||||
assert(armedRunController.request().animation == 0x30);
|
||||
remorse::ControllerMovementState unarmedRunController;
|
||||
actorState.activeWeapon = false;
|
||||
actorState.lastAnimation = 0;
|
||||
unarmedRunController.setActorState(actorState);
|
||||
unarmedRunController.handleKeyEvent(0x48, 0x01, 1, 1);
|
||||
assert(unarmedRunController.request().animation == 0x22);
|
||||
actorState.lastAnimation = 0x22;
|
||||
unarmedRunController.setActorState(actorState);
|
||||
assert(unarmedRunController.request().animation == 3);
|
||||
remorse::ControllerMovementState combatControlController;
|
||||
actorState.lastAnimationNotCombat = false;
|
||||
actorState.kneeling = false;
|
||||
actorState.npcNumber = 1;
|
||||
combatControlController.setActorState(actorState);
|
||||
combatControlController.handleKeyEvent(0x48, 0x0100, 1, 1);
|
||||
assert(combatControlController.takeActionRequest()->animation == 0x0b);
|
||||
remorse::ControllerMovementState kneelingControlController;
|
||||
actorState.kneeling = true;
|
||||
kneelingControlController.setActorState(actorState);
|
||||
kneelingControlController.handleKeyEvent(0x48, 0x0100, 1, 1);
|
||||
assert(kneelingControlController.takeActionRequest()->animation == 0x29);
|
||||
remorse::ControllerMovementState nonAvatarControlController;
|
||||
actorState.kneeling = false;
|
||||
actorState.lastAnimationNotCombat = true;
|
||||
actorState.npcNumber = 2;
|
||||
nonAvatarControlController.setActorState(actorState);
|
||||
nonAvatarControlController.handleKeyEvent(0x48, 0x0100, 1, 1);
|
||||
assert(!nonAvatarControlController.takeActionRequest());
|
||||
remorse::ControllerMovementState mapFortyController;
|
||||
actorState.mapNumber = 0x40;
|
||||
actorState.lastAnimation = 0;
|
||||
actorState.direction = 14;
|
||||
mapFortyController.setActorState(actorState);
|
||||
mapFortyController.handleKeyEvent(0x48, 0x01, 1, 1);
|
||||
assert(mapFortyController.request().animation == 0x26);
|
||||
remorse::ControllerMovementState mapFortyContinuation;
|
||||
actorState.lastAnimation = 38;
|
||||
mapFortyContinuation.setActorState(actorState);
|
||||
mapFortyContinuation.handleKeyEvent(0x48, 0x01, 1, 1);
|
||||
assert(mapFortyContinuation.request().animation == 3);
|
||||
remorse::ControllerMovementState mapFortyMisfacing;
|
||||
actorState.lastAnimation = 0;
|
||||
actorState.direction = 12;
|
||||
mapFortyMisfacing.setActorState(actorState);
|
||||
mapFortyMisfacing.handleKeyEvent(0x48, 0x01, 1, 1);
|
||||
assert(mapFortyMisfacing.request().animation == 0);
|
||||
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);
|
||||
assert(controller.request().animation == 0 && controller.request().direction == 2);
|
||||
controller.handleDirectionalKey(0x48, 0, false);
|
||||
assert(controller.request().animation == 0 && controller.request().direction == 14);
|
||||
assert(controller.request().animation == 0 && controller.request().direction == 2);
|
||||
controller.handleDirectionalKey(0x49, 0x20, true);
|
||||
assert(controller.request().animation == 0);
|
||||
controller.handleDirectionalKey(0x47, 0x40, true);
|
||||
|
|
|
|||
|
|
@ -114,6 +114,22 @@ int main()
|
|||
});
|
||||
};
|
||||
assert(liveBefore && samePixels(liveBefore->pixels, startingScene->pixels));
|
||||
remorse::MapRenderOptions viewportOptions;
|
||||
viewportOptions.mapIndex = 1;
|
||||
viewportOptions.maxWidth = 2560;
|
||||
viewportOptions.maxHeight = 1440;
|
||||
viewportOptions.includeRoofs = true;
|
||||
viewportOptions.viewCenter = spawn;
|
||||
const auto unboundedViewport = cachedRenderer->render(viewportOptions, &liveSceneItems);
|
||||
const remorse::s32 viewportRadius = 2560 + 1440 * 2 + 512;
|
||||
viewportOptions.worldRect = remorse::WorldRect{
|
||||
spawn.x - viewportRadius, spawn.y - viewportRadius,
|
||||
spawn.x + viewportRadius, spawn.y + viewportRadius};
|
||||
const auto boundedViewport = cachedRenderer->render(viewportOptions, &liveSceneItems);
|
||||
assert(unboundedViewport && boundedViewport);
|
||||
assert(samePixels(unboundedViewport->pixels, boundedViewport->pixels));
|
||||
assert(unboundedViewport->coverage == boundedViewport->coverage);
|
||||
assert(boundedViewport->renderItemCount < unboundedViewport->renderItemCount);
|
||||
const auto playerFrame = remorse::decodeShapeFrame(cachedRenderer->shapes, 1, 0);
|
||||
assert(playerFrame);
|
||||
const remorse::MapRenderSprite playerSprite{spawn, 1, 0, false,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ int main()
|
|||
if (frame && !frame->pixels.empty()) {
|
||||
assert(frame->frame.width > 0);
|
||||
assert(frame->frame.height > 0);
|
||||
const auto parsedFrames = remorse::loadShapeFrames(*archive, shape);
|
||||
assert(parsedFrames && !parsedFrames->empty());
|
||||
const auto decodedFromParsed = remorse::decodeShapeFrame(parsedFrames->front());
|
||||
assert(decodedFromParsed && decodedFromParsed->pixels == frame->pixels);
|
||||
decodedFrame = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue