mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 13:23:45 -07:00
git subrepo clone https://github.com/HarbourMasters/ZAPDTR.git
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: "???"
This commit is contained in:
parent
f52a2a6406
commit
5dda5762ba
217 changed files with 47152 additions and 0 deletions
65
ZAPDTR/ZAPD/ZRoom/Commands/SetPathways.cpp
Normal file
65
ZAPDTR/ZAPD/ZRoom/Commands/SetPathways.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
#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->GetDeclarationSizeFromNeighbor(segmentOffset) / 8;
|
||||
pathwayList.SetNumPaths(numPaths);
|
||||
}
|
||||
|
||||
if (Globals::Instance->otrMode)
|
||||
{
|
||||
auto zPath = (ZPath*)parent->FindResource(segmentOffset);
|
||||
|
||||
if (zPath != nullptr)
|
||||
pathwayList = *zPath;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue