Files
mm/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp
T
Tom Overton bbfbc4073e Update ZAPD subrepo (#1338)
* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "cb0342425"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "cb0342425"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "110b9eb"

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "505024b33"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "505024b33"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "110b9eb"

* Disable Wno-hardcoded-pointer for `make assets`
2023-07-28 18:20:12 -04:00

58 lines
1.4 KiB
C++

#include "SetPathways.h"
#include "Globals.h"
#include "Utils/BitConverter.h"
#include "Utils/StringHelper.h"
#include "ZFile.h"
#include "ZRoom/ZRoom.h"
SetPathways::SetPathways(ZFile* nParent) : ZRoomCommand(nParent), pathwayList(nParent)
{
}
void SetPathways::DeclareReferences([[maybe_unused]] const std::string& prefix)
{
if (segmentOffset != 0)
{
std::string varName =
StringHelper::Sprintf("%sPathway_%06X", prefix.c_str(), segmentOffset);
parent->AddDeclarationPlaceholder(segmentOffset, varName);
}
}
void SetPathways::ParseRawDataLate()
{
if (Globals::Instance->game == ZGame::MM_RETAIL)
{
auto numPaths = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 8;
pathwayList.SetNumPaths(numPaths);
}
pathwayList.ExtractFromFile(segmentOffset);
}
void SetPathways::DeclareReferencesLate(const std::string& prefix)
{
std::string varName = StringHelper::Sprintf("%sPathway_%06X", prefix.c_str(), segmentOffset);
pathwayList.SetName(varName);
pathwayList.DeclareReferences(prefix);
pathwayList.GetSourceOutputCode(prefix);
}
std::string SetPathways::GetBodySourceCode() const
{
std::string listName;
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "Path", listName);
return StringHelper::Sprintf("SCENE_CMD_PATH_LIST(%s)", listName.c_str());
}
std::string SetPathways::GetCommandCName() const
{
return "SCmdPathList";
}
RoomCommand SetPathways::GetRoomCommand() const
{
return RoomCommand::SetPathways;
}