- Implemented collision tests to verify overlap and movement logic for collision bodies. - Enhanced entity dispatch entry tests to cover initialization, group ID management, and process handling. - Expanded file system tests to include crash diagnostics and ensure proper game data root detection. - Created isometric controls tests to validate movement requests and screen projection calculations. - Added map renderer tests to check fixed map loading and rendering functionality. - Introduced map sorter tests to confirm correct rendering order for various items.
54 lines
No EOL
2.7 KiB
C++
54 lines
No EOL
2.7 KiB
C++
#include "remorse/isometric_controls.h"
|
|
#include "remorse/map_renderer.h"
|
|
|
|
#include <cassert>
|
|
|
|
int main()
|
|
{
|
|
assert(remorse::controllerWalkRequested(0));
|
|
assert(!remorse::controllerWalkRequested(0x01));
|
|
assert(!remorse::controllerWalkRequested(0x02));
|
|
assert(!remorse::controllerWalkRequested(0x40));
|
|
assert(remorse::controllerWalkRequested(0x41));
|
|
assert(remorse::controllerWalkRequested(0x42));
|
|
constexpr remorse::s32 originX = 1024;
|
|
constexpr remorse::s32 originY = 2048;
|
|
const remorse::ScreenPoint origin = remorse::projectToScreen({originX, originY, 0});
|
|
|
|
const auto east = remorse::worldPositionAtScreenOffset(originX, originY, 1.0, 0.0);
|
|
const remorse::ScreenPoint eastProjection = remorse::projectToScreen({
|
|
static_cast<remorse::s32>(east.x), static_cast<remorse::s32>(east.y), 0});
|
|
assert(eastProjection.x - origin.x == 1);
|
|
assert(eastProjection.y - origin.y == 0);
|
|
|
|
const auto north = remorse::worldPositionAtScreenOffset(originX, originY, 0.0, -1.0);
|
|
const remorse::ScreenPoint northProjection = remorse::projectToScreen({
|
|
static_cast<remorse::s32>(north.x), static_cast<remorse::s32>(north.y), 0});
|
|
assert(northProjection.x - origin.x == 0);
|
|
assert(northProjection.y - origin.y == -1);
|
|
|
|
const auto west = remorse::worldPositionAtScreenOffset(originX, originY, -1.0, 0.0);
|
|
const remorse::ScreenPoint westProjection = remorse::projectToScreen({
|
|
static_cast<remorse::s32>(west.x), static_cast<remorse::s32>(west.y), 0});
|
|
assert(westProjection.x - origin.x == -1);
|
|
assert(westProjection.y - origin.y == 0);
|
|
|
|
const auto south = remorse::worldPositionAtScreenOffset(originX, originY, 0.0, 1.0);
|
|
const remorse::ScreenPoint southProjection = remorse::projectToScreen({
|
|
static_cast<remorse::s32>(south.x), static_cast<remorse::s32>(south.y), 0});
|
|
assert(southProjection.x - origin.x == 0);
|
|
assert(southProjection.y - origin.y == 1);
|
|
remorse::AnimationFrameMetadata forwardFrame{};
|
|
forwardFrame.bytes[4] = 6;
|
|
const auto forward = remorse::hostMovementStep(forwardFrame, 6, false);
|
|
assert(forward && forward->x > 0 && forward->y > 0);
|
|
remorse::AnimationFrameMetadata reverseFrame{};
|
|
reverseFrame.bytes[4] = 0xfe;
|
|
reverseFrame.bytes[5] = 3;
|
|
const auto authoredReverse = remorse::decodeAnimationDisplacement(reverseFrame, 6, false);
|
|
const auto hostReverse = remorse::hostMovementStep(reverseFrame, 6, false);
|
|
assert(authoredReverse && authoredReverse->x < 0 && authoredReverse->y < 0);
|
|
assert(hostReverse && hostReverse->x == 0 && hostReverse->y == 0);
|
|
assert(hostReverse->z == authoredReverse->z && hostReverse->onGround == authoredReverse->onGround);
|
|
return 0;
|
|
} |