mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-14 21:45:16 -05:00
5dda5762ba
subrepo: subdir: "ZAPDTR" merged: "a53a53ea4" upstream: origin: "https://github.com/HarbourMasters/ZAPDTR.git" branch: "master" commit: "a53a53ea4" git-subrepo: version: "0.4.1" origin: "???" commit: "???"
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
#include "ZRoomCommand.h"
|
|
|
|
#include "Utils/BitConverter.h"
|
|
#include "Utils/StringHelper.h"
|
|
#include "ZRoom.h"
|
|
|
|
ZRoomCommand::ZRoomCommand(ZFile* nParent) : ZResource(nParent)
|
|
{
|
|
}
|
|
|
|
void ZRoomCommand::ExtractCommandFromRoom(ZRoom* nZRoom, uint32_t nRawDataIndex)
|
|
{
|
|
zRoom = nZRoom;
|
|
rawDataIndex = nRawDataIndex;
|
|
|
|
ParseRawData();
|
|
}
|
|
|
|
void ZRoomCommand::ParseRawData()
|
|
{
|
|
auto& parentRawData = parent->GetRawData();
|
|
cmdID = static_cast<RoomCommand>(parentRawData.at(rawDataIndex));
|
|
cmdAddress = rawDataIndex;
|
|
|
|
cmdArg1 = parentRawData.at(rawDataIndex + 1);
|
|
cmdArg2 = BitConverter::ToUInt32BE(parentRawData, rawDataIndex + 4);
|
|
segmentOffset = Seg2Filespace(cmdArg2, parent->baseAddress);
|
|
}
|
|
|
|
RoomCommand ZRoomCommand::GetRoomCommand() const
|
|
{
|
|
return RoomCommand::Error;
|
|
}
|
|
|
|
size_t ZRoomCommand::GetRawDataSize() const
|
|
{
|
|
return 0x08;
|
|
}
|
|
|
|
std::string ZRoomCommand::GetSourceTypeName() const
|
|
{
|
|
return GetCommandCName();
|
|
}
|
|
|
|
ZResourceType ZRoomCommand::GetResourceType() const
|
|
{
|
|
return ZResourceType::RoomCommand;
|
|
}
|
|
|
|
std::string ZRoomCommand::GetCommandCName() const
|
|
{
|
|
return "SceneCmd";
|
|
}
|
|
|
|
std::string ZRoomCommand::GetCommandHex() const
|
|
{
|
|
return StringHelper::Sprintf("0x%02X", static_cast<uint8_t>(cmdID));
|
|
}
|