save more settings in powder.pref like ngrav_enable, aheat_enable, pretty powders, and debug hud. Also save ambient heat in saves, and add a warning in the intro text in betas that you can't save publically
This commit is contained in:
parent
c1320d2007
commit
519d220101
@ -22,7 +22,11 @@ static const char *introTextData =
|
||||
"\bgSimon Robertshaw, Skresanov Savely, cracker64, Catelite, Bryan Hoyle, Nathan Cousins, jacksonmj,\n"
|
||||
"\bgFelix Wallin, Lieuwe Mosch, Anthony Boot, Matthew \"me4502\", MaksProg, jacob1, mniip\n"
|
||||
"\n"
|
||||
#ifndef BETA
|
||||
"\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html\n"
|
||||
#else
|
||||
"\brThis is a BETA, you cannot save things publicly. If you are planning on publishing any saves, use the release version\n"
|
||||
#endif
|
||||
"\n"
|
||||
"\bt" MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) "." MTOS(BUILD_NUM) " " IDENT_PLATFORM " "
|
||||
#ifdef X86
|
||||
|
@ -20,6 +20,7 @@ legacyEnable(save.legacyEnable),
|
||||
gravityEnable(save.gravityEnable),
|
||||
paused(save.paused),
|
||||
gravityMode(save.gravityMode),
|
||||
aheatEnable(save.aheatEnable),
|
||||
airMode(save.airMode),
|
||||
signs(save.signs),
|
||||
expanded(save.expanded),
|
||||
@ -171,10 +172,11 @@ void GameSave::Expand()
|
||||
{
|
||||
if(hasOriginalData && !expanded)
|
||||
{
|
||||
waterEEnabled = 0;
|
||||
legacyEnable = 0;
|
||||
gravityEnable = 0;
|
||||
paused = 0;
|
||||
waterEEnabled = false;
|
||||
legacyEnable = false;
|
||||
gravityEnable = false;
|
||||
aheatEnable = false;
|
||||
paused = false;
|
||||
gravityMode = 0;
|
||||
airMode = 0;
|
||||
expanded = true;
|
||||
@ -618,6 +620,17 @@ void GameSave::readOPS(char * data, int dataLength)
|
||||
fprintf(stderr, "Wrong type for %s\n", bson_iterator_key(&iter));
|
||||
}
|
||||
}
|
||||
else if(!strcmp(bson_iterator_key(&iter), "aheat_enable"))
|
||||
{
|
||||
if(bson_iterator_type(&iter)==BSON_BOOL)
|
||||
{
|
||||
aheatEnable = bson_iterator_bool(&iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Wrong type for %s\n", bson_iterator_key(&iter));
|
||||
}
|
||||
}
|
||||
else if(strcmp(bson_iterator_key(&iter), "waterEEnabled")==0)
|
||||
{
|
||||
if(bson_iterator_type(&iter)==BSON_BOOL)
|
||||
@ -1973,6 +1986,7 @@ char * GameSave::serialiseOPS(int & dataLength)
|
||||
bson_append_bool(&b, "waterEEnabled", waterEEnabled);
|
||||
bson_append_bool(&b, "legacyEnable", legacyEnable);
|
||||
bson_append_bool(&b, "gravityEnable", gravityEnable);
|
||||
bson_append_bool(&b, "aheat_enable", aheatEnable);
|
||||
bson_append_bool(&b, "paused", paused);
|
||||
bson_append_int(&b, "gravityMode", gravityMode);
|
||||
bson_append_int(&b, "airMode", airMode);
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
bool waterEEnabled;
|
||||
bool legacyEnable;
|
||||
bool gravityEnable;
|
||||
bool aheatEnable;
|
||||
bool paused;
|
||||
int gravityMode;
|
||||
int airMode;
|
||||
|
@ -150,6 +150,8 @@ GameController::GameController():
|
||||
gameView->AttachController(this);
|
||||
gameModel->AddObserver(gameView);
|
||||
|
||||
gameView->SetDebugHUD(Client::Ref().GetPrefBool("Renderer.DebugMode", false));
|
||||
|
||||
#ifdef LUACONSOLE
|
||||
commandInterface = new LuaScriptInterface(this, gameModel);
|
||||
((LuaScriptInterface*)commandInterface)->SetWindow(gameView);
|
||||
@ -1016,6 +1018,7 @@ void GameController::OpenLocalSaveWindow(bool asCurrent)
|
||||
gameSave->legacyEnable = sim->legacy_enable;
|
||||
gameSave->waterEEnabled = sim->water_equal_test;
|
||||
gameSave->gravityEnable = sim->grav->ngrav_enable;
|
||||
gameSave->aheatEnable = sim->aheat_enable;
|
||||
if(!gameSave)
|
||||
{
|
||||
new ErrorMessage("Error", "Unable to build save.");
|
||||
@ -1227,6 +1230,7 @@ void GameController::OpenSaveWindow()
|
||||
gameSave->legacyEnable = sim->legacy_enable;
|
||||
gameSave->waterEEnabled = sim->water_equal_test;
|
||||
gameSave->gravityEnable = sim->grav->ngrav_enable;
|
||||
gameSave->aheatEnable = sim->aheat_enable;
|
||||
if(!gameSave)
|
||||
{
|
||||
new ErrorMessage("Error", "Unable to build save.");
|
||||
@ -1278,6 +1282,7 @@ void GameController::SaveAsCurrent()
|
||||
gameSave->legacyEnable = sim->legacy_enable;
|
||||
gameSave->waterEEnabled = sim->water_equal_test;
|
||||
gameSave->gravityEnable = sim->grav->ngrav_enable;
|
||||
gameSave->aheatEnable = sim->aheat_enable;
|
||||
if(!gameSave)
|
||||
{
|
||||
new ErrorMessage("Error", "Unable to build save.");
|
||||
|
@ -83,6 +83,11 @@ GameModel::GameModel():
|
||||
//Load config into simulation
|
||||
edgeMode = Client::Ref().GetPrefInteger("Simulation.EdgeMode", 0);
|
||||
sim->SetEdgeMode(edgeMode);
|
||||
int ngrav_enable = Client::Ref().GetPrefInteger("Simulation.NewtonianGravity", 0);
|
||||
if (ngrav_enable)
|
||||
sim->grav->start_grav_async();
|
||||
sim->aheat_enable = Client::Ref().GetPrefInteger("Simulation.AmbientHeat", 0);
|
||||
sim->pretty_powder = Client::Ref().GetPrefInteger("Simulation.PrettyPowder", 0);
|
||||
|
||||
//Load last user
|
||||
if(Client::Ref().GetAuthUser().ID)
|
||||
@ -155,8 +160,12 @@ GameModel::~GameModel()
|
||||
|
||||
Client::Ref().SetPref("Renderer.GravityField", (bool)ren->gravityFieldEnabled);
|
||||
Client::Ref().SetPref("Renderer.Decorations", (bool)ren->decorations_enable);
|
||||
Client::Ref().SetPref("Renderer.DebugMode", ren->debugLines); //These two should always be equivalent, even though they are different things
|
||||
|
||||
Client::Ref().SetPref("Simulation.EdgeMode", sim->edgeMode);
|
||||
Client::Ref().SetPref("Simulation.NewtonianGravity", sim->grav->ngrav_enable);
|
||||
Client::Ref().SetPref("Simulation.AmbientHeat", sim->aheat_enable);
|
||||
Client::Ref().SetPref("Simulation.PrettyPowder", sim->pretty_powder);
|
||||
|
||||
Client::Ref().SetPref("Decoration.Red", (int)colour.Red);
|
||||
Client::Ref().SetPref("Decoration.Green", (int)colour.Green);
|
||||
@ -566,6 +575,7 @@ void GameModel::SetSave(SaveInfo * newSave)
|
||||
sim->air->airMode = saveData->airMode;
|
||||
sim->legacy_enable = saveData->legacyEnable;
|
||||
sim->water_equal_test = saveData->waterEEnabled;
|
||||
sim->aheat_enable = saveData->aheatEnable;
|
||||
if(saveData->gravityEnable)
|
||||
sim->grav->start_grav_async();
|
||||
else
|
||||
@ -607,6 +617,7 @@ void GameModel::SetSaveFile(SaveFile * newSave)
|
||||
sim->air->airMode = saveData->airMode;
|
||||
sim->legacy_enable = saveData->legacyEnable;
|
||||
sim->water_equal_test = saveData->waterEEnabled;
|
||||
sim->aheat_enable = saveData->aheatEnable;
|
||||
if(saveData->gravityEnable && !sim->grav->ngrav_enable)
|
||||
{
|
||||
sim->grav->start_grav_async();
|
||||
|
@ -192,7 +192,7 @@ int Element_PIPE::update(UPDATE_FUNC_ARGS)
|
||||
np = sim->create_part(-1,x+rx,y+ry,parts[i].tmp&0xFF);
|
||||
if (np!=-1)
|
||||
{
|
||||
transfer_pipe_to_part(parts+i, parts+np);
|
||||
transfer_pipe_to_part(sim, parts+i, parts+np);
|
||||
}
|
||||
}
|
||||
//try eating particle at entrance
|
||||
@ -374,8 +374,8 @@ int Element_PIPE::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_PIPE static void transfer_pipe_to_part(Particle *pipe, Particle *part)
|
||||
void Element_PIPE::transfer_pipe_to_part(Particle *pipe, Particle *part)
|
||||
//#TPT-Directive ElementHeader Element_PIPE static void transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part)
|
||||
void Element_PIPE::transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part)
|
||||
{
|
||||
part->type = (pipe->tmp & 0xFF);
|
||||
part->temp = pipe->temp;
|
||||
@ -384,7 +384,7 @@ void Element_PIPE::transfer_pipe_to_part(Particle *pipe, Particle *part)
|
||||
part->ctype = pipe->pavg[1];
|
||||
pipe->tmp &= ~0xFF;
|
||||
|
||||
if (part->type != PT_PHOT && part->type != PT_ELEC && part->type != PT_NEUT)
|
||||
if (!(sim->elements[part->type].Properties & TYPE_ENERGY))
|
||||
{
|
||||
part->vx = 0.0f;
|
||||
part->vy = 0.0f;
|
||||
@ -456,7 +456,7 @@ void Element_PIPE::pushParticle(Simulation * sim, int i, int count, int original
|
||||
for (nnx=0; nnx<80; nnx++)
|
||||
if (!sim->portalp[sim->parts[r>>8].tmp][count][nnx].type)
|
||||
{
|
||||
transfer_pipe_to_part(sim->parts+i, &(sim->portalp[sim->parts[r>>8].tmp][count][nnx]));
|
||||
transfer_pipe_to_part(sim, sim->parts+i, &(sim->portalp[sim->parts[r>>8].tmp][count][nnx]));
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
@ -482,7 +482,7 @@ void Element_PIPE::pushParticle(Simulation * sim, int i, int count, int original
|
||||
for (nnx=0; nnx<80; nnx++)
|
||||
if (!sim->portalp[sim->parts[r>>8].tmp][count][nnx].type)
|
||||
{
|
||||
transfer_pipe_to_part(sim->parts+i, &(sim->portalp[sim->parts[r>>8].tmp][count][nnx]));
|
||||
transfer_pipe_to_part(sim, sim->parts+i, &(sim->portalp[sim->parts[r>>8].tmp][count][nnx]));
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
@ -494,7 +494,7 @@ void Element_PIPE::pushParticle(Simulation * sim, int i, int count, int original
|
||||
np = sim->create_part(-1,x+rx,y+ry,sim->parts[i].tmp&0xFF);
|
||||
if (np!=-1)
|
||||
{
|
||||
transfer_pipe_to_part(sim->parts+i, sim->parts+np);
|
||||
transfer_pipe_to_part(sim, sim->parts+i, sim->parts+np);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user