summaryrefslogtreecommitdiff
path: root/mm/2s2h/SaveManager/Migrations/7.cpp
blob: ec620c8a4123040956639b6cb0f8917b17179f00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "2s2h/SaveManager/SaveManager.h"
#include "z64.h"

// Add respawn and playtime info to saves
void SaveManager_Migration_7(nlohmann::json& j) {
    if (!j["save"]["shipSaveInfo"].contains("filePlaytime")) {
        j["save"]["shipSaveInfo"]["filePlaytime"] = 0;
    }
    if (!j["save"]["shipSaveInfo"].contains("respawn")) {
        j["save"]["shipSaveInfo"]["respawn"] = {};
    }

    for (int i = 0; i < RESPAWN_MODE_MAX; i++) {
        j["save"]["shipSaveInfo"]["respawn"][i] = {
            { "pos",
              {
                  { "x", 0.0 },
                  { "y", 0.0 },
                  { "z", 0.0 },
              } },
            { "yaw", 0 },
            { "playerParams", 0 },
            { "entrance", 0 },
            { "roomIndex", 0 },
            { "data", 0 },
            { "tempSwitchFlags", 0 },
            { "unk_18", 0 },
            { "tempCollectFlags", 0 },
        };
    }
}