Add extensive tests for animation, input handling, and map rendering

- Enhanced animation archive tests to validate frame metadata and start frame selection logic.
- Introduced new tests for entity dispatch entry handling, including key event queuing and processing.
- Added tests for fixed map item interactions, including glob egg hatching and item movement.
- Expanded flex archive tests to cover teleport egg spawning and usecode event selection.
- Implemented isometric controls tests to verify directional key handling and animation state changes.
- Improved map renderer tests to ensure correct rendering of map previews and collision detection.
This commit is contained in:
Maddo 2026-09-27 11:48:14 +02:00
commit e757bb33d0
20 changed files with 1247 additions and 142 deletions

View file

@ -1,6 +1,7 @@
#include "remorse/entity_dispatch_entry.h"
#include "remorse/file_system.h"
#include "remorse/fixed_map.h"
#include "remorse/glob_archive.h"
#include "remorse/map_renderer.h"
#include "remorse/type_flags.h"
@ -235,6 +236,24 @@ int main()
assert(allocatedItems.allocateItem(newItem) == 0x107);
newItem.data.x = 0x8000;
assert(!allocatedItems.allocateItem(newItem) && !allocatedItems.findItem(0x108));
remorse::StagedFixedMapItem globEgg;
globEgg.itemNumber = 0x100;
globEgg.data.x = 0x403;
globEgg.data.y = 0x601;
globEgg.data.z = 12;
globEgg.data.shape = 3;
globEgg.data.quality = 7;
remorse::LiveFixedMapItems hatchedItems({globEgg});
std::vector<remorse::ShapeTypeInfo> globShapes(4);
globShapes[3].family = 3;
remorse::GlobObject glob{7, {{2, 5, 3, 1, 2}}};
const auto childIds = hatchedItems.hatchGlobEgg(0x100, glob, globShapes);
assert(childIds && *childIds == std::vector<remorse::u16>{0x101});
const auto* child = hatchedItems.findItem(0x101);
assert(child && child->recordIndex == static_cast<std::size_t>(-1));
assert(child->data.x == 0x405 && child->data.y == 0x60b && child->data.z == 15);
assert(child->data.flags == 0x82 && child->data.frame == 2);
assert(hatchedItems.isGlobHatched(0x100) && !hatchedItems.hatchGlobEgg(0x100, glob, globShapes));
remorse::LiveFixedMapItems movingItems(blockItems);
remorse::ProcessKernel movingKernel;
remorse::u16 movingGroups[32]{};
@ -266,7 +285,18 @@ int main()
candidate.itemNumber = 0;
assert(remorse::classifyItemFindZMatch(origin, originShape, candidate, footprint, 3) == 0);
assert(cachedItems->front().recordIndex < retailMap->entries.size());
const remorse::LiveFixedMapItems retailLiveItems(*cachedItems);
remorse::LiveFixedMapItems retailLiveItems(*cachedItems);
assert(!retailLiveItems.findItem(1));
assert(retailLiveItems.initializeAvatar());
assert(!retailLiveItems.initializeAvatar());
assert(retailLiveItems.findItem(1)->data.shape == 1);
assert(retailLiveItems.findItem(1)->data.frame == 0);
assert(retailLiveItems.findItem(1)->data.npcNumber == 1);
assert(retailLiveItems.teleportAvatar(cachedItems->front(), 1));
assert(retailLiveItems.findItem(1)->data.x == cachedItems->front().data.x);
assert(retailLiveItems.findItem(1)->data.mapNumber == 1);
assert(retailLiveItems.moveItem(1, 100, 200, 5));
assert(retailLiveItems.findItem(1)->data.x == 100 && retailLiveItems.findItem(1)->data.y == 200);
assert(retailLiveItems.findItem(cachedItems->front().itemNumber)->recordIndex ==
cachedItems->front().recordIndex);
for (const auto& item : *cachedItems) {