Shipwright/ZAPDTR/ZAPD/ZRoom/Commands/SetRoomBehavior.cpp
M4xw 5dda5762ba 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:   "???"
2022-03-22 02:54:48 +01:00

51 lines
1.5 KiB
C++

#include "SetRoomBehavior.h"
#include "Globals.h"
#include "Utils/BitConverter.h"
#include "Utils/StringHelper.h"
SetRoomBehavior::SetRoomBehavior(ZFile* nParent) : ZRoomCommand(nParent)
{
}
void SetRoomBehavior::ParseRawData()
{
ZRoomCommand::ParseRawData();
gameplayFlags = cmdArg1;
gameplayFlags2 = BitConverter::ToInt32BE(parent->GetRawData(), rawDataIndex + 0x04);
currRoomUnk2 = gameplayFlags2 & 0xFF;
currRoomUnk5 = showInvisActors = (gameplayFlags2 >> 8) & 1;
msgCtxUnk = (gameplayFlags2 >> 10) & 1;
enablePosLights = (gameplayFlags2 >> 11) & 1;
kankyoContextUnkE2 = (gameplayFlags2 >> 12) & 1;
}
std::string SetRoomBehavior::GetBodySourceCode() const
{
if (Globals::Instance->game == ZGame::MM_RETAIL)
{
std::string enableLights = StringHelper::BoolStr(enablePosLights);
return StringHelper::Sprintf("SCENE_CMD_ROOM_BEHAVIOR(0x%02X, 0x%02X, %i, %i, %s, %i)",
gameplayFlags, currRoomUnk2, currRoomUnk5, msgCtxUnk,
enableLights.c_str(), kankyoContextUnkE2);
}
std::string showInvisible = StringHelper::BoolStr(showInvisActors);
std::string disableWarps = StringHelper::BoolStr(msgCtxUnk);
return StringHelper::Sprintf("SCENE_CMD_ROOM_BEHAVIOR(0x%02X, 0x%02X, %s, %s)", gameplayFlags,
currRoomUnk2, showInvisible.c_str(), disableWarps.c_str());
}
std::string SetRoomBehavior::GetCommandCName() const
{
return "SCmdRoomBehavior";
}
RoomCommand SetRoomBehavior::GetRoomCommand() const
{
return RoomCommand::SetRoomBehavior;
}