mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-09 13:24:01 +00:00
Android save compat: Support "ch" (current health) value, and make maxHealth float.
This commit is contained in:
parent
318811f92d
commit
7faee73f14
2 changed files with 18 additions and 5 deletions
|
@ -2518,7 +2518,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
|||
startData.SetAttribute("scene", dsq->game->sceneName);
|
||||
startData.SetAttribute("exp", dsq->continuity.exp);
|
||||
startData.SetAttribute("h", dsq->continuity.maxHealth);
|
||||
// ANDROID TODO: "ch" field
|
||||
startData.SetAttribute("ch", dsq->continuity.health);
|
||||
startData.SetAttribute("naijaModel", dsq->continuity.naijaModel);
|
||||
startData.SetAttribute("costume", dsq->continuity.costume);
|
||||
startData.SetAttribute("form", dsq->continuity.form);
|
||||
|
@ -3054,11 +3054,9 @@ void Continuity::loadFile(int slot)
|
|||
}
|
||||
}
|
||||
|
||||
// TODO ANDROID: "ch" field
|
||||
|
||||
if (startData->Attribute("h"))
|
||||
{
|
||||
int read = atoi(startData->Attribute("h"));
|
||||
float read = strtof(startData->Attribute("h"), NULL);
|
||||
maxHealth = read;
|
||||
health = read;
|
||||
std::ostringstream os;
|
||||
|
@ -3071,6 +3069,21 @@ void Continuity::loadFile(int slot)
|
|||
dsq->game->avatar->health = maxHealth;
|
||||
}
|
||||
}
|
||||
|
||||
if (startData->Attribute("ch"))
|
||||
{
|
||||
float h = strtof(startData->Attribute("ch"), NULL);
|
||||
health = h;
|
||||
std::ostringstream os;
|
||||
os << "CurHealth read as: " << health;
|
||||
debugLog(os.str());
|
||||
|
||||
if (dsq->game->avatar)
|
||||
{
|
||||
dsq->game->avatar->health = h;
|
||||
}
|
||||
}
|
||||
|
||||
if (startData->Attribute("seconds"))
|
||||
{
|
||||
std::istringstream is(startData->Attribute("seconds"));
|
||||
|
|
|
@ -951,7 +951,7 @@ public:
|
|||
|
||||
std::string getSaveFileName(int slot, const std::string &pfix);
|
||||
|
||||
int maxHealth;
|
||||
float maxHealth;
|
||||
float health;
|
||||
bool hudVisible;
|
||||
unsigned int exp;
|
||||
|
|
Loading…
Add table
Reference in a new issue