diff options
| author | jacob1 <jfu614@gmail.com> | 2013-07-18 21:57:04 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-07-18 21:57:04 (GMT) |
| commit | 6a4cc7e1f71ae042b58a84f4befa79e42072dd81 (patch) | |
| tree | 70ba5d4b31b878a9c71286f4f29043c05f485668 /src/gui/game/GameController.cpp | |
| parent | aa59c89fa2c401607adc7ac9a016537691602e6d (diff) | |
| download | powder-6a4cc7e1f71ae042b58a84f4befa79e42072dd81.zip powder-6a4cc7e1f71ae042b58a84f4befa79e42072dd81.tar.gz | |
stickmen element defaults to right selected element if possible, or else still DUST
Diffstat (limited to 'src/gui/game/GameController.cpp')
| -rw-r--r-- | src/gui/game/GameController.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index 311cc0c..f4ad0b2 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -839,7 +839,27 @@ void GameController::Update() else gameView->SetSample(gameModel->GetSimulation()->GetSample(pos.X, pos.Y)); - gameModel->GetSimulation()->update_particles(); + Simulation * sim = gameModel->GetSimulation(); + sim->update_particles(); + + //if either STKM or STK2 isn't out, reset it's selected element. Defaults to PT_DUST unless right selected is something else + //This won't run if the stickmen dies in a frame, since it respawns instantly + if (!sim->player.spwn || !sim->player2.spwn) + { + int rightSelected = PT_DUST; + Tool * activeTool = gameModel->GetActiveTool(1); + if (activeTool->GetIdentifier().find("DEFAULT_PT_") != activeTool->GetIdentifier().npos) + { + int sr = activeTool->GetToolID(); + if ((sr>0 && sr<PT_NUM && sim->elements[sr].Enabled && sim->elements[sr].Falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT || sr == PT_LIGH) + rightSelected = sr; + } + + if (!sim->player.spwn) + sim->player.elem = rightSelected; + if (!sim->player2.spwn) + sim->player2.elem = rightSelected; + } if(renderOptions && renderOptions->HasExited) { delete renderOptions; |
