From 04e4a2346d3d7ef6e0f0b38d8eafc928dc6e30bd Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 24 Jan 2012 21:19:29 +0000 Subject: Wall menus diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 8f16f49..3271f3a 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -30,6 +30,13 @@ GameModel::GameModel(): menuList[sim->ptypes[i].menusection]->AddTool(tempTool); } } + //Build other menus from wall data + for(int i = 0; i < UI_WALLCOUNT; i++) + { + Tool * tempTool = new ElementTool(i+UI_WALLSTART, "", PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour)); + menuList[SC_WALL]->AddTool(tempTool); + //sim->wtypes[i] + } activeTool = new ElementTool(1, "TURD", 0, 0, 0); } diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 8438e1b..d452756 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -412,6 +412,7 @@ void GameView::OnDraw() ren->render_parts(); ren->render_fire(); ren->render_signs(); + ren->draw_walls(); } if(activeBrush && currentMouse.X > 0 && currentMouse.X < XRES && currentMouse.Y > 0 && currentMouse.Y < YRES) { diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index e938efd..61d8ae7 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -3186,6 +3186,10 @@ Simulation::Simulation(): menu_section * msectionsT = LoadMenus(menuCount); memcpy(msections, msectionsT, menuCount * sizeof(menu_section)); + int wallCount; + wall_type * wtypesT = LoadWalls(wallCount); + memcpy(wtypes, wtypesT, wallCount * sizeof(wall_type)); + int elementCount; part_type * ptypesT = LoadElements(elementCount); memcpy(ptypes, ptypesT, elementCount * sizeof(part_type)); diff --git a/src/simulation/SimulationData.cpp b/src/simulation/SimulationData.cpp index f5a3ff7..6b19727 100644 --- a/src/simulation/SimulationData.cpp +++ b/src/simulation/SimulationData.cpp @@ -8,6 +8,42 @@ #include "ElementFunctions.h" #include "ElementGraphics.h" +wall_type * LoadWalls(int & wallCount) +{ + wall_type wtypes[] = + { + {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, "Wall. Indestructible. Blocks everything. Conductive."}, + {PIXPACK(0x808080), PIXPACK(0x808080), 0, "E-Wall. Becomes transparent when electricity is connected."}, + {PIXPACK(0xFF8080), PIXPACK(0xFF2008), 1, "Detector. Generates electricity when a particle is inside."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 0, "Streamline. Set start point of a streamline."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 0, "Sign. Click on a sign to edit it or anywhere else to place a new one."}, + {PIXPACK(0x8080FF), PIXPACK(0x000000), 1, "Fan. Accelerates air. Use line tool to set direction and strength."}, + {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 2, "Wall. Blocks most particles but lets liquids through. Conductive."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 1, "Wall. Absorbs particles but lets air currents through."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 0, "Erases walls."}, + {PIXPACK(0x808080), PIXPACK(0x000000), 3, "Wall. Indestructible. Blocks everything."}, + {PIXPACK(0x3C3C3C), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks particles, allows air"}, + {PIXPACK(0x575757), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and gasses, allows solids"}, + {PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, "Conductor, allows particles, conducts electricity"}, + {PIXPACK(0x242424), PIXPACK(0x101010), 0, "E-Hole, absorbs particles, release them when powered"}, + {PIXPACK(0xFFFFFF), PIXPACK(0x000000), -1, "Air, creates airflow and pressure"}, + {PIXPACK(0xFFBB00), PIXPACK(0x000000), -1, "Heats the targetted element."}, + {PIXPACK(0x00BBFF), PIXPACK(0x000000), -1, "Cools the targetted element."}, + {PIXPACK(0x303030), PIXPACK(0x000000), -1, "Vacuum, reduces air pressure."}, + {PIXPACK(0x579777), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and solids, allows gasses"}, + {PIXPACK(0x000000), PIXPACK(0x000000), -1, "Drag tool"}, + {PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, "Gravity wall"}, + {PIXPACK(0x0000BB), PIXPACK(0x000000), -1, "Postive gravity tool."}, + {PIXPACK(0x000099), PIXPACK(0x000000), -1, "Negative gravity tool."}, + {PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, "Energy wall, allows only energy type particles to pass"}, + {PIXPACK(0xFFAA00), PIXPACK(0xAA5500), -1, "Property edit tool"}, + }; + wallCount = SC_TOTAL; + wall_type * wtypesT = (wall_type*)malloc(SC_TOTAL*sizeof(wall_type)); + memcpy(wtypesT, wtypes, SC_TOTAL*sizeof(wall_type)); + return wtypesT; +} + menu_section * LoadMenus(int & menuCount) { menu_section msections[] = //doshow does not do anything currently. diff --git a/src/simulation/SimulationData.h b/src/simulation/SimulationData.h index e327094..37bfb37 100644 --- a/src/simulation/SimulationData.h +++ b/src/simulation/SimulationData.h @@ -21,6 +21,39 @@ #define SC_CRACKER2 14 #define SC_TOTAL 12 +#define UI_WALLSTART 222 +#define UI_ACTUALSTART 122 +#define UI_WALLCOUNT 25 + +#define WL_WALLELEC 122 +#define WL_EWALL 123 +#define WL_DETECT 124 +#define WL_STREAM 125 +#define WL_SIGN 126 +#define WL_FAN 127 +#define WL_FANHELPER 255 +#define WL_ALLOWLIQUID 128 +#define WL_DESTROYALL 129 +#define WL_ERASE 130 +#define WL_WALL 131 +#define WL_ALLOWAIR 132 +#define WL_ALLOWSOLID 133 +#define WL_ALLOWALLELEC 134 +#define WL_EHOLE 135 + +#define SPC_AIR 236 +#define SPC_HEAT 237 +#define SPC_COOL 238 +#define SPC_VACUUM 239 +#define SPC_WIND 241 +#define SPC_PGRV 243 +#define SPC_NGRV 244 +#define SPC_PROP 246 + +#define WL_ALLOWGAS 140 +#define WL_GRAV 142 +#define WL_ALLOWENERGY 145 + #ifndef SIMULATIONDATA_H_ #define SIMULATIONDATA_H_ @@ -40,6 +73,10 @@ struct gol_menu; struct menu_section; +struct wall_type; + +wall_type * LoadWalls(int & wallCount); + menu_section * LoadMenus(int & menuCount); part_type * LoadElements(int & elementCount); -- cgit v0.9.2-21-gd62e