Correct save reloading, add Vac and NGrav tools
This commit is contained in:
parent
f6f83cc276
commit
6f814528fc
@ -612,7 +612,7 @@ void GameController::ReloadSim()
|
|||||||
{
|
{
|
||||||
if(gameModel->GetSave() && gameModel->GetSave()->GetGameSave())
|
if(gameModel->GetSave() && gameModel->GetSave()->GetGameSave())
|
||||||
{
|
{
|
||||||
gameModel->GetSimulation()->Load(gameModel->GetSave()->GetGameSave());
|
gameModel->SetSave(gameModel->GetSave());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
void SetActiveMenu(Menu * menu);
|
void SetActiveMenu(Menu * menu);
|
||||||
void SetActiveTool(int toolSelection, Tool * tool);
|
void SetActiveTool(int toolSelection, Tool * tool);
|
||||||
void SetColour(ui::Colour colour);
|
void SetColour(ui::Colour colour);
|
||||||
|
void SetToolStrength(float value);
|
||||||
void OpenSearch();
|
void OpenSearch();
|
||||||
void OpenLogin();
|
void OpenLogin();
|
||||||
void OpenTags();
|
void OpenTags();
|
||||||
|
@ -281,13 +281,13 @@ SaveInfo * GameModel::GetSave()
|
|||||||
|
|
||||||
void GameModel::SetSave(SaveInfo * newSave)
|
void GameModel::SetSave(SaveInfo * newSave)
|
||||||
{
|
{
|
||||||
if(currentSave)
|
if(currentSave != newSave)
|
||||||
delete currentSave;
|
delete currentSave;
|
||||||
currentSave = newSave;
|
currentSave = newSave;
|
||||||
if(currentSave && currentSave->GetGameSave())
|
if(currentSave && currentSave->GetGameSave())
|
||||||
{
|
{
|
||||||
GameSave * saveData = currentSave->GetGameSave();
|
GameSave * saveData = currentSave->GetGameSave();
|
||||||
SetPaused(saveData->paused);
|
SetPaused(saveData->paused & GetPaused());
|
||||||
sim->gravityMode = saveData->gravityMode;
|
sim->gravityMode = saveData->gravityMode;
|
||||||
sim->air->airMode = saveData->airMode;
|
sim->air->airMode = saveData->airMode;
|
||||||
sim->legacy_enable = saveData->legacyEnable;
|
sim->legacy_enable = saveData->legacyEnable;
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
#include "Simulation.h"
|
#include "Simulation.h"
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
#include "SaveLoader.h"
|
|
||||||
|
|
||||||
|
|
||||||
SaveRenderer::SaveRenderer(){
|
SaveRenderer::SaveRenderer(){
|
||||||
|
18
src/simulation/tools/NGrv.cpp
Normal file
18
src/simulation/tools/NGrv.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "simulation/Tools.h"
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
//#TPT-Directive ToolClass Tool_NGrv TOOL_NGRV 5
|
||||||
|
Tool_NGrv::Tool_NGrv()
|
||||||
|
{
|
||||||
|
Identifier = "DEFAULT_TOOL_NGRV";
|
||||||
|
Name = "NGRV";
|
||||||
|
Colour = PIXPACK(0xAACCFF);
|
||||||
|
Description = "Creates a short-lasting negative gravity well";
|
||||||
|
}
|
||||||
|
|
||||||
|
int Tool_NGrv::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
|
||||||
|
{
|
||||||
|
sim->gravmap[((y/CELL)*(XRES/CELL))+(x/CELL)] += 0.03f*strength;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tool_NGrv::~Tool_NGrv() {}
|
18
src/simulation/tools/Vac.cpp
Normal file
18
src/simulation/tools/Vac.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "simulation/Tools.h"
|
||||||
|
#include "simulation/Air.h"
|
||||||
|
//#TPT-Directive ToolClass Tool_Vac TOOL_VAC 2
|
||||||
|
Tool_Vac::Tool_Vac()
|
||||||
|
{
|
||||||
|
Identifier = "DEFAULT_TOOL_VAC";
|
||||||
|
Name = "VAC";
|
||||||
|
Colour = PIXPACK(0x000000);
|
||||||
|
Description = "Removes air pressure";
|
||||||
|
}
|
||||||
|
|
||||||
|
int Tool_Vac::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
|
||||||
|
{
|
||||||
|
sim->air->pv[y/CELL][x/CELL] -= 0.03f*strength;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tool_Vac::~Tool_Vac() {}
|
Loading…
Reference in New Issue
Block a user