diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index d9c2d7207..e4ee15ba8 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 22d21eab3..efe483112 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 417277267..2cc33be9b 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: