summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/game/GameController.cpp12
-rw-r--r--src/gui/game/GameController.h1
-rw-r--r--src/gui/game/GameView.cpp26
3 files changed, 34 insertions, 5 deletions
diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp
index b6d0560..a114b82 100644
--- a/src/gui/game/GameController.cpp
+++ b/src/gui/game/GameController.cpp
@@ -749,7 +749,7 @@ void GameController::ResetSpark()
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;
+ sim->parts[i].ctype = sim->parts[i].life = 0;
}
else
sim->kill_part(i);
@@ -1389,6 +1389,16 @@ std::string GameController::ElementResolve(int type, int ctype)
return "";
}
+bool GameController::IsValidElement(int type)
+{
+ if(gameModel && gameModel->GetSimulation())
+ {
+ return (type > 0 && type < PT_NUM && gameModel->GetSimulation()->elements[type].Enabled);
+ }
+ else
+ return false;
+}
+
std::string GameController::WallName(int type)
{
if(gameModel && gameModel->GetSimulation() && gameModel->GetSimulation()->wtypes && type >= 0 && type < UI_WALLCOUNT)
diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h
index d723ccb..b2a7d99 100644
--- a/src/gui/game/GameController.h
+++ b/src/gui/game/GameController.h
@@ -137,6 +137,7 @@ public:
ui::Point PointTranslate(ui::Point point);
ui::Point NormaliseBlockCoord(ui::Point point);
std::string ElementResolve(int type, int ctype);
+ bool IsValidElement(int type);
std::string WallName(int type);
void ResetAir();
diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp
index f7fa6f5..1dad1f8 100644
--- a/src/gui/game/GameView.cpp
+++ b/src/gui/game/GameView.cpp
@@ -1473,6 +1473,13 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
else
c->InvertAirSim();
break;
+ case ';':
+ if (ctrl)
+ {
+ c->SetReplaceModeFlags(c->GetReplaceModeFlags()^SPECIFIC_DELETE);
+ break;
+ }
+ //fancy case switch without break
case SDLK_INSERT:
c->SetReplaceModeFlags(c->GetReplaceModeFlags()^REPLACE_MODE);
break;
@@ -2062,16 +2069,25 @@ void GameView::OnDraw()
ctype = sample.particle.tmp&0xFF;
if(showDebug)
{
- if (sample.particle.type == PT_LAVA && ctype > 0 && ctype < PT_NUM)
+ if (sample.particle.type == PT_LAVA && c->IsValidElement(ctype))
sampleInfo << "Molten " << c->ElementResolve(ctype, -1);
- else if ((sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) && ctype > 0 && ctype < PT_NUM)
+ else if ((sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) && c->IsValidElement(ctype))
sampleInfo << c->ElementResolve(sample.particle.type, -1) << " with " << c->ElementResolve(ctype, (int)sample.particle.pavg[1]);
else if (sample.particle.type == PT_LIFE)
sampleInfo << c->ElementResolve(sample.particle.type, sample.particle.ctype);
+ else if (sample.particle.type == PT_FILT)
+ {
+ sampleInfo << c->ElementResolve(sample.particle.type, sample.particle.ctype);
+ const char* filtModes[] = {"set colour", "AND", "OR", "subtract colour", "red shift", "blue shift", "no effect", "XOR", "NOT"};
+ if (sample.particle.tmp>=0 && sample.particle.tmp<=8)
+ sampleInfo << " (" << filtModes[sample.particle.tmp] << ")";
+ else
+ sampleInfo << " (unknown mode)";
+ }
else
{
sampleInfo << c->ElementResolve(sample.particle.type, sample.particle.ctype);
- if(ctype > 0 && ctype < PT_NUM)
+ if (c->IsValidElement(ctype))
sampleInfo << " (" << c->ElementResolve(ctype, -1) << ")";
else
sampleInfo << " ()";
@@ -2094,7 +2110,9 @@ void GameView::OnDraw()
sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
}
- if(sample.particle.type == PT_PHOT)
+ if (sample.particle.type == PT_PHOT || sample.particle.type == PT_BIZR || sample.particle.type == PT_BIZRG || sample.particle.type == PT_BIZRS)
+ wavelengthGfx = sample.particle.ctype;
+ if (sample.particle.type == PT_FILT && sample.particle.ctype)
wavelengthGfx = sample.particle.ctype;
}
else if (sample.WallType)