Make Simulation.IncludePressure pref node accessible from OptionsView
Also remove ugly and messy behaviour depending on whether shift is being held while copying or stamping.
This commit is contained in:
parent
5391fc3ee0
commit
a407aba087
@ -97,7 +97,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (gameSave)
|
if (gameSave)
|
||||||
{
|
{
|
||||||
sim->Load(gameSave);
|
sim->Load(gameSave, true);
|
||||||
|
|
||||||
//Render save
|
//Render save
|
||||||
ren->decorations_enable = true;
|
ren->decorations_enable = true;
|
||||||
|
@ -366,17 +366,13 @@ std::pair<int, sign::Type> GameController::GetSignSplit(int signID)
|
|||||||
return gameModel->GetSimulation()->signs[signID].split();
|
return gameModel->GetSimulation()->signs[signID].split();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::PlaceSave(ui::Point position, bool includePressure)
|
void GameController::PlaceSave(ui::Point position)
|
||||||
{
|
{
|
||||||
bool incPressure = Client::Ref().GetPrefBool("Simulation.LoadPressure", true);
|
|
||||||
if (!incPressure)
|
|
||||||
includePressure = !includePressure;
|
|
||||||
|
|
||||||
GameSave *placeSave = gameModel->GetPlaceSave();
|
GameSave *placeSave = gameModel->GetPlaceSave();
|
||||||
if (placeSave)
|
if (placeSave)
|
||||||
{
|
{
|
||||||
HistorySnapshot();
|
HistorySnapshot();
|
||||||
if (!gameModel->GetSimulation()->Load(position.X, position.Y, placeSave, includePressure))
|
if (!gameModel->GetSimulation()->Load(placeSave, Client::Ref().GetPrefBool("Simulation.LoadPressure", true), position.X, position.Y))
|
||||||
{
|
{
|
||||||
gameModel->SetPaused(placeSave->paused | gameModel->GetPaused());
|
gameModel->SetPaused(placeSave->paused | gameModel->GetPaused());
|
||||||
Client::Ref().MergeStampAuthorInfo(placeSave->authors);
|
Client::Ref().MergeStampAuthorInfo(placeSave->authors);
|
||||||
@ -612,13 +608,9 @@ void GameController::ToolClick(int toolSelection, ui::Point point)
|
|||||||
activeTool->Click(sim, cBrush, point);
|
activeTool->Click(sim, cBrush, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteString GameController::StampRegion(ui::Point point1, ui::Point point2, bool includePressure)
|
ByteString GameController::StampRegion(ui::Point point1, ui::Point point2)
|
||||||
{
|
{
|
||||||
bool incPressure = Client::Ref().GetPrefBool("Simulation.IncludePressure", true);
|
GameSave * newSave = gameModel->GetSimulation()->Save(gameModel->GetIncludePressure(), point1.X, point1.Y, point2.X, point2.Y);
|
||||||
if (!incPressure)
|
|
||||||
includePressure = !includePressure;
|
|
||||||
|
|
||||||
GameSave * newSave = gameModel->GetSimulation()->Save(point1.X, point1.Y, point2.X, point2.Y, includePressure);
|
|
||||||
if(newSave)
|
if(newSave)
|
||||||
{
|
{
|
||||||
newSave->paused = gameModel->GetPaused();
|
newSave->paused = gameModel->GetPaused();
|
||||||
@ -635,13 +627,9 @@ ByteString GameController::StampRegion(ui::Point point1, ui::Point point2, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::CopyRegion(ui::Point point1, ui::Point point2, bool includePressure)
|
void GameController::CopyRegion(ui::Point point1, ui::Point point2)
|
||||||
{
|
{
|
||||||
bool incPressure = Client::Ref().GetPrefBool("Simulation.IncludePressure", true);
|
GameSave * newSave = gameModel->GetSimulation()->Save(gameModel->GetIncludePressure(), point1.X, point1.Y, point2.X, point2.Y);
|
||||||
if (!incPressure)
|
|
||||||
includePressure = !includePressure;
|
|
||||||
|
|
||||||
GameSave * newSave = gameModel->GetSimulation()->Save(point1.X, point1.Y, point2.X, point2.Y, includePressure);
|
|
||||||
if(newSave)
|
if(newSave)
|
||||||
{
|
{
|
||||||
Json::Value clipboardInfo;
|
Json::Value clipboardInfo;
|
||||||
@ -656,9 +644,9 @@ void GameController::CopyRegion(ui::Point point1, ui::Point point2, bool include
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::CutRegion(ui::Point point1, ui::Point point2, bool includePressure)
|
void GameController::CutRegion(ui::Point point1, ui::Point point2)
|
||||||
{
|
{
|
||||||
CopyRegion(point1, point2, includePressure);
|
CopyRegion(point1, point2);
|
||||||
gameModel->GetSimulation()->clear_area(point1.X, point1.Y, point2.X-point1.X, point2.Y-point1.Y);
|
gameModel->GetSimulation()->clear_area(point1.X, point1.Y, point2.X-point1.X, point2.Y-point1.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1271,7 +1259,7 @@ void GameController::OpenSearch(String searchText)
|
|||||||
void GameController::OpenLocalSaveWindow(bool asCurrent)
|
void GameController::OpenLocalSaveWindow(bool asCurrent)
|
||||||
{
|
{
|
||||||
Simulation * sim = gameModel->GetSimulation();
|
Simulation * sim = gameModel->GetSimulation();
|
||||||
GameSave * gameSave = sim->Save();
|
GameSave * gameSave = sim->Save(gameModel->GetIncludePressure());
|
||||||
if(!gameSave)
|
if(!gameSave)
|
||||||
{
|
{
|
||||||
new ErrorMessage("Error", "Unable to build save.");
|
new ErrorMessage("Error", "Unable to build save.");
|
||||||
@ -1490,7 +1478,7 @@ void GameController::OpenSaveWindow()
|
|||||||
if(gameModel->GetUser().UserID)
|
if(gameModel->GetUser().UserID)
|
||||||
{
|
{
|
||||||
Simulation * sim = gameModel->GetSimulation();
|
Simulation * sim = gameModel->GetSimulation();
|
||||||
GameSave * gameSave = sim->Save();
|
GameSave * gameSave = sim->Save(gameModel->GetIncludePressure());
|
||||||
if(!gameSave)
|
if(!gameSave)
|
||||||
{
|
{
|
||||||
new ErrorMessage("Error", "Unable to build save.");
|
new ErrorMessage("Error", "Unable to build save.");
|
||||||
@ -1537,7 +1525,7 @@ void GameController::SaveAsCurrent()
|
|||||||
if(gameModel->GetSave() && gameModel->GetUser().UserID && gameModel->GetUser().Username == gameModel->GetSave()->GetUserName())
|
if(gameModel->GetSave() && gameModel->GetUser().UserID && gameModel->GetUser().Username == gameModel->GetSave()->GetUserName())
|
||||||
{
|
{
|
||||||
Simulation * sim = gameModel->GetSimulation();
|
Simulation * sim = gameModel->GetSimulation();
|
||||||
GameSave * gameSave = sim->Save();
|
GameSave * gameSave = sim->Save(gameModel->GetIncludePressure());
|
||||||
if(!gameSave)
|
if(!gameSave)
|
||||||
{
|
{
|
||||||
new ErrorMessage("Error", "Unable to build save.");
|
new ErrorMessage("Error", "Unable to build save.");
|
||||||
@ -1785,4 +1773,4 @@ void GameController::RunUpdater()
|
|||||||
bool GameController::GetMouseClickRequired()
|
bool GameController::GetMouseClickRequired()
|
||||||
{
|
{
|
||||||
return gameModel->GetMouseClickRequired();
|
return gameModel->GetMouseClickRequired();
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,9 @@ public:
|
|||||||
void DrawRect(int toolSelection, ui::Point point1, ui::Point point2);
|
void DrawRect(int toolSelection, ui::Point point1, ui::Point point2);
|
||||||
void DrawLine(int toolSelection, ui::Point point1, ui::Point point2);
|
void DrawLine(int toolSelection, ui::Point point1, ui::Point point2);
|
||||||
void DrawFill(int toolSelection, ui::Point point);
|
void DrawFill(int toolSelection, ui::Point point);
|
||||||
ByteString StampRegion(ui::Point point1, ui::Point point2, bool includePressure);
|
ByteString StampRegion(ui::Point point1, ui::Point point2);
|
||||||
void CopyRegion(ui::Point point1, ui::Point point2, bool includePressure);
|
void CopyRegion(ui::Point point1, ui::Point point2);
|
||||||
void CutRegion(ui::Point point1, ui::Point point2, bool includePressure);
|
void CutRegion(ui::Point point1, ui::Point point2);
|
||||||
void Update();
|
void Update();
|
||||||
void SetPaused(bool pauseState);
|
void SetPaused(bool pauseState);
|
||||||
void SetPaused();
|
void SetPaused();
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
void OpenStamps();
|
void OpenStamps();
|
||||||
void OpenElementSearch();
|
void OpenElementSearch();
|
||||||
void OpenColourPicker();
|
void OpenColourPicker();
|
||||||
void PlaceSave(ui::Point position, bool includePressure);
|
void PlaceSave(ui::Point position);
|
||||||
void ClearSim();
|
void ClearSim();
|
||||||
void ReloadSim();
|
void ReloadSim();
|
||||||
void Vote(int direction);
|
void Vote(int direction);
|
||||||
|
@ -155,6 +155,7 @@ GameModel::GameModel():
|
|||||||
undoHistoryLimit = 200;
|
undoHistoryLimit = 200;
|
||||||
|
|
||||||
mouseClickRequired = Client::Ref().GetPrefBool("MouseClickRequired", false);
|
mouseClickRequired = Client::Ref().GetPrefBool("MouseClickRequired", false);
|
||||||
|
includePressure = Client::Ref().GetPrefBool("Simulation.IncludePressure", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameModel::~GameModel()
|
GameModel::~GameModel()
|
||||||
@ -185,6 +186,7 @@ GameModel::~GameModel()
|
|||||||
Client::Ref().SetPref("Simulation.UndoHistoryLimit", undoHistoryLimit);
|
Client::Ref().SetPref("Simulation.UndoHistoryLimit", undoHistoryLimit);
|
||||||
|
|
||||||
Client::Ref().SetPref("MouseClickRequired", mouseClickRequired);
|
Client::Ref().SetPref("MouseClickRequired", mouseClickRequired);
|
||||||
|
Client::Ref().SetPref("Simulation.IncludePressure", includePressure);
|
||||||
|
|
||||||
Favorite::Ref().SaveFavoritesToPrefs();
|
Favorite::Ref().SaveFavoritesToPrefs();
|
||||||
|
|
||||||
@ -662,7 +664,7 @@ void GameModel::SetSave(SaveInfo * newSave)
|
|||||||
sim->grav->stop_grav_async();
|
sim->grav->stop_grav_async();
|
||||||
sim->clear_sim();
|
sim->clear_sim();
|
||||||
ren->ClearAccumulation();
|
ren->ClearAccumulation();
|
||||||
if (!sim->Load(saveData))
|
if (!sim->Load(saveData, GetIncludePressure()))
|
||||||
{
|
{
|
||||||
// This save was created before logging existed
|
// This save was created before logging existed
|
||||||
// Add in the correct info
|
// Add in the correct info
|
||||||
@ -727,7 +729,7 @@ void GameModel::SetSaveFile(SaveFile * newSave)
|
|||||||
}
|
}
|
||||||
sim->clear_sim();
|
sim->clear_sim();
|
||||||
ren->ClearAccumulation();
|
ren->ClearAccumulation();
|
||||||
if (!sim->Load(saveData))
|
if (!sim->Load(saveData, GetIncludePressure()))
|
||||||
{
|
{
|
||||||
Client::Ref().OverwriteAuthorInfo(saveData->authors);
|
Client::Ref().OverwriteAuthorInfo(saveData->authors);
|
||||||
}
|
}
|
||||||
@ -1307,4 +1309,14 @@ bool GameModel::GetMouseClickRequired()
|
|||||||
void GameModel::SetMouseClickRequired(bool mouseClickRequired_)
|
void GameModel::SetMouseClickRequired(bool mouseClickRequired_)
|
||||||
{
|
{
|
||||||
mouseClickRequired = mouseClickRequired_;
|
mouseClickRequired = mouseClickRequired_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GameModel::GetIncludePressure()
|
||||||
|
{
|
||||||
|
return includePressure;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameModel::SetIncludePressure(bool includePressure_)
|
||||||
|
{
|
||||||
|
includePressure = includePressure_;
|
||||||
|
}
|
||||||
|
@ -68,6 +68,7 @@ private:
|
|||||||
unsigned int historyPosition;
|
unsigned int historyPosition;
|
||||||
unsigned int undoHistoryLimit;
|
unsigned int undoHistoryLimit;
|
||||||
bool mouseClickRequired;
|
bool mouseClickRequired;
|
||||||
|
bool includePressure;
|
||||||
|
|
||||||
size_t activeColourPreset;
|
size_t activeColourPreset;
|
||||||
std::vector<ui::Colour> colourPresets;
|
std::vector<ui::Colour> colourPresets;
|
||||||
@ -204,7 +205,9 @@ public:
|
|||||||
GameSave * GetClipboard();
|
GameSave * GetClipboard();
|
||||||
GameSave * GetPlaceSave();
|
GameSave * GetPlaceSave();
|
||||||
bool GetMouseClickRequired();
|
bool GetMouseClickRequired();
|
||||||
void SetMouseClickRequired(bool mouseClickRequired_);
|
void SetMouseClickRequired(bool mouseClickRequired);
|
||||||
|
bool GetIncludePressure();
|
||||||
|
void SetIncludePressure(bool includePressure);
|
||||||
|
|
||||||
std::vector<Notification*> GetNotifications();
|
std::vector<Notification*> GetNotifications();
|
||||||
void AddNotification(Notification * notification);
|
void AddNotification(Notification * notification);
|
||||||
|
@ -1274,7 +1274,7 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
|
|||||||
if (thumbY+(placeSaveThumb->Height) >= YRES)
|
if (thumbY+(placeSaveThumb->Height) >= YRES)
|
||||||
thumbY = YRES-placeSaveThumb->Height;
|
thumbY = YRES-placeSaveThumb->Height;
|
||||||
|
|
||||||
c->PlaceSave(ui::Point(thumbX, thumbY), !shiftBehaviour);
|
c->PlaceSave(ui::Point(thumbX, thumbY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1284,11 +1284,11 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
|
|||||||
int x1 = (selectPoint2.X<selectPoint1.X) ? selectPoint2.X : selectPoint1.X;
|
int x1 = (selectPoint2.X<selectPoint1.X) ? selectPoint2.X : selectPoint1.X;
|
||||||
int y1 = (selectPoint2.Y<selectPoint1.Y) ? selectPoint2.Y : selectPoint1.Y;
|
int y1 = (selectPoint2.Y<selectPoint1.Y) ? selectPoint2.Y : selectPoint1.Y;
|
||||||
if (selectMode ==SelectCopy)
|
if (selectMode ==SelectCopy)
|
||||||
c->CopyRegion(ui::Point(x1, y1), ui::Point(x2, y2), !shiftBehaviour);
|
c->CopyRegion(ui::Point(x1, y1), ui::Point(x2, y2));
|
||||||
else if (selectMode == SelectCut)
|
else if (selectMode == SelectCut)
|
||||||
c->CutRegion(ui::Point(x1, y1), ui::Point(x2, y2), !shiftBehaviour);
|
c->CutRegion(ui::Point(x1, y1), ui::Point(x2, y2));
|
||||||
else if (selectMode == SelectStamp)
|
else if (selectMode == SelectStamp)
|
||||||
c->StampRegion(ui::Point(x1, y1), ui::Point(x2, y2), !shiftBehaviour);
|
c->StampRegion(ui::Point(x1, y1), ui::Point(x2, y2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectMode = SelectNone;
|
selectMode = SelectNone;
|
||||||
|
@ -97,6 +97,11 @@ void OptionsController::SetMouseClickrequired(bool mouseClickRequired)
|
|||||||
model->SetMouseClickRequired(mouseClickRequired);
|
model->SetMouseClickRequired(mouseClickRequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsController::SetIncludePressure(bool includePressure)
|
||||||
|
{
|
||||||
|
model->SetIncludePressure(includePressure);
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsController::Exit()
|
void OptionsController::Exit()
|
||||||
{
|
{
|
||||||
view->CloseActiveWindow();
|
view->CloseActiveWindow();
|
||||||
|
@ -29,6 +29,7 @@ public:
|
|||||||
void SetFastQuit(bool fastquit);
|
void SetFastQuit(bool fastquit);
|
||||||
void SetShowAvatars(bool showAvatars);
|
void SetShowAvatars(bool showAvatars);
|
||||||
void SetMouseClickrequired(bool mouseClickRequired);
|
void SetMouseClickrequired(bool mouseClickRequired);
|
||||||
|
void SetIncludePressure(bool includePressure);
|
||||||
|
|
||||||
void Exit();
|
void Exit();
|
||||||
OptionsView * GetView();
|
OptionsView * GetView();
|
||||||
|
@ -192,6 +192,18 @@ void OptionsModel::SetMouseClickRequired(bool mouseClickRequired)
|
|||||||
notifySettingsChanged();
|
notifySettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OptionsModel::GetIncludePressure()
|
||||||
|
{
|
||||||
|
return Client::Ref().GetPrefBool("Simulation.IncludePressure", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsModel::SetIncludePressure(bool includePressure)
|
||||||
|
{
|
||||||
|
Client::Ref().SetPref("Simulation.IncludePressure", includePressure);
|
||||||
|
gModel->SetIncludePressure(includePressure);
|
||||||
|
notifySettingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsModel::notifySettingsChanged()
|
void OptionsModel::notifySettingsChanged()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
|
@ -45,6 +45,8 @@ public:
|
|||||||
void SetFastQuit(bool fastquit);
|
void SetFastQuit(bool fastquit);
|
||||||
bool GetMouseClickRequired();
|
bool GetMouseClickRequired();
|
||||||
void SetMouseClickRequired(bool mouseClickRequired);
|
void SetMouseClickRequired(bool mouseClickRequired);
|
||||||
|
bool GetIncludePressure();
|
||||||
|
void SetIncludePressure(bool includePressure);
|
||||||
virtual ~OptionsModel();
|
virtual ~OptionsModel();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -397,6 +397,26 @@ OptionsView::OptionsView():
|
|||||||
scrollPanel->AddChild(tempLabel);
|
scrollPanel->AddChild(tempLabel);
|
||||||
scrollPanel->AddChild(mouseClickRequired);
|
scrollPanel->AddChild(mouseClickRequired);
|
||||||
|
|
||||||
|
class IncludePressureAction: public ui::CheckboxAction
|
||||||
|
{
|
||||||
|
OptionsView * v;
|
||||||
|
public:
|
||||||
|
IncludePressureAction(OptionsView * v_){ v = v_; }
|
||||||
|
void ActionCallback(ui::Checkbox * sender) override {
|
||||||
|
v->c->SetIncludePressure(sender->GetChecked());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
currentY+=20;
|
||||||
|
includePressure = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Include Pressure", "");
|
||||||
|
autowidth(includePressure);
|
||||||
|
includePressure->SetActionCallback(new IncludePressureAction(this));
|
||||||
|
tempLabel = new ui::Label(ui::Point(includePressure->Position.X+Graphics::textwidth(includePressure->GetText())+20, currentY), ui::Point(1, 16), "\bg- When saving, loading, stamping, etc.");
|
||||||
|
autowidth(tempLabel);
|
||||||
|
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
|
scrollPanel->AddChild(tempLabel);
|
||||||
|
scrollPanel->AddChild(includePressure);
|
||||||
|
|
||||||
class DataFolderAction: public ui::ButtonAction
|
class DataFolderAction: public ui::ButtonAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -466,6 +486,7 @@ void OptionsView::NotifySettingsChanged(OptionsModel * sender)
|
|||||||
fastquit->SetChecked(sender->GetFastQuit());
|
fastquit->SetChecked(sender->GetFastQuit());
|
||||||
showAvatars->SetChecked(sender->GetShowAvatars());
|
showAvatars->SetChecked(sender->GetShowAvatars());
|
||||||
mouseClickRequired->SetChecked(sender->GetMouseClickRequired());
|
mouseClickRequired->SetChecked(sender->GetMouseClickRequired());
|
||||||
|
includePressure->SetChecked(sender->GetIncludePressure());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsView::AttachController(OptionsController * c_)
|
void OptionsView::AttachController(OptionsController * c_)
|
||||||
|
@ -31,6 +31,7 @@ class OptionsView: public ui::Window
|
|||||||
ui::Checkbox * fastquit;
|
ui::Checkbox * fastquit;
|
||||||
ui::Checkbox * showAvatars;
|
ui::Checkbox * showAvatars;
|
||||||
ui::Checkbox * mouseClickRequired;
|
ui::Checkbox * mouseClickRequired;
|
||||||
|
ui::Checkbox * includePressure;
|
||||||
ui::ScrollPanel * scrollPanel;
|
ui::ScrollPanel * scrollPanel;
|
||||||
public:
|
public:
|
||||||
OptionsView();
|
OptionsView();
|
||||||
|
@ -1654,8 +1654,7 @@ int LuaScriptInterface::simulation_saveStamp(lua_State * l)
|
|||||||
int y = luaL_optint(l,2,0);
|
int y = luaL_optint(l,2,0);
|
||||||
int w = luaL_optint(l,3,XRES-1);
|
int w = luaL_optint(l,3,XRES-1);
|
||||||
int h = luaL_optint(l,4,YRES-1);
|
int h = luaL_optint(l,4,YRES-1);
|
||||||
int includePressure = luaL_optint(l,5,1);
|
ByteString name = luacon_controller->StampRegion(ui::Point(x, y), ui::Point(x+w, y+h));
|
||||||
ByteString name = luacon_controller->StampRegion(ui::Point(x, y), ui::Point(x+w, y+h), includePressure);
|
|
||||||
lua_pushstring(l, name.c_str());
|
lua_pushstring(l, name.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1666,7 +1665,6 @@ int LuaScriptInterface::simulation_loadStamp(lua_State * l)
|
|||||||
SaveFile * tempfile = NULL;
|
SaveFile * tempfile = NULL;
|
||||||
int x = luaL_optint(l,2,0);
|
int x = luaL_optint(l,2,0);
|
||||||
int y = luaL_optint(l,3,0);
|
int y = luaL_optint(l,3,0);
|
||||||
int includePressure = luaL_optint(l,4,1);
|
|
||||||
if (lua_isstring(l, 1)) //Load from 10 char name, or full filename
|
if (lua_isstring(l, 1)) //Load from 10 char name, or full filename
|
||||||
{
|
{
|
||||||
const char * filename = luaL_optstring(l, 1, "");
|
const char * filename = luaL_optstring(l, 1, "");
|
||||||
@ -1683,7 +1681,7 @@ int LuaScriptInterface::simulation_loadStamp(lua_State * l)
|
|||||||
|
|
||||||
if (tempfile)
|
if (tempfile)
|
||||||
{
|
{
|
||||||
if (!luacon_sim->Load(x, y, tempfile->GetGameSave(), includePressure))
|
if (!luacon_sim->Load(tempfile->GetGameSave(), luacon_model->GetIncludePressure(), x, y))
|
||||||
{
|
{
|
||||||
//luacon_sim->sys_pause = (tempfile->GetGameSave()->paused | luacon_model->GetPaused())?1:0;
|
//luacon_sim->sys_pause = (tempfile->GetGameSave()->paused | luacon_model->GetPaused())?1:0;
|
||||||
lua_pushinteger(l, 1);
|
lua_pushinteger(l, 1);
|
||||||
|
@ -46,7 +46,7 @@ VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
|
|||||||
g->Clear();
|
g->Clear();
|
||||||
sim->clear_sim();
|
sim->clear_sim();
|
||||||
|
|
||||||
if(!sim->Load(save))
|
if(!sim->Load(save, true))
|
||||||
{
|
{
|
||||||
ren->decorations_enable = true;
|
ren->decorations_enable = true;
|
||||||
ren->blackDecorations = !decorations;
|
ren->blackDecorations = !decorations;
|
||||||
|
@ -37,10 +37,10 @@
|
|||||||
|
|
||||||
int Simulation::Load(GameSave * save, bool includePressure)
|
int Simulation::Load(GameSave * save, bool includePressure)
|
||||||
{
|
{
|
||||||
return Load(0, 0, save, includePressure);
|
return Load(save, includePressure, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Simulation::Load(int fullX, int fullY, GameSave * save, bool includePressure)
|
int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY)
|
||||||
{
|
{
|
||||||
int x, y, r;
|
int x, y, r;
|
||||||
|
|
||||||
@ -325,10 +325,10 @@ int Simulation::Load(int fullX, int fullY, GameSave * save, bool includePressure
|
|||||||
|
|
||||||
GameSave * Simulation::Save(bool includePressure)
|
GameSave * Simulation::Save(bool includePressure)
|
||||||
{
|
{
|
||||||
return Save(0, 0, XRES-1, YRES-1, includePressure);
|
return Save(includePressure, 0, 0, XRES-1, YRES-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameSave * Simulation::Save(int fullX, int fullY, int fullX2, int fullY2, bool includePressure)
|
GameSave * Simulation::Save(bool includePressure, int fullX, int fullY, int fullX2, int fullY2)
|
||||||
{
|
{
|
||||||
int blockX, blockY, blockX2, blockY2, blockW, blockH;
|
int blockX, blockY, blockX2, blockY2, blockW, blockH;
|
||||||
//Normalise incoming coords
|
//Normalise incoming coords
|
||||||
|
@ -114,10 +114,10 @@ public:
|
|||||||
int sandcolour;
|
int sandcolour;
|
||||||
int sandcolour_frame;
|
int sandcolour_frame;
|
||||||
|
|
||||||
int Load(GameSave * save, bool includePressure = true);
|
int Load(GameSave * save, bool includePressure);
|
||||||
int Load(int x, int y, GameSave * save, bool includePressure = true);
|
int Load(GameSave * save, bool includePressure, int x, int y);
|
||||||
GameSave * Save(bool includePressure = true);
|
GameSave * Save(bool includePressure);
|
||||||
GameSave * Save(int x1, int y1, int x2, int y2, bool includePressure = true);
|
GameSave * Save(bool includePressure, int x1, int y1, int x2, int y2);
|
||||||
void SaveSimOptions(GameSave * gameSave);
|
void SaveSimOptions(GameSave * gameSave);
|
||||||
SimulationSample GetSample(int x, int y);
|
SimulationSample GetSample(int x, int y);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user