mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-01 06:00:15 +02:00
This commit is contained in:
@@ -406,6 +406,76 @@ void GameController::Exit()
|
||||
HasDone = true;
|
||||
}
|
||||
|
||||
void GameController::ResetAir()
|
||||
{
|
||||
gameModel->GetSimulation()->air->Clear();
|
||||
}
|
||||
|
||||
void GameController::ResetSpark()
|
||||
{
|
||||
Simulation * sim = gameModel->GetSimulation();
|
||||
for (int i = 0; i < NPART; i++)
|
||||
if (sim->parts[i].type == PT_SPRK)
|
||||
{
|
||||
if (sim->parts[i].ctype >= 0 && sim->parts[i].ctype < PT_NUM && sim->elements[sim->parts[i].ctype].Enabled)
|
||||
{
|
||||
sim->parts[i].type = sim->parts[i].ctype;
|
||||
sim->parts[i].life = 0;
|
||||
}
|
||||
else
|
||||
sim->kill_part(i);
|
||||
}
|
||||
}
|
||||
|
||||
void GameController::SwitchGravity()
|
||||
{
|
||||
gameModel->GetSimulation()->gravityMode = (gameModel->GetSimulation()->gravityMode+1)%3;
|
||||
|
||||
switch (gameModel->GetSimulation()->gravityMode)
|
||||
{
|
||||
case 0:
|
||||
gameModel->SetInfoTip("Gravity: Vertical");
|
||||
break;
|
||||
case 1:
|
||||
gameModel->SetInfoTip("Gravity: Off");
|
||||
break;
|
||||
case 2:
|
||||
gameModel->SetInfoTip("Gravity: Radial");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GameController::SwitchAir()
|
||||
{
|
||||
gameModel->GetSimulation()->air->airMode = (gameModel->GetSimulation()->air->airMode+1)%5;
|
||||
|
||||
switch (gameModel->GetSimulation()->air->airMode)
|
||||
{
|
||||
case 0:
|
||||
gameModel->SetInfoTip("Air: On");
|
||||
break;
|
||||
case 1:
|
||||
gameModel->SetInfoTip("Air: Pressure Off");
|
||||
break;
|
||||
case 2:
|
||||
gameModel->SetInfoTip("Air: Velocity Off");
|
||||
break;
|
||||
case 3:
|
||||
gameModel->SetInfoTip("Air: Off");
|
||||
break;
|
||||
case 4:
|
||||
gameModel->SetInfoTip("Air: No Update");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GameController::ToggleAHeat()
|
||||
{
|
||||
gameModel->GetSimulation()->aheat_enable = !gameModel->GetSimulation()->aheat_enable;
|
||||
gameModel->UpdateQuickOptions();
|
||||
}
|
||||
|
||||
|
||||
void GameController::LoadRenderPreset(RenderPreset preset)
|
||||
{
|
||||
Renderer * renderer = gameModel->GetRenderer();
|
||||
|
@@ -109,6 +109,12 @@ public:
|
||||
ui::Point NormaliseBlockCoord(ui::Point point);
|
||||
std::string ElementResolve(int type);
|
||||
|
||||
void ResetAir();
|
||||
void ResetSpark();
|
||||
void SwitchGravity();
|
||||
void SwitchAir();
|
||||
void ToggleAHeat();
|
||||
|
||||
void LoadClipboard();
|
||||
void LoadStamp();
|
||||
|
||||
|
@@ -1017,6 +1017,21 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
||||
selectMode = SelectStamp;
|
||||
selectPoint1 = ui::Point(-1, -1);
|
||||
break;
|
||||
case 'w':
|
||||
c->SwitchGravity();
|
||||
break;
|
||||
case 'y':
|
||||
c->SwitchAir();
|
||||
break;
|
||||
case 'u':
|
||||
c->ToggleAHeat();
|
||||
break;
|
||||
case '=':
|
||||
if(ctrl)
|
||||
c->ResetSpark();
|
||||
else
|
||||
c->ResetAir();
|
||||
break;
|
||||
case 'c':
|
||||
if(ctrl)
|
||||
{
|
||||
|
Reference in New Issue
Block a user