Enhance item handling and collision detection in remorse
- Introduced new functionality for staging and managing fixed map items, including the ability to build block chains and find candidates for item interactions. - Updated the main application logic to utilize staged item block chains for improved item finding and grabbing mechanics. - Added weight attribute to shape type information, allowing for more nuanced item interactions based on weight. - Enhanced collision tests to cover new item handling scenarios, including gravity sweeps and item grabbing. - Implemented additional tests for entity dispatch entries and fixed map items to ensure robustness of item spawning and movement logic. - Improved type flags loading to validate weight against binary data, ensuring consistency in item attributes.
This commit is contained in:
parent
c346b0e1a7
commit
b99fb59c12
15 changed files with 961 additions and 18 deletions
|
|
@ -77,6 +77,8 @@ int main(int argc, char** argv)
|
|||
std::cout << "Game data root: " << (gameDataRoot ? gameDataRoot->path.string() : "not found") << '\n';
|
||||
if (gameDataRoot) {
|
||||
std::optional<remorse::StagedFixedMapItem> firstStagedItem;
|
||||
std::optional<remorse::StagedItemBlockChains> stagedBlockChains;
|
||||
std::optional<std::vector<remorse::StagedFixedMapItem>> stagedMapItems;
|
||||
const auto palettePath = remorse::resolveGameDataPath(*gameDataRoot, std::filesystem::path("STATIC") / "GAMEPAL.PAL");
|
||||
const auto paletteBytes = palettePath ? remorse::readBinaryFile(*palettePath) : std::nullopt;
|
||||
std::cout << "GAMEPAL.PAL bytes: " << (paletteBytes ? paletteBytes->size() : 0) << '\n';
|
||||
|
|
@ -101,6 +103,8 @@ int main(int argc, char** argv)
|
|||
const auto items = remorse::stageFixedMapItems(*map);
|
||||
if (items && !items->empty()) {
|
||||
firstStagedItem = items->front();
|
||||
stagedBlockChains = remorse::buildStagedItemBlockChains(*items);
|
||||
stagedMapItems = *items;
|
||||
struct ItemScanContext {
|
||||
remorse::ProcessKernel* kernel;
|
||||
remorse::u16 (*groups)[32];
|
||||
|
|
@ -141,6 +145,23 @@ int main(int argc, char** argv)
|
|||
const auto area = remorse::itemFindAreaAroundItem(
|
||||
*firstStagedItem, (*typeFlags)[firstStagedItem->data.shape]);
|
||||
std::cout << "Staged item ItemFind blocks: " << remorse::itemFindBlockOrder(area).size() << '\n';
|
||||
if (stagedBlockChains) {
|
||||
std::cout << "Staged item ItemFind candidates: " <<
|
||||
remorse::itemFindCandidateOrder(area, *stagedBlockChains).size() << '\n';
|
||||
}
|
||||
if (stagedMapItems) {
|
||||
const auto matches = remorse::itemFindZMatches(*firstStagedItem, *stagedMapItems, *typeFlags, 3);
|
||||
std::cout << "Staged item ItemFind Z matches (script-free): " <<
|
||||
(matches ? matches->size() : 0) << '\n';
|
||||
const auto grabCandidates = remorse::itemGrabSearchCandidates(
|
||||
*firstStagedItem, *stagedMapItems, *typeFlags);
|
||||
const auto grabActions = remorse::planItemGrabActions(
|
||||
*firstStagedItem, *stagedMapItems, *typeFlags);
|
||||
std::cout << "Staged item Item_Grab candidates: " <<
|
||||
(grabCandidates ? grabCandidates->size() : 0) << '\n';
|
||||
std::cout << "Staged item Item_Grab planned actions: " <<
|
||||
(grabActions ? grabActions->size() : 0) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
const auto usecodePath = remorse::resolveGameDataPath(*gameDataRoot, std::filesystem::path("USECODE") / "EUSECODE.FLX");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue