1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-15 14:09:06 +00:00

Initial support for loading android save files.

Apparently there is a new map with the index 55 -- a related entry was
added to the worldmap.txt file to prevent data loss, just in case.
<StartData ch=... /> field is not yet handled missing.
Hopefully the resulting format can be loaded on android without problems,
especially because both "ingr" and "ingrNames" fields appear in the
StartData tag now.
This commit is contained in:
fgenesis 2013-06-20 21:39:17 +02:00
parent 54d609a8b5
commit 416b521a12
2 changed files with 92 additions and 1 deletions

View file

@ -2461,6 +2461,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
startData.SetAttribute("scene", dsq->game->sceneName); startData.SetAttribute("scene", dsq->game->sceneName);
startData.SetAttribute("exp", dsq->continuity.exp); startData.SetAttribute("exp", dsq->continuity.exp);
startData.SetAttribute("h", dsq->continuity.maxHealth); startData.SetAttribute("h", dsq->continuity.maxHealth);
// ANDROID TODO: "ch" field
startData.SetAttribute("naijaModel", dsq->continuity.naijaModel); startData.SetAttribute("naijaModel", dsq->continuity.naijaModel);
startData.SetAttribute("costume", dsq->continuity.costume); startData.SetAttribute("costume", dsq->continuity.costume);
startData.SetAttribute("form", dsq->continuity.form); startData.SetAttribute("form", dsq->continuity.form);
@ -2479,6 +2480,16 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
} }
startData.SetAttribute("songs", os2.str()); startData.SetAttribute("songs", os2.str());
// new format as used by android version
std::ostringstream ingrNames;
for (int i = 0; i < ingredients.size(); i++)
{
IngredientData *data = ingredients[i];
ingrNames << data->name << " " << data->amount << " ";
}
startData.SetAttribute("ingrNames", ingrNames.str());
// for compatibility with older versions
std::ostringstream ingrOs; std::ostringstream ingrOs;
for (int i = 0; i < ingredients.size(); i++) for (int i = 0; i < ingredients.size(); i++)
{ {
@ -2551,6 +2562,9 @@ std::string Continuity::getSaveFileName(int slot, const std::string &pfix)
void Continuity::loadFileData(int slot, TiXmlDocument &doc) void Continuity::loadFileData(int slot, TiXmlDocument &doc)
{ {
std::string teh_file = dsq->continuity.getSaveFileName(slot, "aqs"); std::string teh_file = dsq->continuity.getSaveFileName(slot, "aqs");
if(!exists(teh_file))
teh_file = dsq->continuity.getSaveFileName(slot, "bin");
if (exists(teh_file)) if (exists(teh_file))
{ {
unsigned long size = 0; unsigned long size = 0;
@ -2810,7 +2824,9 @@ void Continuity::loadFile(int slot)
if (!tile) if (!tile)
{ {
errorLog("tile dummy"); std::ostringstream os;
os << "tile dummy: dropping data for worldmap tile index " << idx;
debugLog(os.str());
tile = &dummy; tile = &dummy;
} }
@ -2853,6 +2869,23 @@ void Continuity::loadFile(int slot)
dsq->continuity.form = FormType(atoi(startData->Attribute("form"))); dsq->continuity.form = FormType(atoi(startData->Attribute("form")));
} }
if (startData->Attribute("ingrNames"))
{
std::istringstream is(startData->Attribute("ingrNames"));
std::string name;
while (is >> name)
{
int amount=0;
is >> amount;
IngredientData *data = getIngredientDataByName(name);
if (data)
{
data->amount = 0;
pickupIngredient(data, amount, false);
}
}
}
if (startData->Attribute("ingr")) if (startData->Attribute("ingr"))
{ {
std::istringstream is(startData->Attribute("ingr")); std::istringstream is(startData->Attribute("ingr"));
@ -2916,6 +2949,8 @@ void Continuity::loadFile(int slot)
} }
} }
// TODO ANDROID: "ch" field
if (startData->Attribute("h")) if (startData->Attribute("h"))
{ {
int read = atoi(startData->Attribute("h")); int read = atoi(startData->Attribute("h"));

56
files/data/worldmap.txt Normal file
View file

@ -0,0 +1,56 @@
0 1008 MAINAREA 0 5 -0.667596 -1.2 1 1
1 1006 NAIJACAVE 1 2.5 398.484 -188.954 1 1
2 1005 VEDHACAVE 1 2 14.4108 -19.2 1 0.36
3 1015 ABYSS01 0 5 319.096 639.447 0 1
4 1015 ABYSS03 0 5 638.433 637.068 0 1
5 1009 OPENWATER02 0 5 319.17 -0.0658667 0 1
6 1009 OPENWATER03 0 5 638.633 -0.399733 0 1
7 1009 OPENWATER04 0 5 319.025 319.734 0 1
8 1009 OPENWATER06 0 5 638.63 317.827 0 1
9 1007 SONGCAVE02 1 2 128.578 159.092 0 0.387867
10 1007 SONGCAVE 1 5 118.842 147.471 0 0.599717
11 1014 VEIL01 0 5 638.579 -639.354 0 1
12 1014 VEIL02 0 5 958.132 -639.401 0 1
13 1009 VEIL03 0 5 638.221 -319.998 0 1
14 1010 FOREST02 0 5 -0.0961994 -639.541 0 1
15 1010 FOREST03 0 5 319.841 -639.163 0 1
16 1010 FOREST04 0 5 -0.0881051 -320.302 0 1
17 1010 FOREST05 0 5 319.692 -320.261 0 1
18 1025 FORESTSPRITECAVE 1 2 295.55 -631.495 0 0.45125
19 1026 FISHCAVE 1 2 -18.0111 -342.826 0 0.51796
20 1013 SUNTEMPLE 1 5 961.345 -687.826 0 0.22643
21 1016 SUNKENCITY01 1 2.5 -40.8617 906.841 0 1
22 1016 SUNKENCITY02 1 5 116.437 802.774 0 1
23 1000 BOILERROOM 1 2 49.228 940.225 0 1
24 1004 ENERGYTEMPLE01 1 2.5 -168.536 -8.8143 0 1
25 1004 ENERGYTEMPLE02 1 0.5 -232.22 -0.657245 0 1
26 1004 ENERGYTEMPLE03 1 2.5 -110.834 56.4481 0 1
27 1004 ENERGYTEMPLE04 1 4 -246.593 145.535 0 1
28 1004 ENERGYTEMPLE05 1 2 -207.873 175.936 0 1
29 1004 ENERGYTEMPLE06 1 2 -225.836 41.8167 0 1
30 1011 MITHALAS01 0 5 958.305 -0.399733 0 1
31 1011 MITHALAS02 1 5 1178.23 40.9613 0 1
32 1012 CATHEDRAL02 1 5 1458.63 70.988 0 1
33 1012 CATHEDRAL03 1 5 1491.23 315.666 0 1
34 1012 CATHEDRAL04 1 5 1231.44 457.454 0 1
35 1029 LICAVE 1 2 796.398 -663.693 0 0.500888
36 1013 SUNWORMTEST 1 4 987.255 -699.643 0 0.213937
37 1010 TREE02 0 2 -11.9703 -830.088 0 1
38 1028 SEAHORSE 1 5 803.549 308.257 0 1
39 1027 TURTLECAVE 1 5 371.817 -730.55 0 1
40 1019 ICECAVE 1 5 917.784 686.531 0 1
41 1002 FROZENVEIL 0 5 1646.98 -590.166 0 1
42 1003 BUBBLECAVE02 1 5 1841.07 -709.693 0 1
43 1024 MERMOGCAVE 1 2 482.591 -781.434 0 1
44 1023 TRAININGCAVE 1 4 247.338 -85.5629 1 1
45 1021 FINAL01 1 5 398.925 949.441 0 1
46 1021 FINAL02 1 5 79.3004 949.894 0 1
47 1021 FINAL03 1 5 718.257 958.177 0 1
48 1021 FINAL04 1 5 402.406 1269.56 0 1
49 1021 FINALBOSS 1 5 667.938 1486.98 0 1
50 1018 OCTOCAVE 1 2 834.888 -606.756 0 0.831527
51 1009 OPENWATER05 0 5 270.156 327.801 0 1.01408
52 1020 THIRTEENLAIR 1 5 417.62 -121.396 0 1
53 1030 KINGJELLYCAVE 1 2 328.989 605.32 0 0.356187
54 1020 WEIRDCAVE 1 0.5 548.557 709.137 0 1
55 19 UNKNOWN 0 1 0 0 0 1