Skip to content

Commit

Permalink
Mm spline fixes (#311)
Browse files Browse the repository at this point in the history
* Add enum file

* Last fix
  • Loading branch information
louist103 authored Jan 10, 2024
1 parent 5238d60 commit 9601f26
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 6 additions & 0 deletions ZAPD/GameConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element)

else if (enumKey == "endSfx")
enumData.endSfx[itemIndex] = itemID;

else if (enumKey == "csSplineInterpType")
enumData.interpType[itemIndex] = itemID;

else if (enumKey == "csSplineRelTo")
enumData.relTo[itemIndex] = itemID;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions ZAPD/GameConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class EnumData
std::map<uint16_t, std::string> rumbleType;
std::map<uint8_t, std::string> spawnFlag;
std::map<uint8_t, std::string> endSfx;
std::map<uint8_t, std::string> interpType;
std::map<uint16_t, std::string> relTo;
};

class ZFile;
Expand Down
16 changes: 6 additions & 10 deletions ZAPD/OtherStructs/CutsceneMM_Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ CutsceneSubCommandEntry_SplineCamPoint::CutsceneSubCommandEntry_SplineCamPoint(c
posY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
posZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 8);
relTo = BitConverter::ToUInt16BE(rawData, rawDataIndex + 10);
printf("%s\n", GetBodySourceCode().c_str());

}
/*#define CS_CAM_POINT(interpType, weight, duration, posX, posY, posZ, relativeTo) \
{ CMD_BBH(interpType, weight, duration) }, { CMD_HH(posX, posY) }, { CMD_HH(posZ, relativeTo) }*/

std::string CutsceneSubCommandEntry_SplineCamPoint::GetBodySourceCode() const
{
return StringHelper::Sprintf("CS_CAM_POINT(0x%02X, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X)", interpType, weight, duration, posX, posY, posZ, relTo);
const auto interpTypeMap = &Globals::Instance->cfg.enumData.interpType;
const auto relToMap = &Globals::Instance->cfg.enumData.relTo;

return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, %s)", interpTypeMap->at(interpType).c_str(), weight, duration, posX, posY, posZ, relToMap->at(relTo).c_str());
}

size_t CutsceneSubCommandEntry_SplineCamPoint::GetRawSize() const
Expand All @@ -162,9 +162,6 @@ CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint
unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
}

/*#define CS_CAM_MISC(unused0, roll, fov, unused1) \
{ CMD_HH(unused0, roll) }, { CMD_HH(fov, unused1) }*/

std::string CutsceneSubCommandEntry_SplineMiscPoint::GetBodySourceCode() const
{
return StringHelper::Sprintf("CS_CAM_MISC(0x%04X, 0x%04X, 0x%04X, 0x%04X)", unused0, roll, fov, unused1);
Expand Down Expand Up @@ -207,7 +204,7 @@ CutsceneSubCommandEntry_SplineFooter::CutsceneSubCommandEntry_SplineFooter(const
firstHalfWord, secondHalfWord));
}
}
/*#define CS_CAM_END() */

std::string CutsceneSubCommandEntry_SplineFooter::GetBodySourceCode() const
{
return "CS_CAM_END()";
Expand Down Expand Up @@ -276,7 +273,6 @@ size_t CutsceneMMCommand_Spline::GetCommandSize() const
return 8 + (8 * numHeaders) + ((totalCommands * 2) * 0xC) + (totalCommands * 8) + 4;
}


/**** TRANSITION GENERAL ****/

CutsceneSubCommandEntry_TransitionGeneral::CutsceneSubCommandEntry_TransitionGeneral(
Expand Down

0 comments on commit 9601f26

Please sign in to comment.