diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-05 15:59:14 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-05 15:59:14 (GMT) |
| commit | 30f8049efc6efc086509d235df413e4932dab83e (patch) | |
| tree | 96642c3f8a63e15a40c448c23f5ada446eba673b /src/game | |
| parent | 9e309135d403f0f99f586015ffd194a8914ae504 (diff) | |
| download | powder-30f8049efc6efc086509d235df413e4932dab83e.zip powder-30f8049efc6efc086509d235df413e4932dab83e.tar.gz | |
Allow 24bits of var for create_part, add tool for tesc. Fixes #72
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/GameModel.cpp | 4 | ||||
| -rw-r--r-- | src/game/Tool.cpp | 21 | ||||
| -rw-r--r-- | src/game/Tool.h | 12 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index c56c195..91d6a4f 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -171,6 +171,10 @@ void GameModel::BuildMenus() { 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), sim->elements[i].IconGenerator); } + else if(i == PT_TESC) + { + tempTool = new Element_TESC_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), sim->elements[i].IconGenerator); + } else if(i == PT_STKM || i == PT_FIGH || i == PT_STKM2) { tempTool = new PlopTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator); diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp index 3a9fc1e..10b7b0d 100644 --- a/src/game/Tool.cpp +++ b/src/game/Tool.cpp @@ -176,6 +176,27 @@ void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position } } +Element_TESC_Tool::Element_TESC_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)): + ElementTool(id, name, description, r, g, b, textureGen) + { + } +void Element_TESC_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position){ + int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7; + sim->CreateParts(position.X, position.Y, toolID | (radiusInfo << 8), brush); +} +void Element_TESC_Tool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging) { + int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7; + sim->CreateLine(position1.X, position1.Y, position2.X, position2.Y, toolID | (radiusInfo << 8), brush); +} +void Element_TESC_Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7; + sim->CreateBox(position1.X, position1.Y, position2.X, position2.Y, toolID | (radiusInfo << 8), 0); +} +void Element_TESC_Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) { + int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7; + sim->FloodParts(position.X, position.Y, toolID | (radiusInfo << 8), -1, -1, 0); +} + void PlopTool::Click(Simulation * sim, Brush * brush, ui::Point position) { sim->create_part(-1, position.X, position.Y, toolID); diff --git a/src/game/Tool.h b/src/game/Tool.h index aa021fc..bee1fd8 100644 --- a/src/game/Tool.h +++ b/src/game/Tool.h @@ -86,6 +86,7 @@ public: virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { } }; + class ElementTool: public Tool { public: @@ -97,6 +98,17 @@ public: virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position); }; +class Element_TESC_Tool: public ElementTool +{ +public: + Element_TESC_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL); + virtual ~Element_TESC_Tool() {} + virtual void Draw(Simulation * sim, Brush * brush, ui::Point position); + virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false); + virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2); + virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position); +}; + class PlopTool: public ElementTool { public: |
