mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Fix Script Indenting and GeoLayout BranchAndLink to NULL (#139)
This commit is contained in:
@@ -29,14 +29,16 @@ ExportResult SM64::BehaviorScriptCodeExporter::Export(std::ostream &write, std::
|
||||
for(auto& [opcode, arguments] : commands) {
|
||||
bool commaFlag = false;
|
||||
|
||||
if (opcode == BehaviorOpcode::END_LOOP || opcode == BehaviorOpcode::END_REPEAT || opcode == BehaviorOpcode::END_REPEAT_CONTINUE) {
|
||||
--indentCount;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < indentCount; ++i) {
|
||||
write << fourSpaceTab;
|
||||
}
|
||||
|
||||
if (opcode == BehaviorOpcode::BEGIN_LOOP || opcode == BehaviorOpcode::BEGIN_REPEAT) {
|
||||
++indentCount;
|
||||
} else if (opcode == BehaviorOpcode::END_LOOP || opcode == BehaviorOpcode::END_REPEAT || opcode == BehaviorOpcode::END_REPEAT_CONTINUE) {
|
||||
--indentCount;
|
||||
}
|
||||
|
||||
write << opcode << "(";
|
||||
|
||||
@@ -68,14 +68,16 @@ ExportResult SM64::GeoCodeExporter::Export(std::ostream&write, std::shared_ptr<I
|
||||
for(auto& [opcode, arguments] : cmds) {
|
||||
bool commaFlag = false;
|
||||
|
||||
if (opcode == GeoOpcode::OpenNode) {
|
||||
++indentCount;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < indentCount; ++i) {
|
||||
write << fourSpaceTab;
|
||||
}
|
||||
|
||||
if (opcode == GeoOpcode::CloseNode) {
|
||||
--indentCount;
|
||||
} else if (opcode == GeoOpcode::OpenNode) {
|
||||
++indentCount;
|
||||
}
|
||||
|
||||
write << opcode << "(";
|
||||
@@ -324,6 +326,9 @@ std::optional<std::shared_ptr<IParsedData>> SM64::GeoLayoutFactory::parse(std::v
|
||||
switch(opcode){
|
||||
case GeoOpcode::BranchAndLink: {
|
||||
auto ptr = cur_geo_cmd_u32(0x04);
|
||||
if (ptr == 0) {
|
||||
processing = false;
|
||||
}
|
||||
arguments.emplace_back(RegisterAutoGen(ptr, "SM64:GEO_LAYOUT"));
|
||||
|
||||
cmd += 0x08 << CMD_SIZE_SHIFT;
|
||||
|
||||
@@ -43,14 +43,16 @@ ExportResult SM64::LevelScriptCodeExporter::Export(std::ostream &write, std::sha
|
||||
for(auto& [opcode, arguments] : commands) {
|
||||
bool commaFlag = false;
|
||||
|
||||
if (opcode == LevelOpcode::END_AREA) {
|
||||
--indentCount;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < indentCount; ++i) {
|
||||
write << fourSpaceTab;
|
||||
}
|
||||
|
||||
if (opcode == LevelOpcode::AREA) {
|
||||
++indentCount;
|
||||
} else if (opcode == LevelOpcode::END_AREA) {
|
||||
--indentCount;
|
||||
}
|
||||
|
||||
write << opcode << "(";
|
||||
|
||||
Reference in New Issue
Block a user