summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-07-19 16:49:40 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-07-19 16:49:40 (GMT)
commit4d961117bde4398ae4d72f2db96eef381371e2df (patch)
treef11f5ceee26f9ab6a4d8de1ba4f9dcf9226701d7 /src
parentc2873180e224b93632daf01e40c6e6d0636bf86d (diff)
downloadpowder-4d961117bde4398ae4d72f2db96eef381371e2df.zip
powder-4d961117bde4398ae4d72f2db96eef381371e2df.tar.gz
Special ligh placement
Diffstat (limited to 'src')
-rw-r--r--src/game/GameModel.cpp13
-rw-r--r--src/game/Tool.cpp13
-rw-r--r--src/game/Tool.h15
3 files changed, 37 insertions, 4 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index d9c2d72..e4ee15b 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -61,7 +61,15 @@ GameModel::GameModel():
{
if(sim->elements[i].MenuSection < 12 && sim->elements[i].Enabled && sim->elements[i].MenuVisible)
{
- Tool * tempTool = new ElementTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
+ Tool * tempTool;
+ if(i == PT_LIGH)
+ {
+ tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
+ }
+ else
+ {
+ tempTool = new ElementTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
+ }
menuList[sim->elements[i].MenuSection]->AddTool(tempTool);
}
}
@@ -88,7 +96,8 @@ GameModel::GameModel():
//Build menu for simtools
for(int i = 0; i < sim->tools.size(); i++)
{
- Tool * tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour));
+ Tool * tempTool;
+ tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour));
menuList[SC_TOOL]->AddTool(tempTool);
}
diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp
index 22d21ea..efe4831 100644
--- a/src/game/Tool.cpp
+++ b/src/game/Tool.cpp
@@ -92,5 +92,14 @@ void GolTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
sim->FloodParts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0);
}
-
-
+void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position)
+{
+ int p = sim->create_part(-2, position.X, position.Y, toolID);
+ if (p != -1)
+ {
+ sim->parts[p].life = brush->GetRadius().X+brush->GetRadius().Y;
+ if (sim->parts[p].life > 55)
+ sim->parts[p].life = 55;
+ sim->parts[p].temp = sim->parts[p].life*150; // temperature of the lighting shows the power of the lighting
+ }
+} \ No newline at end of file
diff --git a/src/game/Tool.h b/src/game/Tool.h
index 4172772..2cc33be 100644
--- a/src/game/Tool.h
+++ b/src/game/Tool.h
@@ -66,6 +66,21 @@ public:
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
+class Element_LIGH_Tool: public Tool
+{
+public:
+ Element_LIGH_Tool(int id, string name, string description, int r, int g, int b):
+ Tool(id, name, description, r, g, b)
+ {
+ }
+ virtual ~Element_LIGH_Tool() {}
+ virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
+ virtual void Click(Simulation * sim, Brush * brush, ui::Point position) { }
+ virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
+ virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
+ virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
+};
+
class ElementTool: public Tool
{
public: