Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PlasMOUL/Key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ MOUL::Location::Location(int prefix, int page, uint16_t flags)
: m_flags(flags)
{
if (prefix < 0)
m_sequence = (page & 0xFFFF) - (prefix << 16) + 0xFF000001;
m_sequence = ((-prefix << 16) + (page & 0xFFFF)) + 0xFF000001;
else
m_sequence = (page & 0xFFFF) + (prefix << 16) + 33;
m_sequence = (prefix << 16) + (page & 0xFFFF) + 33;
}

void MOUL::Location::read(DS::Stream* stream)
Expand Down
2 changes: 1 addition & 1 deletion Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.9
GIT_TAG v2.13.10
)
FetchContent_MakeAvailable(Catch2)

Expand Down
12 changes: 12 additions & 0 deletions Tests/Test_Location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,17 @@ TEST_CASE("Test MOUL::Location", "[location]")
CHECK_SEQUENCE(MOUL::Location(1, -34, 0), 0x0001FFFF);
CHECK_SEQUENCE(MOUL::Location(-255, 65535, 0), 0x00000000);
CHECK_SEQUENCE(MOUL::Location(-255, -2, 0), 0xFFFFFFFF);

// Examples from real PRPs
CHECK_SEQUENCE(MOUL::Location(6, 1, 0), 0x00060022); // city:canyon
CHECK_SEQUENCE(MOUL::Location(6, 101, 0), 0x00060086); // city:museumDoor
CHECK_SEQUENCE(MOUL::Location(6, -2, 0), 0x0007001F); // city:BuiltIn
CHECK_SEQUENCE(MOUL::Location(6, -1, 0), 0x00070020); // city:Textures
CHECK_SEQUENCE(MOUL::Location(1234, 5, 0), 0x04D20026); // GoMePubNew:Entry
CHECK_SEQUENCE(MOUL::Location(40004, 1, 0), 0x9C440022); // VeeTsah:Temple
CHECK_SEQUENCE(MOUL::Location(40004, -1, 0), 0x9C450020); // VeeTsah:Textures
CHECK_SEQUENCE(MOUL::Location(-1, 8, 0), 0xFF010009); // GlobalAnimations:MaileIdle
CHECK_SEQUENCE(MOUL::Location(-1, 435, 0), 0xFF0101B4); // GlobalAnimations:FemaleSwimDockExit
CHECK_SEQUENCE(MOUL::Location(-6, 3, 0), 0xFF060004); // GlobalAvatars:Audio
}
}