summaryrefslogtreecommitdiff
path: root/src/factories/LightsFactory.cpp
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2026-03-23 21:23:59 -0600
committerKiritoDv <kiritodev01@gmail.com>2026-03-23 21:23:59 -0600
commit75f64161cb4addcbc6e29732df8d9b519a62c43f (patch)
tree92e2b17bd8c41af42bdf24a6eb4b7b08b90254f6 /src/factories/LightsFactory.cpp
parent654b451ddc6cf25db201b2c858948f430784cc5f (diff)
Implemented clang-format
Diffstat (limited to 'src/factories/LightsFactory.cpp')
-rw-r--r--src/factories/LightsFactory.cpp58
1 files changed, 30 insertions, 28 deletions
diff --git a/src/factories/LightsFactory.cpp b/src/factories/LightsFactory.cpp
index cb5d9b5..6b21643 100644
--- a/src/factories/LightsFactory.cpp
+++ b/src/factories/LightsFactory.cpp
@@ -4,10 +4,11 @@
#include "spdlog/spdlog.h"
#include "Companion.h"
-ExportResult LightsHeaderExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement) {
+ExportResult LightsHeaderExporter::Export(std::ostream& write, std::shared_ptr<IParsedData> raw, std::string& entryName,
+ YAML::Node& node, std::string* replacement) {
const auto symbol = GetSafeNode(node, "symbol", entryName);
- if(Companion::Instance->IsOTRMode()){
+ if (Companion::Instance->IsOTRMode()) {
write << "static const ALIGN_ASSET(2) char " << symbol << "[] = \"__OTR__" << (*replacement) << "\";\n\n";
return std::nullopt;
}
@@ -15,10 +16,10 @@ ExportResult LightsHeaderExporter::Export(std::ostream &write, std::shared_ptr<I
const auto offset = GetSafeNode<uint32_t>(node, "offset");
const auto searchTable = Companion::Instance->SearchTable(offset);
- if(searchTable.has_value()){
+ if (searchTable.has_value()) {
const auto [name, start, end, mode, index_size] = searchTable.value();
- if(start != offset){
+ if (start != offset) {
return std::nullopt;
}
@@ -29,34 +30,34 @@ ExportResult LightsHeaderExporter::Export(std::ostream &write, std::shared_ptr<I
return std::nullopt;
}
-ExportResult LightsCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
+ExportResult LightsCodeExporter::Export(std::ostream& write, std::shared_ptr<IParsedData> raw, std::string& entryName,
+ YAML::Node& node, std::string* replacement) {
auto light = std::static_pointer_cast<LightsData>(raw)->mLights;
auto symbol = GetSafeNode(node, "symbol", entryName);
const auto offset = GetSafeNode<uint32_t>(node, "offset");
const auto searchTable = Companion::Instance->SearchTable(offset);
- if(searchTable.has_value()){
+ if (searchTable.has_value()) {
const auto [name, start, end, mode, index_size] = searchTable.value();
-
- if(start == offset){
+ if (start == offset) {
write << "Lights1 " << name << "[] = {\n";
}
// Ambient
- auto r = (int16_t) light.a.l.col[0];
- auto g = (int16_t) light.a.l.col[1];
- auto b = (int16_t) light.a.l.col[2];
+ auto r = (int16_t)light.a.l.col[0];
+ auto g = (int16_t)light.a.l.col[1];
+ auto b = (int16_t)light.a.l.col[2];
// Diffuse
- auto r2 = (int16_t) light.l[0].l.col[0];
- auto g2 = (int16_t) light.l[0].l.col[1];
- auto b2 = (int16_t) light.l[0].l.col[2];
+ auto r2 = (int16_t)light.l[0].l.col[0];
+ auto g2 = (int16_t)light.l[0].l.col[1];
+ auto b2 = (int16_t)light.l[0].l.col[2];
// Direction
- auto x = (int16_t) light.l[0].l.dir[0];
- auto y = (int16_t) light.l[0].l.dir[1];
- auto z = (int16_t) light.l[0].l.dir[2];
+ auto x = (int16_t)light.l[0].l.dir[0];
+ auto y = (int16_t)light.l[0].l.dir[1];
+ auto z = (int16_t)light.l[0].l.dir[2];
SPDLOG_INFO("Read light: {:X} {:X} {:X} {:X} {:X}", r, g, b, r2, g2);
@@ -77,19 +78,19 @@ ExportResult LightsCodeExporter::Export(std::ostream &write, std::shared_ptr<IPa
write << "Lights1 " << symbol << " = gdSPDefLights1(\n";
// Ambient
- auto r = (int16_t) light.a.l.col[0];
- auto g = (int16_t) light.a.l.col[1];
- auto b = (int16_t) light.a.l.col[2];
+ auto r = (int16_t)light.a.l.col[0];
+ auto g = (int16_t)light.a.l.col[1];
+ auto b = (int16_t)light.a.l.col[2];
// Diffuse
- auto r2 = (int16_t) light.l[0].l.col[0];
- auto g2 = (int16_t) light.l[0].l.col[1];
- auto b2 = (int16_t) light.l[0].l.col[2];
+ auto r2 = (int16_t)light.l[0].l.col[0];
+ auto g2 = (int16_t)light.l[0].l.col[1];
+ auto b2 = (int16_t)light.l[0].l.col[2];
// Direction
- auto x = (int16_t) light.l[0].l.dir[0];
- auto y = (int16_t) light.l[0].l.dir[1];
- auto z = (int16_t) light.l[0].l.dir[2];
+ auto x = (int16_t)light.l[0].l.dir[0];
+ auto y = (int16_t)light.l[0].l.dir[1];
+ auto z = (int16_t)light.l[0].l.dir[2];
SPDLOG_INFO("Read light: {:X} {:X} {:X} {:X} {:X}", r, g, b, r2, g2);
@@ -103,7 +104,8 @@ ExportResult LightsCodeExporter::Export(std::ostream &write, std::shared_ptr<IPa
return std::nullopt;
}
-ExportResult LightsBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
+ExportResult LightsBinaryExporter::Export(std::ostream& write, std::shared_ptr<IParsedData> raw, std::string& entryName,
+ YAML::Node& node, std::string* replacement) {
auto light = std::static_pointer_cast<LightsData>(raw)->mLights;
auto writer = LUS::BinaryWriter();
WriteHeader(writer, Torch::ResourceType::Lights, 0);
@@ -118,6 +120,6 @@ std::optional<std::shared_ptr<IParsedData>> LightsFactory::parse(std::vector<uin
auto [_, segment] = Decompressor::AutoDecode(node, buffer);
LUS::BinaryReader reader(segment.data, sizeof(Lights1Raw));
Lights1Raw lights;
- reader.Read((char*) &lights, sizeof(Lights1Raw));
+ reader.Read((char*)&lights, sizeof(Lights1Raw));
return std::make_shared<LightsData>(lights);
}