mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
f31a841789
* git subrepo clone --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/ subrepo: subdir: "ZAPDTR" merged: "6aa54a551" upstream: origin: "C:/ZeldaStuff/ZAPDTR" branch: "rebase2" commit: "6aa54a551" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * git subrepo clone --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/ subrepo: subdir: "ZAPDTR" merged: "88b012240" upstream: origin: "C:/ZeldaStuff/ZAPDTR" branch: "rebase2" commit: "88b012240" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Update (its broken) * fix the enum * git subrepo push --remote=C:/ZeldaStuff/ZAPDTR/ ZAPDTR subrepo: subdir: "ZAPDTR" merged: "b7b6e1c82" upstream: origin: "C:/ZeldaStuff/ZAPDTR/" branch: "rebase2" commit: "b7b6e1c82" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * New names for LUS actions * git subrepo push --remote=C:/ZeldaStuff/ZAPDTR/ ZAPDTR subrepo: subdir: "ZAPDTR" merged: "c5cfebeee" upstream: origin: "C:/ZeldaStuff/ZAPDTR/" branch: "rebase2" commit: "c5cfebeee" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * git subrepo clone (merge) --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/ subrepo: subdir: "ZAPDTR" merged: "d5f4769b8" upstream: origin: "C:/ZeldaStuff/ZAPDTR" branch: "rebase2" commit: "d5f4769b8" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Fix missing commands in the exporter. * Cleanups. * git subrepo pull --force --remote=https://github.com/harbourmasters/ZAPDTR --branch=master ZAPDTR subrepo: subdir: "ZAPDTR" merged: "d4c35b90a" upstream: origin: "https://github.com/harbourmasters/ZAPDTR" branch: "master" commit: "d4c35b90a" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Add unordered_map include to fix MacOS * fix string_view * Update Main.cpp * fix string view * So close I can almost taste it * So close * Fix missed git marker. * Fix surface types and * Update ZFile.cpp * Delete Jenkinsfile --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
108 lines
3.3 KiB
C++
108 lines
3.3 KiB
C++
#include "SetLightingSettings.h"
|
|
|
|
#include "Globals.h"
|
|
#include "Utils/BitConverter.h"
|
|
#include "Utils/StringHelper.h"
|
|
#include "ZFile.h"
|
|
#include "ZRoom/ZRoom.h"
|
|
|
|
SetLightingSettings::SetLightingSettings(ZFile* nParent) : ZRoomCommand(nParent)
|
|
{
|
|
}
|
|
|
|
void SetLightingSettings::ParseRawData()
|
|
{
|
|
ZRoomCommand::ParseRawData();
|
|
uint8_t numLights = cmdArg1;
|
|
|
|
settings.reserve(numLights);
|
|
for (int i = 0; i < numLights; i++)
|
|
settings.push_back(LightingSettings(parent->GetRawData(), segmentOffset + (i * 22)));
|
|
}
|
|
|
|
void SetLightingSettings::DeclareReferences(const std::string& prefix)
|
|
{
|
|
if (settings.size() > 0)
|
|
{
|
|
std::string declaration;
|
|
|
|
for (size_t i = 0; i < settings.size(); i++)
|
|
{
|
|
declaration +=
|
|
StringHelper::Sprintf("\t{ %s },", settings.at(i).GetBodySourceCode().c_str());
|
|
if (i + 1 < settings.size())
|
|
declaration += "\n";
|
|
}
|
|
|
|
parent->AddDeclarationArray(
|
|
segmentOffset, DeclarationAlignment::Align4,
|
|
settings.size() * settings.front().GetRawDataSize(), "LightSettings",
|
|
StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset),
|
|
settings.size(), declaration);
|
|
}
|
|
}
|
|
|
|
std::string SetLightingSettings::GetBodySourceCode() const
|
|
{
|
|
std::string listName;
|
|
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "LightSettings", listName,
|
|
parent->workerID);
|
|
return StringHelper::Sprintf("SCENE_CMD_ENV_LIGHT_SETTINGS(%i, %s)", settings.size(),
|
|
listName.c_str());
|
|
}
|
|
|
|
std::string SetLightingSettings::GetCommandCName() const
|
|
{
|
|
return "SCmdLightSettingList";
|
|
}
|
|
|
|
RoomCommand SetLightingSettings::GetRoomCommand() const
|
|
{
|
|
return RoomCommand::SetLightingSettings;
|
|
}
|
|
|
|
LightingSettings::LightingSettings(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
|
{
|
|
ambientClrR = rawData.at(rawDataIndex + 0);
|
|
ambientClrG = rawData.at(rawDataIndex + 1);
|
|
ambientClrB = rawData.at(rawDataIndex + 2);
|
|
|
|
diffuseClrA_R = rawData.at(rawDataIndex + 3);
|
|
diffuseClrA_G = rawData.at(rawDataIndex + 4);
|
|
diffuseClrA_B = rawData.at(rawDataIndex + 5);
|
|
|
|
diffuseDirA_X = rawData.at(rawDataIndex + 6);
|
|
diffuseDirA_Y = rawData.at(rawDataIndex + 7);
|
|
diffuseDirA_Z = rawData.at(rawDataIndex + 8);
|
|
|
|
diffuseClrB_R = rawData.at(rawDataIndex + 9);
|
|
diffuseClrB_G = rawData.at(rawDataIndex + 10);
|
|
diffuseClrB_B = rawData.at(rawDataIndex + 11);
|
|
|
|
diffuseDirB_X = rawData.at(rawDataIndex + 12);
|
|
diffuseDirB_Y = rawData.at(rawDataIndex + 13);
|
|
diffuseDirB_Z = rawData.at(rawDataIndex + 14);
|
|
|
|
fogClrR = rawData.at(rawDataIndex + 15);
|
|
fogClrG = rawData.at(rawDataIndex + 16);
|
|
fogClrB = rawData.at(rawDataIndex + 17);
|
|
|
|
unk = BitConverter::ToInt16BE(rawData, rawDataIndex + 18);
|
|
drawDistance = BitConverter::ToInt16BE(rawData, rawDataIndex + 20);
|
|
}
|
|
|
|
std::string LightingSettings::GetBodySourceCode() const
|
|
{
|
|
return StringHelper::Sprintf(
|
|
"0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, "
|
|
"0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%04X, 0x%04X",
|
|
ambientClrR, ambientClrG, ambientClrB, diffuseClrA_R, diffuseClrA_G, diffuseClrA_B,
|
|
diffuseDirA_X, diffuseDirA_Y, diffuseDirA_Z, diffuseClrB_R, diffuseClrB_G, diffuseClrB_B,
|
|
diffuseDirB_X, diffuseDirB_Y, diffuseDirB_Z, fogClrR, fogClrG, fogClrB, unk, drawDistance);
|
|
}
|
|
|
|
size_t LightingSettings::GetRawDataSize() const
|
|
{
|
|
return 0x16;
|
|
}
|