From a0c77fe6e8ea4c0c44e3098cbdb972ba24a734cb Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 24 Sep 2015 00:26:37 -0400 Subject: [PATCH] fix it being impossible to select wall menu, add wall identifiers from my mod --- src/gui/game/GameModel.cpp | 2 +- src/gui/game/GameView.cpp | 6 +++--- src/simulation/SimulationData.cpp | 36 +++++++++++++++---------------- src/simulation/WallType.h | 1 + 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/gui/game/GameModel.cpp b/src/gui/game/GameModel.cpp index ef91b5fd9..ab9fadd91 100644 --- a/src/gui/game/GameModel.cpp +++ b/src/gui/game/GameModel.cpp @@ -294,7 +294,7 @@ void GameModel::BuildMenus() //Build other menus from wall data for(int i = 0; i < UI_WALLCOUNT; i++) { - Tool * tempTool = new WallTool(i, "", std::string(sim->wtypes[i].descs), PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour), "DEFAULT_WL_"+format::NumberToString(i), sim->wtypes[i].textureGen); + Tool * tempTool = new WallTool(i, "", std::string(sim->wtypes[i].descs), PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour), sim->wtypes[i].identifier, sim->wtypes[i].textureGen); menuList[SC_WALL]->AddTool(tempTool); //sim->wtypes[i] } diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 1f82a6d1c..332127975 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -159,7 +159,7 @@ GameView::GameView(): altBehaviour(false), showHud(true), showDebug(false), - delayedActiveMenu(0), + delayedActiveMenu(-1), wallBrush(false), toolBrush(false), decoBrush(false), @@ -1087,10 +1087,10 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy) mouseInZoom = newMouseInZoom; // set active menu (delayed) - if (delayedActiveMenu) + if (delayedActiveMenu != -1) { c->SetActiveMenu(delayedActiveMenu); - delayedActiveMenu = 0; + delayedActiveMenu = -1; } } diff --git a/src/simulation/SimulationData.cpp b/src/simulation/SimulationData.cpp index 8f428a880..b1fb478ca 100644 --- a/src/simulation/SimulationData.cpp +++ b/src/simulation/SimulationData.cpp @@ -114,24 +114,24 @@ wall_type * LoadWalls(int & wallCount) { wall_type wtypes[] = { - {PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "ERASE", "Erases walls."}, - {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, Renderer::WallIcon, "CONDUCTIVE WALL","Blocks everything. Conductive."}, - {PIXPACK(0x808080), PIXPACK(0x808080), 0, Renderer::WallIcon, "EWALL", "E-Wall. Becomes transparent when electricity is connected."}, - {PIXPACK(0xFF8080), PIXPACK(0xFF2008), 1, Renderer::WallIcon, "DETECTOR", "Detector. Generates electricity when a particle is inside."}, - {PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "STREAMLINE", "Streamline. Set start point of a streamline."}, - {PIXPACK(0x8080FF), PIXPACK(0x000000), 1, Renderer::WallIcon, "FAN", "Fan. Accelerates air. Use the line tool to set direction and strength."}, - {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 2, Renderer::WallIcon, "LIQUID WALL", "Allows liquids, blocks all other particles. Conductive."}, - {PIXPACK(0x808080), PIXPACK(0x000000), 1, Renderer::WallIcon, "ABSORB WALL", "Absorbs particles but lets air currents through."}, - {PIXPACK(0x808080), PIXPACK(0x000000), 3, Renderer::WallIcon, "WALL", "Basic wall, blocks everything."}, - {PIXPACK(0x3C3C3C), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRONLY WALL", "Allows air, but blocks all particles."}, - {PIXPACK(0x575757), PIXPACK(0x000000), 1, Renderer::WallIcon, "POWDER WALL", "Allows powders, blocks all other particles."}, - {PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, Renderer::WallIcon, "CONDUCTOR", "Conductor. Allows all particles to pass through and conducts electricity."}, - {PIXPACK(0x242424), PIXPACK(0x101010), 0, Renderer::WallIcon, "EHOLE", "E-Hole. absorbs particles, releases them when powered."}, - {PIXPACK(0x579777), PIXPACK(0x000000), 1, Renderer::WallIcon, "GAS WALL", "Allows gases, blocks all other particles."}, - {PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, Renderer::WallIcon, "GRAVITY WALL", "Gravity wall. Newtonian Gravity has no effect inside a box drawn with this."}, - {PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, Renderer::WallIcon, "ENERGY WALL", "Allows energy particles, blocks all other particles."}, - {PIXPACK(0xDCDCDC), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRBLOCK WALL", "Allows all particles, but blocks air."}, - {PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "ERASEALL", "Erases walls, particles, and signs."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "ERASE", "DEFAULT_WL_ERASE", "Erases walls."}, + {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, Renderer::WallIcon, "CONDUCTIVE WALL","DEFAULT_WL_CNDTW", "Blocks everything. Conductive."}, + {PIXPACK(0x808080), PIXPACK(0x808080), 0, Renderer::WallIcon, "EWALL", "DEFAULT_WL_EWALL", "E-Wall. Becomes transparent when electricity is connected."}, + {PIXPACK(0xFF8080), PIXPACK(0xFF2008), 1, Renderer::WallIcon, "DETECTOR", "DEFAULT_WL_DTECT", "Detector. Generates electricity when a particle is inside."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "STREAMLINE", "DEFAULT_WL_STRM", "Streamline. Set start point of a streamline."}, + {PIXPACK(0x8080FF), PIXPACK(0x000000), 1, Renderer::WallIcon, "FAN", "DEFAULT_WL_FAN", "Fan. Accelerates air. Use the line tool to set direction and strength."}, + {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 2, Renderer::WallIcon, "LIQUID WALL", "DEFAULT_WL_LIQD", "Allows liquids, blocks all other particles. Conductive."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 1, Renderer::WallIcon, "ABSORB WALL", "DEFAULT_WL_ABSRB", "Absorbs particles but lets air currents through."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 3, Renderer::WallIcon, "WALL", "DEFAULT_WL_WALL", "Basic wall, blocks everything."}, + {PIXPACK(0x3C3C3C), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRONLY WALL", "DEFAULT_WL_AIR", "Allows air, but blocks all particles."}, + {PIXPACK(0x575757), PIXPACK(0x000000), 1, Renderer::WallIcon, "POWDER WALL", "DEFAULT_WL_POWDR", "Allows powders, blocks all other particles."}, + {PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, Renderer::WallIcon, "CONDUCTOR", "DEFAULT_WL_CNDTR", "Conductor. Allows all particles to pass through and conducts electricity."}, + {PIXPACK(0x242424), PIXPACK(0x101010), 0, Renderer::WallIcon, "EHOLE", "DEFAULT_WL_EHOLE", "E-Hole. absorbs particles, releases them when powered."}, + {PIXPACK(0x579777), PIXPACK(0x000000), 1, Renderer::WallIcon, "GAS WALL", "DEFAULT_WL_GAS", "Allows gases, blocks all other particles."}, + {PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, Renderer::WallIcon, "GRAVITY WALL", "DEFAULT_WL_GRVTY", "Gravity wall. Newtonian Gravity has no effect inside a box drawn with this."}, + {PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, Renderer::WallIcon, "ENERGY WALL", "DEFAULT_WL_ENRGY", "Allows energy particles, blocks all other particles."}, + {PIXPACK(0xDCDCDC), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRBLOCK WALL", "DEFAULT_WL_NOAIR", "Allows all particles, but blocks air."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "ERASEALL", "DEFAULT_WL_ERASEA","Erases walls, particles, and signs."}, }; wallCount = UI_WALLCOUNT; wall_type * wtypesT = (wall_type*)malloc(UI_WALLCOUNT*sizeof(wall_type)); diff --git a/src/simulation/WallType.h b/src/simulation/WallType.h index c9f30e392..15a0085ca 100644 --- a/src/simulation/WallType.h +++ b/src/simulation/WallType.h @@ -11,6 +11,7 @@ struct wall_type int drawstyle; VideoBuffer * (*textureGen)(int, int, int); const char *name; + const char *identifier; const char *descs; };