DPad Items (#228)

* Initial Dpad

* remove old hud stuff

* and comment

* s..

* add dpad equip macro back in

* fix inputs

* fix equipping (hopefully all)

* finish some todos

* add 2s2h asset header

* check dpad macro

* remove 2s2h_assets

* re-add empty texture

* use correct struct for default dpad equips

* dpad save stuff

* fix item offering, use correct equip offset values

* finally figure out unk_154 and fix mask equipping

* avoid ugly code

* add necessary condition

* correct save names for dpad items/slots

* remove todos and sort out suggestions and rename cvar

* func standardise renaming

* Add dpad to hud presets

* dpad save migration
This commit is contained in:
inspectredc
2024-05-22 09:05:04 -05:00
committed by Garrett Cox
parent 1d5d9be069
commit ad478cfc59
28 changed files with 2962 additions and 60 deletions
+5 -3
View File
@@ -42,19 +42,21 @@ const std::filesystem::path savesFolderPath(Ship::Context::GetPathRelativeToAppD
// - Increment CURRENT_SAVE_VERSION
// - Create the migration file in the Migrations folder with the name `{CURRENT_SAVE_VERSION}.cpp`
// - Add the migration function definition below and add it to the `migrations` map with the key being the previous version
const uint32_t CURRENT_SAVE_VERSION = 1;
const uint32_t CURRENT_SAVE_VERSION = 2;
void SaveManager_Migration_1(nlohmann::json& j);
void SaveManager_Migration_2(nlohmann::json& j);
std::map<uint32_t, std::function<void(nlohmann::json&)>> migrations = {
const std::unordered_map<uint32_t, std::function<void(nlohmann::json&)>> migrations = {
{ 0, SaveManager_Migration_1 },
{ 1, SaveManager_Migration_2 },
};
void SaveManager_MigrateSave(nlohmann::json& j) {
int version = j.value("version", 0);
while (version != CURRENT_SAVE_VERSION) {
if (migrations.contains(version)) {
auto migration = migrations[version];
auto migration = migrations.at(version);
migration(j);
}
version = j["version"] = version + 1;