From 16d3895e9c054e908ca8b230719f4294e824a4a2 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 12 May 2012 13:21:04 +0100 Subject: Redo Wall IDs diff --git a/src/Graphics.h b/src/Graphics.h index df7342b..6312185 100644 --- a/src/Graphics.h +++ b/src/Graphics.h @@ -5,8 +5,7 @@ #include #if defined(OGLR) #ifdef MACOSX -#include -#include +#include #include #elif defined(WIN32) #include diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 167b062..92cb376 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -369,7 +369,7 @@ void Renderer::DrawWalls() for (x=0; x=UI_WALLCOUNT) continue; pc = wtypes[wt].colour; @@ -407,7 +407,7 @@ void Renderer::DrawWalls() } // special rendering for some walls - if (bmap[y][x]==WL_EWALL) + if (wt==WL_EWALL) { if (emap[y][x]) { @@ -424,7 +424,7 @@ void Renderer::DrawWalls() vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = pc; } } - else if (bmap[y][x]==WL_WALLELEC) + else if (wt==WL_WALLELEC) { for (j=0; j>1)&1; i #if defined(OGLR) #ifdef MACOSX -#include -#include +#include #include #elif defined(WIN32) #include diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index c3477bc..453232f 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -88,7 +88,7 @@ GameModel::GameModel(): //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)); + Tool * tempTool = new WallTool(i, "", PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour)); menuList[SC_WALL]->AddTool(tempTool); //sim->wtypes[i] } diff --git a/src/game/Tool.h b/src/game/Tool.h index 00b1184..107c8cc 100644 --- a/src/game/Tool.h +++ b/src/game/Tool.h @@ -39,21 +39,43 @@ class ElementTool: public Tool { public: ElementTool(int id, string name, int r, int g, int b): - Tool(id, name, r, g, b) + Tool(id, name, r, g, b) { } virtual ~ElementTool() {} virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ - sim->create_parts(position.X, position.Y, 1, 1, toolID, 0, brush); + sim->CreateParts(position.X, position.Y, 1, 1, toolID, 0, brush); + } + virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->CreateLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush); + } + virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->CreateBox(position1.X, position1.Y, position2.X, position2.Y, toolID, 0); + } + virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { + sim->FloodParts(position.X, position.Y, toolID, -1, -1, 0); + } +}; + +class WallTool: public Tool +{ +public: + WallTool(int id, string name, int r, int g, int b): + Tool(id, name, r, g, b) + { + } + virtual ~WallTool() {} + virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ + sim->CreateWalls(position.X, position.Y, 1, 1, toolID, 0, brush); } virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_line(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush); + sim->CreateWallLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush); } virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_box(position1.X, position1.Y, position2.X, position2.Y, toolID, 0); + sim->CreateWallBox(position1.X, position1.Y, position2.X, position2.Y, toolID, 0); } virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { - sim->flood_parts(position.X, position.Y, toolID, -1, -1, 0); + sim->FloodWalls(position.X, position.Y, toolID, -1, -1, 0); } }; @@ -66,16 +88,16 @@ public: } virtual ~GolTool() {} virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ - sim->create_parts(position.X, position.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); + sim->CreateParts(position.X, position.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); } virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_line(position1.X, position1.Y, position2.X, position2.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); + sim->CreateLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); } virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_box(position1.X, position1.Y, position2.X, position2.Y, PT_LIFE|(toolID<<8), 0); + sim->CreateBox(position1.X, position1.Y, position2.X, position2.Y, PT_LIFE|(toolID<<8), 0); } virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { - sim->flood_parts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0); + sim->FloodParts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0); } }; diff --git a/src/simulation/Elements.h b/src/simulation/Elements.h index 2753b52..cfea1af 100644 --- a/src/simulation/Elements.h +++ b/src/simulation/Elements.h @@ -51,26 +51,6 @@ #define GRAPHICS_FUNC_ARGS Renderer * ren, Particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb #define GRAPHICS_FUNC_SUBCALL_ARGS ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb -#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 @@ -80,9 +60,6 @@ #define SPC_NGRV 244 #define SPC_PROP 246 -#define WL_ALLOWGAS 140 -#define WL_GRAV 142 -#define WL_ALLOWENERGY 145 #define NGT_GOL 0 #define NGT_HLIF 1 diff --git a/src/simulation/SaveLoader.cpp b/src/simulation/SaveLoader.cpp index 7989d38..9bfb131 100644 --- a/src/simulation/SaveLoader.cpp +++ b/src/simulation/SaveLoader.cpp @@ -194,7 +194,7 @@ int SaveLoader::PSVLoad(unsigned char * data, int dataLength, Simulation * sim, { //In old saves, ignore walls created by sign tool bug //Not ignoring other invalid walls or invalid walls in new saves, so that any other bugs causing them are easier to notice, find and fix - if (ver<71 && d[p]==WL_SIGN) + if (ver<71 && d[p]==O_WL_SIGN) { p++; continue; @@ -227,6 +227,39 @@ int SaveLoader::PSVLoad(unsigned char * data, int dataLength, Simulation * sim, sim->bmap[y][x]=WL_EHOLE; if (sim->bmap[y][x]==13) sim->bmap[y][x]=WL_ALLOWGAS; + + if (sim->bmap[y][x]==O_WL_WALLELEC) + sim->bmap[y][x]=WL_WALLELEC; + if (sim->bmap[y][x]==O_WL_EWALL) + sim->bmap[y][x]=WL_EWALL; + if (sim->bmap[y][x]==O_WL_DETECT) + sim->bmap[y][x]=WL_DETECT; + if (sim->bmap[y][x]==O_WL_STREAM) + sim->bmap[y][x]=WL_STREAM; + if (sim->bmap[y][x]==O_WL_FAN||sim->bmap[y][x]==O_WL_FANHELPER) + sim->bmap[y][x]=WL_FAN; + if (sim->bmap[y][x]==O_WL_ALLOWLIQUID) + sim->bmap[y][x]=WL_ALLOWLIQUID; + if (sim->bmap[y][x]==O_WL_DESTROYALL) + sim->bmap[y][x]=WL_DESTROYALL; + if (sim->bmap[y][x]==O_WL_ERASE) + sim->bmap[y][x]=WL_ERASE; + if (sim->bmap[y][x]==O_WL_WALL) + sim->bmap[y][x]=WL_WALL; + if (sim->bmap[y][x]==O_WL_ALLOWAIR) + sim->bmap[y][x]=WL_ALLOWAIR; + if (sim->bmap[y][x]==O_WL_ALLOWSOLID) + sim->bmap[y][x]=WL_ALLOWSOLID; + if (sim->bmap[y][x]==O_WL_ALLOWALLELEC) + sim->bmap[y][x]=WL_ALLOWALLELEC; + if (sim->bmap[y][x]==O_WL_EHOLE) + sim->bmap[y][x]=WL_EHOLE; + if (sim->bmap[y][x]==O_WL_ALLOWGAS) + sim->bmap[y][x]=WL_ALLOWGAS; + if (sim->bmap[y][x]==O_WL_GRAV) + sim->bmap[y][x]=WL_GRAV; + if (sim->bmap[y][x]==O_WL_ALLOWENERGY) + sim->bmap[y][x]=WL_ALLOWENERGY; } p++; diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 89295f4..354c759 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -46,7 +46,7 @@ void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h) } } -void Simulation::create_box(int x1, int y1, int x2, int y2, int c, int flags) +void Simulation::CreateBox(int x1, int y1, int x2, int y2, int c, int flags) { int i, j; if (c==SPC_PROP) @@ -65,7 +65,27 @@ void Simulation::create_box(int x1, int y1, int x2, int y2, int c, int flags) } for (j=y1; j<=y2; j++) for (i=x1; i<=x2; i++) - create_parts(i, j, 0, 0, c, flags); + CreateParts(i, j, 0, 0, c, flags); +} + +void Simulation::CreateWallBox(int x1, int y1, int x2, int y2, int c, int flags) +{ + int i, j; + if (x1>x2) + { + i = x2; + x2 = x1; + x1 = i; + } + if (y1>y2) + { + j = y2; + y2 = y1; + y1 = j; + } + for (j=y1; j<=y2; j++) + for (i=x1; i<=x2; i++) + CreateWalls(i, j, 0, 0, c, flags); } int Simulation::flood_prop_2(int x, int y, size_t propoffset, void * propvalue, int proptype, int parttype, char * bitmap) @@ -133,10 +153,10 @@ Particle Simulation::Get(int x, int y) return Particle(); } -int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags) +int Simulation::FloodParts(int x, int y, int fullc, int cm, int bm, int flags) { int c = fullc&0xFF; - int x1, x2, dy = (c=CELL) @@ -191,7 +211,7 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags) } x2++; } - + // fill span for (x=x1; x<=x2; x++) { @@ -200,40 +220,40 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags) if (create_part(-1,x, y, fullc)==-1) return 0; } - else if (!create_parts(x, y, 0, 0, fullc, flags)) + else if (!CreateParts(x, y, 0, 0, fullc, flags)) return 0; } // fill children if (cm==PT_INST&&co==PT_SPRK)//wire crossing for INST { if (y>=CELL+dy && x1==x2 && - ((pmap[y-1][x1-1]&0xFF)==PT_INST||(pmap[y-1][x1-1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1]&0xFF)==PT_INST||(pmap[y-1][x1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1+1]&0xFF)==PT_INST || (pmap[y-1][x1+1]&0xFF)==PT_SPRK) && - (pmap[y-2][x1-1]&0xFF)!=PT_INST && ((pmap[y-2][x1]&0xFF)==PT_INST ||(pmap[y-2][x1]&0xFF)==PT_SPRK) && (pmap[y-2][x1+1]&0xFF)!=PT_INST) - flood_parts(x1, y-2, fullc, cm, bm, flags); + ((pmap[y-1][x1-1]&0xFF)==PT_INST||(pmap[y-1][x1-1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1]&0xFF)==PT_INST||(pmap[y-1][x1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1+1]&0xFF)==PT_INST || (pmap[y-1][x1+1]&0xFF)==PT_SPRK) && + (pmap[y-2][x1-1]&0xFF)!=PT_INST && ((pmap[y-2][x1]&0xFF)==PT_INST ||(pmap[y-2][x1]&0xFF)==PT_SPRK) && (pmap[y-2][x1+1]&0xFF)!=PT_INST) + FloodParts(x1, y-2, fullc, cm, bm, flags); else if (y>=CELL+dy) for (x=x1; x<=x2; x++) if ((pmap[y-1][x]&0xFF)!=PT_SPRK) { if (x==x1 || x==x2 || y>=YRES-CELL-1 || - (pmap[y-1][x-1]&0xFF)==PT_INST || (pmap[y-1][x+1]&0xFF)==PT_INST || - (pmap[y+1][x-1]&0xFF)==PT_INST || ((pmap[y+1][x]&0xFF)!=PT_INST&&(pmap[y+1][x]&0xFF)!=PT_SPRK) || (pmap[y+1][x+1]&0xFF)==PT_INST) - flood_parts(x, y-dy, fullc, cm, bm, flags); - + (pmap[y-1][x-1]&0xFF)==PT_INST || (pmap[y-1][x+1]&0xFF)==PT_INST || + (pmap[y+1][x-1]&0xFF)==PT_INST || ((pmap[y+1][x]&0xFF)!=PT_INST&&(pmap[y+1][x]&0xFF)!=PT_SPRK) || (pmap[y+1][x+1]&0xFF)==PT_INST) + FloodParts(x, y-dy, fullc, cm, bm, flags); + } - + if (y=CELL+dy) for (x=x1; x<=x2; x++) if ((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if (!flood_parts(x, y-dy, fullc, cm, bm, flags)) + if (!FloodParts(x, y-dy, fullc, cm, bm, flags)) return 0; if (y=CELL) + { + if ((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + { + break; + } + x1--; + } + while (x2=CELL+dy) + for (x=x1; x<=x2; x++) + if ((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if (!FloodWalls(x, y-dy, c, cm, bm, flags)) + return 0; + if (yGetRadius().X; ry = cBrush->GetRadius().Y; } - + int wall = c - 100; if (c==SPC_WIND || c==PT_FIGH) return 0; - - //if(c==SPC_PROP){ - // prop_edit_ui(vid_buf, x, y); - // return 0; - //} - for (r=UI_ACTUALSTART; r<=UI_ACTUALSTART+UI_WALLCOUNT; r++) - { - if (wall==r) - { - if (c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM || c == SPC_PGRV || c == SPC_NGRV || wall == WL_SIGN) - break; - if (wall == WL_ERASE) - b = 0; - else - b = wall; - dw = 1; - } - } - if (c == WL_FANHELPER) - { - b = WL_FANHELPER; - dw = 1; - } - if (wall == WL_GRAV) - { - gravwl_timeout = 60; - } + if (c==PT_LIGH) { if (lighting_recreate>0 && rx+ry>0) @@ -573,49 +639,7 @@ int Simulation::create_parts(int x, int y, int rx, int ry, int c, int flags, Bru } else return 0; } - - if (dw==1) - { - ry = ry/CELL; - rx = rx/CELL; - x = x/CELL; - y = y/CELL; - x -= rx/2; - y -= ry/2; - for (ox=x; ox<=x+rx; ox++) - { - for (oy=y; oy<=y+rx; oy++) - { - if (ox>=0&&ox=0&&oy=0 && i+u=0 && j+vGetRadius().X; + ry = cBrush->GetRadius().Y; + } + + int wall = c; + + if (wall == WL_ERASE) + b = 0; + else + b = wall; + + ry = ry/CELL; + rx = rx/CELL; + x = x/CELL; + y = y/CELL; + x -= rx/2; + y -= ry/2; + for (ox=x; ox<=x+rx; ox++) + { + for (oy=y; oy<=y+rx; oy++) + { + if (ox>=0&&ox=0&&oy=0 && i+u=0 && j+vabs(x2-x1), x, y, dx, dy, sy; float e, de; @@ -732,20 +813,73 @@ void Simulation::create_line(int x1, int y1, int x2, int y2, int rx, int ry, int for (x=x1; x<=x2; x++) { if (cp) - create_parts(y, x, rx, ry, c, flags, cBrush); + CreateParts(y, x, rx, ry, c, flags, cBrush); else - create_parts(x, y, rx, ry, c, flags, cBrush); + CreateParts(x, y, rx, ry, c, flags, cBrush); e += de; if (e >= 0.5f) { y += sy; if ((c==WL_EHOLE+100 || c==WL_ALLOWGAS+100 || c==WL_ALLOWENERGY+100 || c==WL_ALLOWALLELEC+100 || c==WL_ALLOWSOLID+100 || c==WL_ALLOWAIR+100 || c==WL_WALL+100 || c==WL_DESTROYALL+100 || c==WL_ALLOWLIQUID+100 || c==WL_FAN+100 || c==WL_STREAM+100 || c==WL_DETECT+100 || c==WL_EWALL+100 || c==WL_WALLELEC+100 || !(rx+ry)) - && ((y1=y2))) + && ((y1=y2))) + { + if (cp) + CreateParts(y, x, rx, ry, c, flags, cBrush); + else + CreateParts(x, y, rx, ry, c, flags, cBrush); + } + e -= 1.0f; + } + } +} + +void Simulation::CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags, Brush * cBrush) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if (cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if (x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if (dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + if (!(rx+ry) && ((y1=y2))) { if (cp) - create_parts(y, x, rx, ry, c, flags, cBrush); + CreateWalls(y, x, rx, ry, c, flags, cBrush); else - create_parts(x, y, rx, ry, c, flags, cBrush); + CreateWalls(x, y, rx, ry, c, flags, cBrush); } e -= 1.0f; } @@ -1097,7 +1231,7 @@ void Simulation::create_arc(int sx, int sy, int dx, int dy, int midpoints, int v xmid[i+1] += (rand()%variance)-voffset; ymid[i+1] += (rand()%variance)-voffset; } - create_line(xmid[i], ymid[i], xmid[i+1], ymid[i+1], 0, 0, type, flags); + CreateLine(xmid[i], ymid[i], xmid[i+1], ymid[i+1], 0, 0, type, flags); } free(xmid); free(ymid); diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index 62427fc..9ed763a 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -244,14 +244,22 @@ public: void update_particles(); void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert); void clear_area(int area_x, int area_y, int area_w, int area_h); - void create_box(int x1, int y1, int x2, int y2, int c, int flags); - int flood_parts(int x, int y, int c, int cm, int bm, int flags); - int create_parts(int x, int y, int rx, int ry, int c, int flags, Brush * cBrush = NULL); - void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags, Brush * cBrush = NULL); + + void CreateBox(int x1, int y1, int x2, int y2, int c, int flags); + int FloodParts(int x, int y, int c, int cm, int bm, int flags); + int CreateParts(int x, int y, int rx, int ry, int c, int flags, Brush * cBrush = NULL); + void CreateLine(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags, Brush * cBrush = NULL); + + void CreateWallBox(int x1, int y1, int x2, int y2, int c, int flags); + int FloodWalls(int x, int y, int c, int cm, int bm, int flags); + int CreateWalls(int x, int y, int rx, int ry, int c, int flags, Brush * cBrush = NULL); + void CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags, Brush * cBrush = NULL); + void ApplyDecoration(int x, int y, int colR, int colG, int colB, int colA, int mode); void ApplyDecorationPoint(int x, int y, int rx, int ry, int colR, int colG, int colB, int colA, int mode, Brush * cBrush = NULL); void ApplyDecorationLine(int x1, int y1, int x2, int y2, int rx, int ry, int colR, int colG, int colB, int colA, int mode, Brush * cBrush = NULL); void ApplyDecorationBox(int x1, int y1, int x2, int y2, int colR, int colG, int colB, int colA, int mode); + void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate); inline void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]); inline void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]); diff --git a/src/simulation/SimulationData.cpp b/src/simulation/SimulationData.cpp index 60def19..fd0c4a5 100644 --- a/src/simulation/SimulationData.cpp +++ b/src/simulation/SimulationData.cpp @@ -132,35 +132,26 @@ wall_type * LoadWalls(int & wallCount) { wall_type wtypes[] = { + {PIXPACK(0x808080), PIXPACK(0x000000), 0, "Erases walls."}, {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 powders"}, {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)); + wallCount = UI_WALLCOUNT; + wall_type * wtypesT = (wall_type*)malloc(UI_WALLCOUNT*sizeof(wall_type)); + memcpy(wtypesT, wtypes, UI_WALLCOUNT*sizeof(wall_type)); return wtypesT; } diff --git a/src/simulation/SimulationData.h b/src/simulation/SimulationData.h index 0624322..5e48e94 100644 --- a/src/simulation/SimulationData.h +++ b/src/simulation/SimulationData.h @@ -27,23 +27,44 @@ #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 UI_WALLCOUNT 16 + +#define O_WL_WALLELEC 122 +#define O_WL_EWALL 123 +#define O_WL_DETECT 124 +#define O_WL_STREAM 125 +#define O_WL_SIGN 126 +#define O_WL_FAN 127 +#define O_WL_FANHELPER 255 +#define O_WL_ALLOWLIQUID 128 +#define O_WL_DESTROYALL 129 +#define O_WL_ERASE 130 +#define O_WL_WALL 131 +#define O_WL_ALLOWAIR 132 +#define O_WL_ALLOWSOLID 133 +#define O_WL_ALLOWALLELEC 134 +#define O_WL_EHOLE 135 +#define O_WL_ALLOWGAS 140 +#define O_WL_GRAV 142 +#define O_WL_ALLOWENERGY 145 + + +#define WL_ERASE 0 +#define WL_WALLELEC 1 +#define WL_EWALL 2 +#define WL_DETECT 3 +#define WL_STREAM 4 +#define WL_FAN 5 +#define WL_ALLOWLIQUID 6 +#define WL_DESTROYALL 7 +#define WL_WALL 8 +#define WL_ALLOWAIR 9 +#define WL_ALLOWSOLID 10 +#define WL_ALLOWALLELEC 11 +#define WL_EHOLE 12 +#define WL_ALLOWGAS 13 +#define WL_GRAV 14 +#define WL_ALLOWENERGY 15 #define SPC_AIR 236 #define SPC_HEAT 237 @@ -54,10 +75,6 @@ #define SPC_NGRV 244 #define SPC_PROP 246 -#define WL_ALLOWGAS 140 -#define WL_GRAV 142 -#define WL_ALLOWENERGY 145 - #define DECO_DRAW 0 #define DECO_ADD 1 #define DECO_SUBTRACT 2 diff --git a/src/simulation/elements/BOMB.cpp b/src/simulation/elements/BOMB.cpp index ca3be8d..b21be19 100644 --- a/src/simulation/elements/BOMB.cpp +++ b/src/simulation/elements/BOMB.cpp @@ -102,8 +102,8 @@ int Element_BOMB::update(UPDATE_FUNC_ARGS) parts[nb].temp = MAX_TEMP; } } - //create_parts(x, y, 9, 9, PT_BOMB); - //create_parts(x, y, 8, 8, PT_NONE); + //CreateParts(x, y, 9, 9, PT_BOMB); + //CreateParts(x, y, 8, 8, PT_NONE); sim->kill_part(i); return 1; } diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index 95f928b..feb825b 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -83,7 +83,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS) nearp = sim->nearest_part(i, PT_ETRD, -1); if (nearp!=-1 && sim->parts_avg(i, nearp, PT_INSL)!=PT_INSL) { - sim->create_line(x, y, (int)(parts[nearp].x+0.5f), (int)(parts[nearp].y+0.5f), 0, 0, PT_PLSM, 0); + sim->CreateLine(x, y, (int)(parts[nearp].x+0.5f), (int)(parts[nearp].y+0.5f), 0, 0, PT_PLSM, 0); sim->part_change_type(i,x,y,ct); ct = parts[i].ctype = PT_NONE; parts[i].life = 20; @@ -243,7 +243,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS) else if (rt==PT_INST) { if (parts[r>>8].life==0 && parts[i].life<4) { - sim->flood_parts(x+rx,y+ry,PT_SPRK,PT_INST,-1, 0);//spark the wire + sim->FloodParts(x+rx,y+ry,PT_SPRK,PT_INST,-1, 0);//spark the wire } } else if (parts[r>>8].life==0 && parts[i].life<4) { diff --git a/src/simulation/elements/STKM.cpp b/src/simulation/elements/STKM.cpp index e554892..772a3e5 100644 --- a/src/simulation/elements/STKM.cpp +++ b/src/simulation/elements/STKM.cpp @@ -304,7 +304,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) { { int np = -1; if (playerp->elem == SPC_AIR) - sim->create_parts(rx + 3*((((int)playerp->pcomm)&0x02) == 0x02) - 3*((((int)playerp->pcomm)&0x01) == 0x01), ry, 4, 4, SPC_AIR, 0); + sim->CreateParts(rx + 3*((((int)playerp->pcomm)&0x02) == 0x02) - 3*((((int)playerp->pcomm)&0x01) == 0x01), ry, 4, 4, SPC_AIR, 0); else if (playerp->elem==PT_LIGH && playerp->frames<30)//limit lightning creation rate np = -1; else -- cgit v0.9.2-21-gd62e