Skip to content

Commit f146b13

Browse files
committed
add area saveloading, fix .ogg to .flac
1 parent eaaa5f3 commit f146b13

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

Data/Base.rte/Activities/Utility/SaveLoadHandler.lua

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ function SaveLoadHandler:SerializeTable(val, name, skipnewlines, depth)
5757
tmp = tmp .. (val and "true" or "false")
5858
elseif val.Magnitude then -- ghetto vector check
5959
tmp = tmp .. string.format("%q", "Vector(" .. val.X .. "," .. val.Y .. ")")
60-
elseif val.PresetName and IsMOSRotating(val) then
60+
elseif val.PresetName and IsMOSRotating(val) then -- IsMOSRotating freaks out if we give it something that isn't a preset at all... ghetto here too
6161
val:SetNumberValue("saveLoadHandlerUniqueID", val.UniqueID);
6262
tmp = tmp .. string.format("%q", "SAVELOADHANDLERUNIQUEID_" .. tostring(val.UniqueID))
63+
elseif val.FirstBox then -- ghetto area check
64+
tmp = tmp .. string.format("%q", "SAVELOADHANDLERAREA_" .. tostring(val.Name))
6365
else
6466
tmp = tmp .. '"[inserializeable datatype:' .. type(val) .. ']"'
6567
end
@@ -70,18 +72,6 @@ function SaveLoadHandler:SerializeTable(val, name, skipnewlines, depth)
7072
return tmp
7173
end
7274

73-
function SaveLoadHandler:ParseTableForVectors(tab)
74-
for k, v in pairs(tab) do
75-
if type(v) == "string" and string.find(v, "Vector%(") then
76-
local vector = loadstring("return " .. v)();
77-
tab[k] = vector;
78-
elseif type(v) == "table" then
79-
self:ParseTableForVectors(v);
80-
end
81-
end
82-
83-
end
84-
8575
function SaveLoadHandler:ParseTableForMOs(tab)
8676

8777
for k, v in pairs(tab) do
@@ -169,6 +159,31 @@ function SaveLoadHandler:ParseTableForMOs(tab)
169159
end
170160
end
171161

162+
function SaveLoadHandler:ParseTableForVectors(tab)
163+
for k, v in pairs(tab) do
164+
if type(v) == "string" and string.find(v, "Vector%(") then
165+
local vector = loadstring("return " .. v)();
166+
tab[k] = vector;
167+
elseif type(v) == "table" then
168+
self:ParseTableForVectors(v);
169+
end
170+
end
171+
172+
end
173+
174+
function SaveLoadHandler:ParseTableForAreas(tab)
175+
for k, v in pairs(tab) do
176+
if type(v) == "string" and string.find(v, "SAVELOADHANDLERAREA_") then
177+
local areaName = string.sub(v, 21, -1);
178+
local area = SceneMan.Scene:GetOptionalArea(areaName);
179+
tab[k] = area;
180+
elseif type(v) == "table" then
181+
self:ParseTableForAreas(v);
182+
end
183+
end
184+
185+
end
186+
172187
function SaveLoadHandler:ReadSavedStringAsTable(name)
173188
print(ActivityMan:GetActivity())
174189
print(ActivityMan:GetActivity():LoadString(name))
@@ -183,6 +198,7 @@ function SaveLoadHandler:ReadSavedStringAsTable(name)
183198
print("Parsing table for MOs: " .. name);
184199
self:ParseTableForMOs(tab);
185200
self:ParseTableForVectors(tab);
201+
self:ParseTableForAreas(tab);
186202

187203
return tab;
188204

Data/Browncoats.rte/Scenes/Sounds.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ AddSoundContainer = SoundContainer
55
PresetName = Yskely Refinery Oil Spout Engage
66
Immobile = 1
77
Priority = 127 // just above the default
8-
AddSound = Browncoats.rte/Scenes/Sounds/Refinery_OilSpoutEngage.ogg
8+
AddSound = Browncoats.rte/Scenes/Sounds/Refinery_OilSpoutEngage.flac
99

1010
AddSoundContainer = SoundContainer
1111
PresetName = Yskely Refinery Ambience Ext

0 commit comments

Comments
 (0)