Files
oot/tools/ZAPD/ZAPD/ZRoom/ZRoomCommand.cpp
T
Anghelo Carvajal 515ebdce9d ZAPD update: libpng, zroom improvements and others (#811)
* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "769f5702a"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "769f5702a"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Add `libpng` to readme

* Remove `-ifp` since it doesn't exists anymore in ZAPD

* Remove extra print I added

* Add UNK_09 macro and other minor fixes

* Simplify PNG rules

* simplify gitignore

* Update README.md

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* Update dockerfile

* basic instructions for cygwin and mac

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "86160be69"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "86160be69"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Change nanoseconds to seconds in extract_assets.py

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
2021-05-30 11:09:59 -04:00

57 lines
1.1 KiB
C++

#include "ZRoomCommand.h"
#include "BitConverter.h"
#include "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 = GETSEGOFFSET(cmdArg2);
}
void ZRoomCommand::ParseRawDataLate()
{
}
void ZRoomCommand::DeclareReferencesLate(const std::string& prefix)
{
}
std::string ZRoomCommand::GetCommandCName() const
{
return "SCmdBase";
}
ZResourceType ZRoomCommand::GetResourceType() const
{
return ZResourceType::RoomCommand;
}
size_t ZRoomCommand::GetRawDataSize() const
{
return 0x08;
}
std::string ZRoomCommand::GetCommandHex() const
{
return StringHelper::Sprintf("0x%02X", static_cast<uint8_t>(cmdID));
}