Fix Script Indenting and GeoLayout BranchAndLink to NULL (#139)

This commit is contained in:
inspectredc
2024-06-14 07:12:39 -06:00
committed by GitHub
parent aa95f29be7
commit 61a6215762
3 changed files with 15 additions and 6 deletions
+4 -2
View File
@@ -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 << "(";
+7 -2
View File
@@ -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;
+4 -2
View File
@@ -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 << "(";