From 717ae786632e3f3e5f32a12dc0ecd86958593a8b Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Fri, 20 Oct 2023 20:16:05 -0400 Subject: Fixes for new ZAPD (#8) * Fixes for new ZAPD * Vertex fix * remove MSVC Hack --------- Co-authored-by: Nicholas Estelami --- OTRExporter/CollisionExporter.cpp | 22 +-- OTRExporter/CutsceneExporter.cpp | 287 ++++++++++++++++++----------------- OTRExporter/DisplayListExporter.cpp | 19 +-- OTRExporter/RoomExporter.cpp | 24 +-- OTRExporter/RoomExporter.h | 4 +- OTRExporter/SkeletonLimbExporter.cpp | 42 ++--- extract_assets.py | 2 +- 7 files changed, 201 insertions(+), 199 deletions(-) diff --git a/OTRExporter/CollisionExporter.cpp b/OTRExporter/CollisionExporter.cpp index cbcdbb3..9c98197 100644 --- a/OTRExporter/CollisionExporter.cpp +++ b/OTRExporter/CollisionExporter.cpp @@ -38,26 +38,26 @@ void OTRExporter_Collision::Save(ZResource* res, const fs::path& outPath, Binary writer->Write(col->polygons[i].dist); } - writer->Write((uint32_t)col->PolygonTypes.size()); + writer->Write((uint32_t)col->polygonTypes.size()); - for (uint16_t i = 0; i < col->PolygonTypes.size(); i++) { - writer->Write(col->PolygonTypes[i].data[1]); - writer->Write(col->PolygonTypes[i].data[0]); + for (uint16_t i = 0; i < col->polygonTypes.size(); i++) { + writer->Write(col->polygonTypes[i].data[1]); + writer->Write(col->polygonTypes[i].data[0]); } writer->Write((uint32_t)col->camData->entries.size()); for (auto entry : col->camData->entries) { - auto camPosDecl = col->parent->GetDeclarationRanged(Seg2Filespace(entry->cameraPosDataSeg, col->parent->baseAddress)); + auto camPosDecl = col->parent->GetDeclarationRanged(Seg2Filespace(entry.cameraPosDataSeg, col->parent->baseAddress)); int idx = 0; if (camPosDecl != nullptr) - idx = ((entry->cameraPosDataSeg & 0x00FFFFFF) - camPosDecl->address) / 6; + idx = ((entry.cameraPosDataSeg & 0x00FFFFFF) - camPosDecl->address) / 6; - writer->Write(entry->cameraSType); - writer->Write(entry->numData); + writer->Write(entry.cameraSType); + writer->Write(entry.numData); writer->Write((uint32_t)idx); } @@ -65,9 +65,9 @@ void OTRExporter_Collision::Save(ZResource* res, const fs::path& outPath, Binary for (auto entry : col->camData->cameraPositionData) { - writer->Write(entry->x); - writer->Write(entry->y); - writer->Write(entry->z); + writer->Write(entry.x); + writer->Write(entry.y); + writer->Write(entry.z); } writer->Write((uint32_t)col->waterBoxes.size()); diff --git a/OTRExporter/CutsceneExporter.cpp b/OTRExporter/CutsceneExporter.cpp index 2194ce6..e30bd21 100644 --- a/OTRExporter/CutsceneExporter.cpp +++ b/OTRExporter/CutsceneExporter.cpp @@ -17,17 +17,17 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW { switch (cs->commands[i]->commandID) { - case (uint32_t)CutsceneCommands::SetCameraPos: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE: { - CutsceneCommandSetCameraPos* cmdCamPos = (CutsceneCommandSetCameraPos*)cs->commands[i]; + CutsceneOoTCommand_GenericCameraCmd* cmdCamPos = (CutsceneOoTCommand_GenericCameraCmd*)cs->commands[i]; writer->Write(CS_CMD_CAM_EYE); - writer->Write(CMD_HH(0x0001, ((CutsceneCommandSetCameraPos*)cs->commands[i])->startFrame)); + writer->Write(CMD_HH(0x0001, ((CutsceneOoTCommand_GenericCameraCmd*)cs->commands[i])->startFrame)); writer->Write(CMD_HH(cmdCamPos->endFrame, 0x0000)); for (const auto& e : cs->commands[i]->entries) { - CutsceneCameraPoint* point = (CutsceneCameraPoint*)e; + CutsceneOoTCommand_CameraPoint* point = (CutsceneOoTCommand_CameraPoint*)e; writer->Write(CMD_BBH(point->continueFlag, point->cameraRoll, point->nextPointFrame)); writer->Write(point->viewAngle); writer->Write(CMD_HH(point->posX, point->posY)); @@ -35,9 +35,9 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } } break; - case (uint32_t)CutsceneCommands::SetCameraFocus: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE: { - CutsceneCommandSetCameraPos* cmdCamPos = (CutsceneCommandSetCameraPos*)cs->commands[i]; + CutsceneOoTCommand_GenericCameraCmd* cmdCamPos = (CutsceneOoTCommand_GenericCameraCmd*)cs->commands[i]; writer->Write(CS_CMD_CAM_AT); writer->Write(CMD_HH(0x0001, cmdCamPos->startFrame)); @@ -45,7 +45,7 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW for (const auto& e : cs->commands[i]->entries) { - CutsceneCameraPoint* point = (CutsceneCameraPoint*)e; + CutsceneOoTCommand_CameraPoint* point = (CutsceneOoTCommand_CameraPoint*)e; writer->Write(CMD_BBH(point->continueFlag, point->cameraRoll, point->nextPointFrame)); writer->Write(point->viewAngle); writer->Write(CMD_HH(point->posX, point->posY)); @@ -53,13 +53,13 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case (uint32_t)CutsceneCommands::Misc: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_MISC: { writer->Write(CS_CMD_MISC); writer->Write((uint32_t)CMD_W((cs->commands[i])->entries.size())); for (const auto& e : cs->commands[i]->entries) //All in OOT seem to only have 1 entry { - CutsceneSubCommandEntry_GenericCmd* cmd = (CutsceneSubCommandEntry_GenericCmd*)e; + CutsceneOoTSubCommandEntry_GenericCmd* cmd = (CutsceneOoTSubCommandEntry_GenericCmd*)e; writer->Write(CMD_HH(cmd->base, cmd->startFrame)); writer->Write(CMD_HH(cmd->endFrame, cmd->pad)); writer->Write(CMD_W(cmd->unused1)); @@ -75,13 +75,13 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case (uint32_t)CutsceneCommands::SetLighting: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING: { writer->Write(CS_CMD_SET_LIGHTING); writer->Write((uint32_t)CMD_W((cs->commands[i])->entries.size())); for (const auto& e : cs->commands[i]->entries) { - CutsceneSubCommandEntry_GenericCmd* cmd = (CutsceneSubCommandEntry_GenericCmd*)e; + CutsceneOoTSubCommandEntry_GenericCmd* cmd = (CutsceneOoTSubCommandEntry_GenericCmd*)e; writer->Write(CMD_HH(cmd->base, cmd->startFrame)); writer->Write(CMD_HH(cmd->endFrame, cmd->pad)); writer->Write(CMD_W(cmd->unused1)); @@ -97,17 +97,17 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case (uint32_t)CutsceneCommands::SetCameraPosLink: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER: { - CutsceneCommandSetCameraPos* cmdCamPos = (CutsceneCommandSetCameraPos*)cs->commands[i]; + CutsceneOoTCommand_GenericCameraCmd* cmdCamPos = (CutsceneOoTCommand_GenericCameraCmd*)cs->commands[i]; writer->Write(CS_CMD_CAM_EYE_REL_TO_PLAYER); - writer->Write(CMD_HH(0x0001, ((CutsceneCommandSetCameraPos*)cs->commands[i])->startFrame)); + writer->Write(CMD_HH(0x0001, cmdCamPos->startFrame)); writer->Write(CMD_HH(cmdCamPos->endFrame, 0x0000)); for (const auto& e : cs->commands[i]->entries) { - CutsceneCameraPoint* point = (CutsceneCameraPoint*)e; + CutsceneOoTCommand_CameraPoint* point = (CutsceneOoTCommand_CameraPoint*)e; writer->Write(CMD_BBH(point->continueFlag, point->cameraRoll, point->nextPointFrame)); writer->Write(point->viewAngle); writer->Write(CMD_HH(point->posX, point->posY)); @@ -115,17 +115,17 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case (uint32_t)CutsceneCommands::SetCameraFocusLink: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER: { - CutsceneCommandSetCameraPos* cmdCamPos = (CutsceneCommandSetCameraPos*)cs->commands[i]; + CutsceneOoTCommand_GenericCameraCmd* cmdCamPos = (CutsceneOoTCommand_GenericCameraCmd*)cs->commands[i]; writer->Write(CS_CMD_CAM_AT_REL_TO_PLAYER); - writer->Write(CMD_HH(0x0001, ((CutsceneCommandSetCameraPos*)cs->commands[i])->startFrame)); + writer->Write(CMD_HH(0x0001, cmdCamPos->startFrame)); writer->Write(CMD_HH(cmdCamPos->endFrame, 0x0000)); for (const auto& e : cs->commands[i]->entries) { - CutsceneCameraPoint* point = (CutsceneCameraPoint*)e; + CutsceneOoTCommand_CameraPoint* point = (CutsceneOoTCommand_CameraPoint*)e; writer->Write(CMD_BBH(point->continueFlag, point->cameraRoll, point->nextPointFrame)); writer->Write(point->viewAngle); writer->Write(CMD_HH(point->posX, point->posY)); @@ -134,27 +134,27 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW break; } - case (uint32_t)CutsceneCommands::Cmd07: // Not used in OOT + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_EYE: // Not used in OOT break; - case (uint32_t)CutsceneCommands::Cmd08: // Not used in OOT + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT: // Not used in OOT break; - case (uint32_t)CutsceneCommands::Cmd09: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_RUMBLE_CONTROLLER: { writer->Write(CS_CMD_09); - writer->Write((uint32_t)CMD_W(((CutsceneCommand_Rumble*)cs->commands[i])->entries.size())); + writer->Write((uint32_t)CMD_W(((CutsceneOoTCommand_Rumble*)cs->commands[i])->entries.size())); for (const auto& e : cs->commands[i]->entries) { - CutsceneSubCommandEntry_Rumble* r = (CutsceneSubCommandEntry_Rumble*)e; + CutsceneOoTSubCommandEntry_Rumble* r = (CutsceneOoTSubCommandEntry_Rumble*)e; writer->Write(CMD_HH(r->base, r->startFrame)); - writer->Write(CMD_HBB(e->endFrame, r->unk_06, r->unk_07)); - writer->Write(CMD_BBH(r->unk_08, r->unk_09, r->unk_0A)); + writer->Write(CMD_HBB(e->endFrame, r->sourceStrength, r->duration)); + writer->Write(CMD_BBH(r->decreaseRate, r->unk_09, r->unk_0A)); } break; } - case 0x15://Both unused in OoT - case 0x1A://(uint32_t)CutsceneCommands::Unknown: + //case 0x15://Both unused in OoT + //case 0x1A://(uint32_t)CutsceneOoT_CommandType::Unknown: { #if 0 CutsceneCommandUnknown* cmdUnk = (CutsceneCommandUnknown*)cs->commands[i]; @@ -179,14 +179,14 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW #endif } break; - case (uint32_t)CutsceneCommands::Textbox: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_TEXT: { writer->Write(CS_CMD_TEXTBOX); writer->Write((uint32_t)CMD_W((cs->commands[i])->entries.size())); for (const auto& e : cs->commands[i]->entries) { - CutsceneSubCommandEntry_TextBox* textBox = (CutsceneSubCommandEntry_TextBox*)e; + CutsceneOoTSubCommandEntry_Text* textBox = (CutsceneOoTSubCommandEntry_Text*)e; if (textBox->base == 0xFFFF) // CS_TEXT_NONE { writer->Write(CMD_HH(0xFFFF, textBox->startFrame)); @@ -202,110 +202,110 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case 10: //ActorAction0 - case (uint32_t)CutsceneCommands::SetActorAction1: - case 17: - case 18: - case 23: - case 34: - case 39: - case 46: - case 76: - case 85: - case 93: - case 105: - case 107: - case 110: - case 119: - case 123: - case 138: - case 139: - case 144: - case (uint32_t)CutsceneCommands::SetActorAction2: - case 16: - case 24: - case 35: - case 40: - case 48: - case 64: - case 68: - case 70: - case 78: - case 80: - case 94: - case 116: - case 118: - case 120: - case 125: - case 131: - case 141: - case (uint32_t)CutsceneCommands::SetActorAction3: - case 36: - case 41: - case 50: - case 67: - case 69: - case 72: - case 74: - case 81: - case 106: - case 117: - case 121: - case 126: - case 132: - case (uint32_t)CutsceneCommands::SetActorAction4: - case 37: - case 42: - case 51: - case 53: - case 63: - case 65: - case 66: - case 75: - case 82: - case 108: - case 127: - case 133: - case (uint32_t)CutsceneCommands::SetActorAction5: - case 38: - case 43: - case 47: - case 54: - case 79: - case 83: - case 128: - case 135: - case (uint32_t)CutsceneCommands::SetActorAction6: - case 55: - case 77: - case 84: - case 90: - case 129: - case 136: - case (uint32_t)CutsceneCommands::SetActorAction7: - case 52: - case 57: - case 58: - case 88: - case 115: - case 130: - case 137: - case (uint32_t)CutsceneCommands::SetActorAction8: - case 60: - case 89: - case 111: - case 114: - case 134: - case 142: - case (uint32_t)CutsceneCommands::SetActorAction9: - case (uint32_t)CutsceneCommands::SetActorAction10: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE: //ActorAction0 + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_7: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_8: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_9: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_10: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_11: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_12: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_13: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_14: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_15: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_16: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_17: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_7: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_8: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_9: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_10: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_11: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_12: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_13: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_14: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_15: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_16: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_17: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_7: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_8: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_9: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_10: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_11: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_12: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_13: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_7: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_8: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_9: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_10: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_11: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_12: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_7: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_8: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_7: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_1: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_2: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_3: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_4: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_5: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_6: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_8_0: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_9_0: { - writer->Write((uint32_t)(CutsceneCommands)cs->commands[i]->commandID); + writer->Write((uint32_t)cs->commands[i]->commandID); writer->Write((uint32_t)CMD_W(cs->commands[i]->entries.size())); for (const auto& e : cs->commands[i]->entries) { - CutsceneSubCommandEntry_ActorAction* actorAct = (CutsceneSubCommandEntry_ActorAction*)e; + CutsceneOoTSubCommandEntry_ActorCue* actorAct = (CutsceneOoTSubCommandEntry_ActorCue*)e; writer->Write(CMD_HH(actorAct->base, actorAct->startFrame)); writer->Write(CMD_HH(actorAct->endFrame, actorAct->rotX)); writer->Write(CMD_HH(actorAct->rotY, actorAct->rotZ)); @@ -322,24 +322,24 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW break; } - case (uint32_t)CutsceneCommands::SetSceneTransFX: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_TRANSITION: { - CutsceneCommandSceneTransFX* cmdTFX = (CutsceneCommandSceneTransFX*)cs->commands[i]; + CutsceneOoTCommand_Transition* cmdTFX = (CutsceneOoTCommand_Transition*)cs->commands[i]; writer->Write(CS_CMD_SCENE_TRANS_FX); writer->Write((uint32_t)1); - writer->Write(CMD_HH((((CutsceneCommandSceneTransFX*)cs->commands[i])->base), ((CutsceneCommandSceneTransFX*)cs->commands[i])->startFrame)); - writer->Write(CMD_HH((((CutsceneCommandSceneTransFX*)cs->commands[i])->endFrame), ((CutsceneCommandSceneTransFX*)cs->commands[i])->endFrame)); + writer->Write(CMD_HH((cmdTFX->base), cmdTFX->startFrame)); + writer->Write(CMD_HH((cmdTFX->endFrame), cmdTFX->endFrame)); break; } - case (uint32_t)CutsceneCommands::PlayBGM: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_START_SEQ: { writer->Write(CS_CMD_PLAYBGM); writer->Write((uint32_t)CMD_W(cs->commands[i]->entries.size())); for (const auto& e : cs->commands[i]->entries) { - CutsceneSubCommandEntry_GenericCmd* cmd = (CutsceneSubCommandEntry_GenericCmd*)e; + CutsceneOoTSubCommandEntry_GenericCmd* cmd = (CutsceneOoTSubCommandEntry_GenericCmd*)e; writer->Write(CMD_HH(cmd->base, cmd->startFrame)); writer->Write(CMD_HH(cmd->endFrame, cmd->pad)); writer->Write(CMD_W(cmd->unused1)); @@ -355,14 +355,14 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case (uint32_t)CutsceneCommands::StopBGM: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_STOP_SEQ: { writer->Write(CS_CMD_STOPBGM); writer->Write((uint32_t)CMD_W(cs->commands[i]->entries.size())); for (const auto& e : cs->commands[i]->entries) { - CutsceneSubCommandEntry_GenericCmd* cmd = (CutsceneSubCommandEntry_GenericCmd*)e; + CutsceneOoTSubCommandEntry_GenericCmd* cmd = (CutsceneOoTSubCommandEntry_GenericCmd*)e; writer->Write(CMD_HH(cmd->base, cmd->startFrame)); writer->Write(CMD_HH(cmd->endFrame, cmd->pad)); writer->Write(CMD_W(cmd->unused1)); @@ -378,14 +378,14 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case (uint32_t)CutsceneCommands::FadeBGM: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ: { writer->Write(CS_CMD_FADEBGM); writer->Write((uint32_t)CMD_W(cs->commands[i]->entries.size())); for (const auto& e : cs->commands[i]->entries) { - CutsceneSubCommandEntry_GenericCmd* cmd = (CutsceneSubCommandEntry_GenericCmd*)e; + CutsceneOoTSubCommandEntry_GenericCmd* cmd = (CutsceneOoTSubCommandEntry_GenericCmd*)e; writer->Write(CMD_HH(cmd->base, cmd->startFrame)); writer->Write(CMD_HH(cmd->endFrame, cmd->pad)); writer->Write(CMD_W(cmd->unused1)); @@ -401,7 +401,7 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW } break; } - case (uint32_t)CutsceneCommands::SetTime: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_TIME: { writer->Write(CS_CMD_SETTIME); writer->Write((uint32_t)CMD_W(cs->commands[i]->entries.size())); @@ -411,13 +411,14 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW CutsceneSubCommandEntry_SetTime* t = (CutsceneSubCommandEntry_SetTime*)e; writer->Write(CMD_HH(t->base, t->startFrame)); writer->Write(CMD_HBB(t->endFrame, t->hour, t->minute)); - writer->Write((uint32_t)CMD_W(t->unk_08)); + writer->Write((uint32_t)0); + //writer->Write((uint32_t)CMD_W(t->unk_08)); } break; } - case (uint32_t)CutsceneCommands::Terminator: + case (uint32_t)CutsceneOoT_CommandType::CS_CMD_DESTINATION: { - CutsceneCommand_Terminator* t = (CutsceneCommand_Terminator*)cs->commands[i]; + CutsceneOoTCommand_Destination* t = (CutsceneOoTCommand_Destination*)cs->commands[i]; writer->Write(CS_CMD_TERMINATOR); writer->Write((uint32_t)1); writer->Write(CMD_HH(t->base, t->startFrame)); diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp index 81863f0..af4fab0 100644 --- a/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/DisplayListExporter.cpp @@ -13,6 +13,7 @@ #include #include "VersionInfo.h" + #define GFX_SIZE 8 #define gsDPSetCombineLERP_NoMacros(a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ @@ -57,7 +58,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina // DEBUG: Write in a marker Declaration* dbgDecl = dList->parent->GetDeclaration(dList->GetRawDataIndex()); - std::string dbgName = StringHelper::Sprintf("%s/%s", GetParentFolderName(res).c_str(), dbgDecl->varName.c_str()); + std::string dbgName = StringHelper::Sprintf("%s/%s", GetParentFolderName(res).c_str(), dbgDecl->declName.c_str()); uint64_t hash = CRC64(dbgName.c_str()); writer->Write((uint32_t)(G_MARKER << 24)); writer->Write((uint32_t)0xBEEFBEEF); @@ -229,7 +230,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina if (mtxDecl != nullptr) { - std::string vName = StringHelper::Sprintf("%s/%s", (GetParentFolderName(res).c_str()), mtxDecl->varName.c_str()); + std::string vName = StringHelper::Sprintf("%s/%s", (GetParentFolderName(res).c_str()), mtxDecl->declName.c_str()); uint64_t hash = CRC64(vName.c_str()); @@ -333,7 +334,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina if (dListDecl != nullptr) { - std::string vName = StringHelper::Sprintf("%s/%s", (GetParentFolderName(res).c_str()), dListDecl->varName.c_str()); + std::string vName = StringHelper::Sprintf("%s/%s", (GetParentFolderName(res).c_str()), dListDecl->declName.c_str()); uint64_t hash = CRC64(vName.c_str()); @@ -354,7 +355,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina if (dListDecl2 != nullptr) { //std::string fName = StringHelper::Sprintf("%s\\%s", GetParentFolderName(res).c_str(), dListDecl2->varName.c_str()); - std::string fName = OTRExporter_DisplayList::GetPathToRes(res, dListDecl2->varName.c_str()); + std::string fName = OTRExporter_DisplayList::GetPathToRes(res, dListDecl2->declName.c_str()); if (files.find(fName) == files.end() && !DiskFile::Exists("Extract/" + fName)) { @@ -419,7 +420,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina if (dListDecl != nullptr) { - std::string vName = StringHelper::Sprintf("%s/%s", (GetParentFolderName(res).c_str()), dListDecl->varName.c_str()); + std::string vName = StringHelper::Sprintf("%s/%s", (GetParentFolderName(res).c_str()), dListDecl->declName.c_str()); uint64_t hash = CRC64(vName.c_str()); @@ -440,7 +441,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina if (dListDecl2 != nullptr) { //std::string fName = StringHelper::Sprintf("%s\\%s", GetParentFolderName(res).c_str(), dListDecl2->varName.c_str()); - std::string fName = OTRExporter_DisplayList::GetPathToRes(res, dListDecl2->varName.c_str()); + std::string fName = OTRExporter_DisplayList::GetPathToRes(res, dListDecl2->declName.c_str()); if (files.find(fName) == files.end() && !DiskFile::Exists("Extract/" + fName)) { @@ -746,7 +747,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina int32_t aa = (data & 0x000000FF00000000ULL) >> 32; int32_t nn = (data & 0x000FF00000000000ULL) >> 44; - if (vtxDecl != nullptr && vtxDecl->varType != "Gfx") + if (vtxDecl != nullptr && vtxDecl->declName != "Gfx") { uint32_t diff = segOffset - vtxDecl->address; @@ -760,7 +761,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina writer->Write(word0); writer->Write(word1); - std::string fName = OTRExporter_DisplayList::GetPathToRes(res, vtxDecl->varName); + std::string fName = OTRExporter_DisplayList::GetPathToRes(res, vtxDecl->declName); uint64_t hash = CRC64(fName.c_str()); @@ -775,7 +776,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina int arrCnt = 0; - auto split = StringHelper::Split(vtxDecl->text, "\n"); + auto split = StringHelper::Split(vtxDecl->declBody, "\n"); for (size_t i = 0; i < split.size(); i++) { diff --git a/OTRExporter/RoomExporter.cpp b/OTRExporter/RoomExporter.cpp index 3959d76..17b6322 100644 --- a/OTRExporter/RoomExporter.cpp +++ b/OTRExporter/RoomExporter.cpp @@ -187,7 +187,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite if (cmdMesh->meshHeaderType == 0 || cmdMesh->meshHeaderType == 2) { - PolygonType2* poly = (PolygonType2*)cmdMesh->polyType.get(); + RoomShapeCullable* poly = (RoomShapeCullable*)cmdMesh->polyType.get(); writer->Write(poly->num); @@ -200,17 +200,17 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite writer->Write(poly->format); - auto test = (PolygonDlist*)&poly->polyDLists[0]; + auto test = (RoomShapeDListsEntry*)&poly->polyDLists[0]; Declaration* dListDeclOpa = poly->parent->GetDeclaration(GETSEGOFFSET(test->opa)); Declaration* dListDeclXlu = poly->parent->GetDeclaration(GETSEGOFFSET(test->xlu)); if (test->opa != 0) - writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(res).c_str(), dListDeclOpa->varName.c_str())); + writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(res).c_str(), dListDeclOpa->declName.c_str())); else writer->Write(""); if (test->xlu != 0) - writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(res).c_str(), dListDeclXlu->varName.c_str())); + writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(res).c_str(), dListDeclXlu->declName.c_str())); else writer->Write(""); @@ -225,7 +225,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite Declaration* bgDecl = poly->parent->GetDeclarationRanged(GETSEGOFFSET(poly->multiList[i].source)); - writer->Write(OTRExporter_DisplayList::GetPathToRes(poly->multiList[i].sourceBackground, bgDecl->varName)); + writer->Write(OTRExporter_DisplayList::GetPathToRes(poly->multiList[i].sourceBackground, bgDecl->declName)); writer->Write(poly->multiList[i].unk_0C); writer->Write(poly->multiList[i].tlut); @@ -246,7 +246,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite Declaration* bgDecl = poly->parent->GetDeclarationRanged(GETSEGOFFSET(poly->single.source)); - writer->Write(OTRExporter_DisplayList::GetPathToRes(poly->single.sourceBackground, bgDecl->varName)); + writer->Write(OTRExporter_DisplayList::GetPathToRes(poly->single.sourceBackground, bgDecl->declName)); writer->Write(poly->single.unk_0C); writer->Write(poly->single.tlut); @@ -349,7 +349,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite SetCollisionHeader* cmdCollHeader = (SetCollisionHeader*)cmd; Declaration* colHeaderDecl = room->parent->GetDeclaration(cmdCollHeader->segmentOffset); - std::string path = OTRExporter_DisplayList::GetPathToRes(room, colHeaderDecl->varName); + std::string path = OTRExporter_DisplayList::GetPathToRes(room, colHeaderDecl->declName); writer->Write(path); } break; @@ -359,7 +359,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite writer->Write((uint32_t)cmdEntrance->entrances.size()); - for (EntranceEntry entry : cmdEntrance->entrances) + for (Spawn entry : cmdEntrance->entrances) { writer->Write((uint8_t)entry.startPositionIndex); writer->Write((uint8_t)entry.roomToLoad); @@ -464,7 +464,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite { Declaration* decl = room->parent->GetDeclaration(GETSEGOFFSET(cmdSetPathways->pathwayList.pathways[i].listSegmentAddress)); //std::string path = StringHelper::Sprintf("%s\\%s", OTRExporter_DisplayList::GetParentFolderName(res).c_str(), decl->varName.c_str()); - std::string path = OTRExporter_DisplayList::GetPathToRes(room, decl->varName); + std::string path = OTRExporter_DisplayList::GetPathToRes(room, decl->declName); writer->Write(path); MemoryStream* pathStream = new MemoryStream(); @@ -486,7 +486,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite } } -void OTRExporter_Room::WritePolyDList(BinaryWriter* writer, ZRoom* room, PolygonDlist* dlist) +void OTRExporter_Room::WritePolyDList(BinaryWriter* writer, ZRoom* room, RoomShapeDListsEntry* dlist) { writer->Write(dlist->polyType); @@ -504,7 +504,7 @@ void OTRExporter_Room::WritePolyDList(BinaryWriter* writer, ZRoom* room, Polygon if (dlist->opaDList != nullptr) { auto opaDecl = room->parent->GetDeclaration(GETSEGOFFSET(dlist->opaDList->GetRawDataIndex())); - writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(room).c_str(), opaDecl->varName.c_str())); + writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(room).c_str(), opaDecl->declName.c_str())); } else writer->Write(""); @@ -512,7 +512,7 @@ void OTRExporter_Room::WritePolyDList(BinaryWriter* writer, ZRoom* room, Polygon if (dlist->xluDList != nullptr) { auto xluDecl = room->parent->GetDeclaration(GETSEGOFFSET(dlist->xluDList->GetRawDataIndex())); - writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(room).c_str(), xluDecl->varName.c_str())); + writer->Write(StringHelper::Sprintf("%s/%s", OTRExporter_DisplayList::GetParentFolderName(room).c_str(), xluDecl->declName.c_str())); } else writer->Write(""); diff --git a/OTRExporter/RoomExporter.h b/OTRExporter/RoomExporter.h index f748658..bb4471a 100644 --- a/OTRExporter/RoomExporter.h +++ b/OTRExporter/RoomExporter.h @@ -4,11 +4,11 @@ #include "Exporter.h" #include "ZRoom/ZRoom.h" -class PolygonDlist; +class RoomShapeDListsEntry; class OTRExporter_Room : public OTRExporter { public: - void WritePolyDList(BinaryWriter* writer, ZRoom* room, PolygonDlist* dlist); + void WritePolyDList(BinaryWriter* writer, ZRoom* room, RoomShapeDListsEntry* dlist); virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override; }; \ No newline at end of file diff --git a/OTRExporter/SkeletonLimbExporter.cpp b/OTRExporter/SkeletonLimbExporter.cpp index 1ee17c4..6e22d81 100644 --- a/OTRExporter/SkeletonLimbExporter.cpp +++ b/OTRExporter/SkeletonLimbExporter.cpp @@ -12,12 +12,12 @@ void OTRExporter_SkeletonLimb::Save(ZResource* res, const fs::path& outPath, Bin writer->Write((uint8_t)limb->type); writer->Write((uint8_t)limb->skinSegmentType); - if (limb->skinSegmentType == ZLimbSkinType::SkinType_DList && limb->type == ZLimbType::Skin) + if (limb->skinSegmentType == ZLimbSkinType::SkinType_Normal && limb->type == ZLimbType::Skin) { auto childDecl = limb->parent->GetDeclaration(GETSEGOFFSET(limb->skinSegment)); if (childDecl != nullptr) - writer->Write(OTRExporter_DisplayList::GetPathToRes(limb, childDecl->varName)); + writer->Write(OTRExporter_DisplayList::GetPathToRes(limb, childDecl->declName)); else writer->Write(""); } @@ -26,45 +26,45 @@ void OTRExporter_SkeletonLimb::Save(ZResource* res, const fs::path& outPath, Bin writer->Write(""); } - writer->Write((uint16_t)limb->segmentStruct.unk_0); - writer->Write((uint32_t)limb->segmentStruct.unk_4_arr.size()); + writer->Write((uint16_t)limb->segmentStruct.totalVtxCount); + writer->Write((uint32_t)limb->segmentStruct.limbModifications_arr.size()); - for (auto item : limb->segmentStruct.unk_4_arr) + for (auto item : limb->segmentStruct.limbModifications_arr) { writer->Write(item.unk_4); - writer->Write((uint32_t)item.unk_8_arr.size()); + writer->Write((uint32_t)item.skinVertices_arr.size()); - for (auto item2 : item.unk_8_arr) + for (auto item2 : item.skinVertices_arr) { - writer->Write(item2.unk_0); - writer->Write(item2.unk_2); - writer->Write(item2.unk_4); - writer->Write(item2.unk_6); - writer->Write(item2.unk_7); - writer->Write(item2.unk_8); - writer->Write(item2.unk_9); + writer->Write(item2.index); + writer->Write(item2.s); + writer->Write(item2.t); + writer->Write(item2.normX); + writer->Write(item2.normY); + writer->Write(item2.normZ); + writer->Write(item2.alpha); } - writer->Write((uint32_t)item.unk_C_arr.size()); + writer->Write((uint32_t)item.limbTransformations_arr.size()); - for (auto item2 : item.unk_C_arr) + for (auto item2 : item.limbTransformations_arr) { - writer->Write(item2.unk_0); + writer->Write(item2.limbIndex); writer->Write(item2.x); writer->Write(item2.y); writer->Write(item2.z); - writer->Write(item2.unk_8); + writer->Write(item2.scale); } } - if (limb->segmentStruct.unk_8 != 0) + if (limb->segmentStruct.dlist != SEGMENTED_NULL) { - auto skinGfxDecl = limb->parent->GetDeclaration(GETSEGOFFSET(limb->segmentStruct.unk_8)); + auto skinGfxDecl = limb->parent->GetDeclaration(GETSEGOFFSET(limb->segmentStruct.dlist)); if (skinGfxDecl != nullptr) { - writer->Write(OTRExporter_DisplayList::GetPathToRes(limb, skinGfxDecl->varName)); + writer->Write(OTRExporter_DisplayList::GetPathToRes(limb, skinGfxDecl->declName)); } else { diff --git a/extract_assets.py b/extract_assets.py index c6d5282..cf4cbfe 100755 --- a/extract_assets.py +++ b/extract_assets.py @@ -14,7 +14,7 @@ def BuildOTR(xmlPath, rom, zapd_exe=None, genHeaders=None): if not zapd_exe: zapd_exe = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPDTR/ZAPD.out" - exec_cmd = [zapd_exe, "ed", "-i", xmlPath, "-b", rom, "-fl", "CFG/filelists", + exec_cmd = [zapd_exe, "ed", "-eh", "-i", xmlPath, "-b", rom, "-fl", "CFG/filelists", "-o", "placeholder", "-osf", "placeholder", "-rconf", "CFG/Config.xml"] # generate headers, but not otrs by excluding the otr exporter -- cgit v1.2.3