diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 756604408..85f54d389 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -167,15 +167,15 @@ void GameModel::BuildMenus() 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)); + 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_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)); + 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); } 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)); + 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), sim->elements[i].IconGenerator); } menuList[sim->elements[i].MenuSection]->AddTool(tempTool); } diff --git a/src/game/SignTool.cpp b/src/game/SignTool.cpp index 0ad755e47..cea697871 100644 --- a/src/game/SignTool.cpp +++ b/src/game/SignTool.cpp @@ -138,8 +138,8 @@ VideoBuffer * SignTool::GetIcon(int toolID, int width, int height) newTexture->SetPixel(x, y, PIXR(pc), PIXG(pc), PIXB(pc), 255); } } - newTexture->SetCharacter((width/2)-5, (height/2)-4, 0xA1, 32, 64, 128, 255); - newTexture->SetCharacter((width/2)-5, (height/2)-4, 0xA0, 255, 255, 255, 255); + newTexture->SetCharacter((width/2)-5, (height/2)-5, 0xA1, 32, 64, 128, 255); + newTexture->SetCharacter((width/2)-5, (height/2)-5, 0xA0, 255, 255, 255, 255); return newTexture; } diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp index 43c28001b..e3f1dedcc 100644 --- a/src/game/Tool.cpp +++ b/src/game/Tool.cpp @@ -30,6 +30,10 @@ VideoBuffer * Tool::GetTexture(int width, int height) } return NULL; } +void Tool::SetTextureGen(VideoBuffer * (*textureGen)(int, int, int)) +{ + this->textureGen = textureGen; +} string Tool::GetName() { return toolName; } string Tool::GetDescription() { return toolDescription; } Tool::~Tool() {} diff --git a/src/game/Tool.h b/src/game/Tool.h index 1b7076890..aa021fc01 100644 --- a/src/game/Tool.h +++ b/src/game/Tool.h @@ -30,6 +30,7 @@ public: string GetName(); string GetDescription(); VideoBuffer * GetTexture(int width, int height); + void SetTextureGen(VideoBuffer * (*textureGen)(int, int, int)); virtual ~Tool(); virtual void Click(Simulation * sim, Brush * brush, ui::Point position); virtual void Draw(Simulation * sim, Brush * brush, ui::Point position); diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index f18dbbb33..9949926eb 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -441,17 +441,18 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height) if (wt==WL_EWALL) { for (j=0; j width/2) - { - if (i&j&1) - newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); - } - else - { - if (!(i&j&1)) - newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); - } + { + for (i=0; i<(width/4)+j; i++) + { + if (!(i&j&1)) + newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); + } + for (; iSetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); + } + } } else if (wt==WL_WALLELEC) { @@ -467,17 +468,18 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height) else if (wt==WL_EHOLE) { for (j=0; jSetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); - } - else - { - if (!(i&j&1)) - newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); - } + { + for (i=0; i<(width/4)+j; i++) + { + if (i&j&1) + newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); + } + for (; iSetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); + } + } } else if (wt == WL_ERASE) { @@ -495,12 +497,12 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height) newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); } } - for (j=4; jSetPixel(j+6, j, 0xFF, 0, 0, 255); newTexture->SetPixel(j+7, j, 0xFF, 0, 0, 255); - newTexture->SetPixel(-j+21, j, 0xFF, 0, 0, 255); - newTexture->SetPixel(-j+22, j, 0xFF, 0, 0, 255); + newTexture->SetPixel(-j+19, j, 0xFF, 0, 0, 255); + newTexture->SetPixel(-j+20, j, 0xFF, 0, 0, 255); } } else if(wt == WL_STREAM) @@ -513,10 +515,10 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height) newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255); } } - newTexture->SetCharacter(4, 3, 0x8D, 255, 255, 255, 255); + newTexture->SetCharacter(4, 2, 0x8D, 255, 255, 255, 255); for (i=width/3; iSetPixel(i, 8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + newTexture->SetPixel(i, 7+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); } } return newTexture; diff --git a/src/simulation/elements/Element.cpp b/src/simulation/elements/Element.cpp index 44e725117..83f8c7614 100644 --- a/src/simulation/elements/Element.cpp +++ b/src/simulation/elements/Element.cpp @@ -42,7 +42,8 @@ Element::Element(): HighTemperatureTransition(NT), Update(NULL), - Graphics(&Element::defaultGraphics) + Graphics(&Element::defaultGraphics), + IconGenerator(NULL) { } diff --git a/src/simulation/elements/Element.h b/src/simulation/elements/Element.h index 29c7fa08b..7fca1088c 100644 --- a/src/simulation/elements/Element.h +++ b/src/simulation/elements/Element.h @@ -38,6 +38,7 @@ public: unsigned int Properties; int (*Update) (UPDATE_FUNC_ARGS); int (*Graphics) (GRAPHICS_FUNC_ARGS); + VideoBuffer * (*IconGenerator)(int, int, int); float HighPressure; int HighPressureTransition; diff --git a/src/simulation/elements/NONE.cpp b/src/simulation/elements/NONE.cpp index d271c902e..95d9d3e90 100644 --- a/src/simulation/elements/NONE.cpp +++ b/src/simulation/elements/NONE.cpp @@ -43,7 +43,24 @@ Element_NONE::Element_NONE() HighTemperatureTransition = NT; Update = NULL; - + IconGenerator = &Element_NONE::iconGen; } +//#TPT-Directive ElementHeader Element_NONE static VideoBuffer * iconGen(int, int, int) +VideoBuffer * Element_NONE::iconGen(int wallID, int width, int height) +{ + VideoBuffer * newTexture = new VideoBuffer(width, height); + + for (int j=3; j<(width-4)/2; j++) + { + newTexture->SetPixel(j+6, j, 0xFF, 0, 0, 255); + newTexture->SetPixel(j+7, j, 0xFF, 0, 0, 255); + newTexture->SetPixel(-j+19, j, 0xFF, 0, 0, 255); + newTexture->SetPixel(-j+20, j, 0xFF, 0, 0, 255); + } + + return newTexture; +} + + Element_NONE::~Element_NONE() {} \ No newline at end of file