- Implemented palette loading from binary files in `palette.cpp`. - Added runtime utilities for reading text and JSON files in `runtime.cpp`. - Created shape archive handling in `shape_archive.cpp`, including frame parsing and pixel decoding. - Introduced type flag loading functionality in `type_flags.cpp`. - Developed tests for combat tactics, entity dispatch entries, file system operations, fixed maps, flex archives, glob archives, map rendering, palette loading, shape archives, and type flags. - Added a Python script for importing Ghidra-exported function slices with reporting capabilities.
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#include "remorse/entity_dispatch_entry.h"
|
|
|
|
namespace remorse {
|
|
|
|
namespace {
|
|
constexpr u16 sourceItemOffset = 0x04;
|
|
constexpr u16 eventTypeOffset = 0x06;
|
|
constexpr u16 groupIdOffset = 0x08;
|
|
|
|
void writeLe16(EntityDispatchEntryBase& entry, u16 offset, u16 value)
|
|
{
|
|
entry.bytes[offset] = static_cast<u8>(value & 0xff);
|
|
entry.bytes[offset + 1] = static_cast<u8>(value >> 8);
|
|
}
|
|
}
|
|
|
|
EntityDispatchEntryBase* EntityDispatchEntry::initBase(EntityDispatchEntryBase* entry)
|
|
{
|
|
if (entry == nullptr) {
|
|
return nullptr;
|
|
}
|
|
|
|
for (u8& byte : entry->bytes) {
|
|
byte = 0;
|
|
}
|
|
return entry;
|
|
}
|
|
|
|
void EntityDispatchEntry::setGroupId(EntityDispatchEntryBase& entry, u8 groupId)
|
|
{
|
|
entry.bytes[groupIdOffset] = static_cast<u8>((entry.bytes[groupIdOffset] & 0xe0) | (groupId & 0x1f));
|
|
}
|
|
|
|
void EntityDispatchEntry::incrementGroupId(EntityDispatchEntryBase& entry)
|
|
{
|
|
++entry.bytes[groupIdOffset];
|
|
}
|
|
|
|
void EntityDispatchEntry::setSourceType(EntityDispatchEntryBase& entry, u16 sourceType)
|
|
{
|
|
writeLe16(entry, sourceItemOffset, sourceType);
|
|
}
|
|
|
|
void EntityDispatchEntry::setEventTypeChecked(EntityDispatchEntryBase& entry, u16 eventType)
|
|
{
|
|
writeLe16(entry, eventTypeOffset, eventType);
|
|
}
|
|
|
|
} // namespace remorse
|