Redo Wall IDs
This commit is contained in:
parent
1c993435ef
commit
16d3895e9c
@ -5,8 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#if defined(OGLR)
|
#if defined(OGLR)
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
#include <GL/glew.h>
|
#include <OpenGL/gl3.h>
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#include <OpenGL/glu.h>
|
#include <OpenGL/glu.h>
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32)
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
@ -369,7 +369,7 @@ void Renderer::DrawWalls()
|
|||||||
for (x=0; x<XRES/CELL; x++)
|
for (x=0; x<XRES/CELL; x++)
|
||||||
if (bmap[y][x])
|
if (bmap[y][x])
|
||||||
{
|
{
|
||||||
wt = bmap[y][x]-UI_ACTUALSTART;
|
wt = bmap[y][x];
|
||||||
if (wt<0 || wt>=UI_WALLCOUNT)
|
if (wt<0 || wt>=UI_WALLCOUNT)
|
||||||
continue;
|
continue;
|
||||||
pc = wtypes[wt].colour;
|
pc = wtypes[wt].colour;
|
||||||
@ -407,7 +407,7 @@ void Renderer::DrawWalls()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// special rendering for some walls
|
// special rendering for some walls
|
||||||
if (bmap[y][x]==WL_EWALL)
|
if (wt==WL_EWALL)
|
||||||
{
|
{
|
||||||
if (emap[y][x])
|
if (emap[y][x])
|
||||||
{
|
{
|
||||||
@ -424,7 +424,7 @@ void Renderer::DrawWalls()
|
|||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = pc;
|
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<CELL; j++)
|
for (j=0; j<CELL; j++)
|
||||||
for (i=0; i<CELL; i++)
|
for (i=0; i<CELL; i++)
|
||||||
@ -435,7 +435,7 @@ void Renderer::DrawWalls()
|
|||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bmap[y][x]==WL_EHOLE)
|
else if (wt==WL_EHOLE)
|
||||||
{
|
{
|
||||||
if (emap[y][x])
|
if (emap[y][x])
|
||||||
{
|
{
|
||||||
@ -453,85 +453,6 @@ void Renderer::DrawWalls()
|
|||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x242424);
|
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x242424);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (render_mode & PMODE_BLOB)
|
|
||||||
{
|
|
||||||
// when in blob view, draw some blobs...
|
|
||||||
if (wtypes[wt].drawstyle==1)
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j+=2)
|
|
||||||
for (i=(j>>1)&1; i<CELL; i+=2)
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
|
||||||
}
|
|
||||||
else if (wtypes[wt].drawstyle==2)
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j+=2)
|
|
||||||
for (i=0; i<CELL; i+=2)
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
|
||||||
}
|
|
||||||
else if (wtypes[wt].drawstyle==3)
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j++)
|
|
||||||
for (i=0; i<CELL; i++)
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
|
||||||
}
|
|
||||||
else if (wtypes[wt].drawstyle==4)
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j++)
|
|
||||||
for (i=0; i<CELL; i++)
|
|
||||||
if(i == j)
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
|
||||||
else if (i == j+1 || (i == 0 && j == CELL-1))
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), PIXR(gc), PIXG(gc), PIXB(gc));
|
|
||||||
else
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), 0x20, 0x20, 0x20);
|
|
||||||
}
|
|
||||||
if (bmap[y][x]==WL_EWALL)
|
|
||||||
{
|
|
||||||
if (emap[y][x])
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j++)
|
|
||||||
for (i=0; i<CELL; i++)
|
|
||||||
if (i&j&1)
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), 0x80, 0x80, 0x80);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j++)
|
|
||||||
for (i=0; i<CELL; i++)
|
|
||||||
if (!(i&j&1))
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), 0x80, 0x80, 0x80);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bmap[y][x]==WL_WALLELEC)
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j++)
|
|
||||||
for (i=0; i<CELL; i++)
|
|
||||||
{
|
|
||||||
if (!((y*CELL+j)%2) && !((x*CELL+i)%2))
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
|
||||||
else
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), 0x80, 0x80, 0x80);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bmap[y][x]==WL_EHOLE)
|
|
||||||
{
|
|
||||||
if (emap[y][x])
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j++)
|
|
||||||
for (i=0; i<CELL; i++)
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24);
|
|
||||||
for (j=0; j<CELL; j+=2)
|
|
||||||
for (i=0; i<CELL; i+=2)
|
|
||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x000000);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (j=0; j<CELL; j+=2)
|
|
||||||
for (i=0; i<CELL; i+=2)
|
|
||||||
drawblob((x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (wtypes[wt].eglow && emap[y][x])
|
if (wtypes[wt].eglow && emap[y][x])
|
||||||
{
|
{
|
||||||
// glow if electrified
|
// glow if electrified
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#if defined(OGLR)
|
#if defined(OGLR)
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
#include <GL/glew.h>
|
#include <OpenGL/gl3.h>
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#include <OpenGL/glu.h>
|
#include <OpenGL/glu.h>
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32)
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
@ -88,7 +88,7 @@ GameModel::GameModel():
|
|||||||
//Build other menus from wall data
|
//Build other menus from wall data
|
||||||
for(int i = 0; i < UI_WALLCOUNT; i++)
|
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);
|
menuList[SC_WALL]->AddTool(tempTool);
|
||||||
//sim->wtypes[i]
|
//sim->wtypes[i]
|
||||||
}
|
}
|
||||||
|
@ -44,16 +44,38 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~ElementTool() {}
|
virtual ~ElementTool() {}
|
||||||
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){
|
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) {
|
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->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) {
|
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->CreateBox(position1.X, position1.Y, position2.X, position2.Y, toolID, 0);
|
||||||
}
|
}
|
||||||
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
|
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
|
||||||
sim->flood_parts(position.X, position.Y, toolID, -1, -1, 0);
|
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->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->CreateWallBox(position1.X, position1.Y, position2.X, position2.Y, toolID, 0);
|
||||||
|
}
|
||||||
|
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
|
||||||
|
sim->FloodWalls(position.X, position.Y, toolID, -1, -1, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -66,16 +88,16 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~GolTool() {}
|
virtual ~GolTool() {}
|
||||||
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){
|
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) {
|
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) {
|
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) {
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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_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 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_AIR 236
|
||||||
#define SPC_HEAT 237
|
#define SPC_HEAT 237
|
||||||
#define SPC_COOL 238
|
#define SPC_COOL 238
|
||||||
@ -80,9 +60,6 @@
|
|||||||
#define SPC_NGRV 244
|
#define SPC_NGRV 244
|
||||||
#define SPC_PROP 246
|
#define SPC_PROP 246
|
||||||
|
|
||||||
#define WL_ALLOWGAS 140
|
|
||||||
#define WL_GRAV 142
|
|
||||||
#define WL_ALLOWENERGY 145
|
|
||||||
|
|
||||||
#define NGT_GOL 0
|
#define NGT_GOL 0
|
||||||
#define NGT_HLIF 1
|
#define NGT_HLIF 1
|
||||||
|
@ -194,7 +194,7 @@ int SaveLoader::PSVLoad(unsigned char * data, int dataLength, Simulation * sim,
|
|||||||
{
|
{
|
||||||
//In old saves, ignore walls created by sign tool bug
|
//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
|
//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++;
|
p++;
|
||||||
continue;
|
continue;
|
||||||
@ -227,6 +227,39 @@ int SaveLoader::PSVLoad(unsigned char * data, int dataLength, Simulation * sim,
|
|||||||
sim->bmap[y][x]=WL_EHOLE;
|
sim->bmap[y][x]=WL_EHOLE;
|
||||||
if (sim->bmap[y][x]==13)
|
if (sim->bmap[y][x]==13)
|
||||||
sim->bmap[y][x]=WL_ALLOWGAS;
|
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++;
|
p++;
|
||||||
|
@ -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;
|
int i, j;
|
||||||
if (c==SPC_PROP)
|
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 (j=y1; j<=y2; j++)
|
||||||
for (i=x1; i<=x2; i++)
|
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)
|
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();
|
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 c = fullc&0xFF;
|
||||||
int x1, x2, dy = (c<PT_NUM)?1:CELL;
|
int x1, x2, dy = 1;
|
||||||
int co = c;
|
int co = c;
|
||||||
if (c==SPC_PROP)
|
if (c==SPC_PROP)
|
||||||
return 0;
|
return 0;
|
||||||
@ -200,7 +220,7 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags)
|
|||||||
if (create_part(-1,x, y, fullc)==-1)
|
if (create_part(-1,x, y, fullc)==-1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!create_parts(x, y, 0, 0, fullc, flags))
|
else if (!CreateParts(x, y, 0, 0, fullc, flags))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// fill children
|
// fill children
|
||||||
@ -209,7 +229,7 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags)
|
|||||||
if (y>=CELL+dy && x1==x2 &&
|
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-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)
|
(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);
|
FloodParts(x1, y-2, fullc, cm, bm, flags);
|
||||||
else if (y>=CELL+dy)
|
else if (y>=CELL+dy)
|
||||||
for (x=x1; x<=x2; x++)
|
for (x=x1; x<=x2; x++)
|
||||||
if ((pmap[y-1][x]&0xFF)!=PT_SPRK)
|
if ((pmap[y-1][x]&0xFF)!=PT_SPRK)
|
||||||
@ -217,14 +237,14 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags)
|
|||||||
if (x==x1 || x==x2 || y>=YRES-CELL-1 ||
|
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+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)
|
(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);
|
FloodParts(x, y-dy, fullc, cm, bm, flags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y<YRES-CELL-dy && x1==x2 &&
|
if (y<YRES-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+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)
|
(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);
|
FloodParts(x1, y+2, fullc, cm, bm, flags);
|
||||||
else if (y<YRES-CELL-dy)
|
else if (y<YRES-CELL-dy)
|
||||||
for (x=x1; x<=x2; x++)
|
for (x=x1; x<=x2; x++)
|
||||||
if ((pmap[y+1][x]&0xFF)!=PT_SPRK)
|
if ((pmap[y+1][x]&0xFF)!=PT_SPRK)
|
||||||
@ -232,7 +252,7 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags)
|
|||||||
if (x==x1 || x==x2 || y<0 ||
|
if (x==x1 || x==x2 || y<0 ||
|
||||||
(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+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)
|
(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);
|
FloodParts(x, y+dy, fullc, cm, bm, flags);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,12 +261,12 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags)
|
|||||||
if (y>=CELL+dy)
|
if (y>=CELL+dy)
|
||||||
for (x=x1; x<=x2; x++)
|
for (x=x1; x<=x2; x++)
|
||||||
if ((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm)
|
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;
|
return 0;
|
||||||
if (y<YRES-CELL-dy)
|
if (y<YRES-CELL-dy)
|
||||||
for (x=x1; x<=x2; x++)
|
for (x=x1; x<=x2; x++)
|
||||||
if ((pmap[y+dy][x]&0xFF)==cm && bmap[(y+dy)/CELL][x/CELL]==bm)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(cm==PT_INST&&co==PT_SPRK))
|
if (!(cm==PT_INST&&co==PT_SPRK))
|
||||||
@ -254,6 +274,78 @@ int Simulation::flood_parts(int x, int y, int fullc, int cm, int bm, int flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Simulation::FloodWalls(int x, int y, int c, int cm, int bm, int flags)
|
||||||
|
{
|
||||||
|
int x1, x2, dy = CELL;
|
||||||
|
int co = c;
|
||||||
|
if (cm==-1)
|
||||||
|
{
|
||||||
|
if (c==0)
|
||||||
|
{
|
||||||
|
cm = pmap[y][x]&0xFF;
|
||||||
|
if (!cm)
|
||||||
|
return 0;
|
||||||
|
//if ((flags&BRUSH_REPLACEMODE) && cm!=SLALT)
|
||||||
|
// return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
cm = 0;
|
||||||
|
}
|
||||||
|
if (bm==-1)
|
||||||
|
{
|
||||||
|
if (c==WL_ERASE)
|
||||||
|
{
|
||||||
|
bm = bmap[y/CELL][x/CELL];
|
||||||
|
if (!bm)
|
||||||
|
return 0;
|
||||||
|
if (bm==WL_WALL)
|
||||||
|
cm = 0xFF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bm = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm )/*||( (flags&BRUSH_SPECIFIC_DELETE) && cm!=SLALT)*/)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
// go left as far as possible
|
||||||
|
x1 = x2 = x;
|
||||||
|
while (x1>=CELL)
|
||||||
|
{
|
||||||
|
if ((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
x1--;
|
||||||
|
}
|
||||||
|
while (x2<XRES-CELL)
|
||||||
|
{
|
||||||
|
if ((pmap[y][x2+1]&0xFF)!=cm || bmap[y/CELL][(x2+1)/CELL]!=bm)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
x2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill span
|
||||||
|
for (x=x1; x<=x2; x++)
|
||||||
|
{
|
||||||
|
if (!CreateWalls(x, y, 0, 0, c, flags))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// fill children
|
||||||
|
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 (!FloodWalls(x, y-dy, c, cm, bm, flags))
|
||||||
|
return 0;
|
||||||
|
if (y<YRES-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;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int Simulation::flood_water(int x, int y, int i, int originaly, int check)
|
int Simulation::flood_water(int x, int y, int i, int originaly, int check)
|
||||||
{
|
{
|
||||||
int x1 = 0,x2 = 0;
|
int x1 = 0,x2 = 0;
|
||||||
@ -517,7 +609,7 @@ void Simulation::ApplyDecorationLine(int x1, int y1, int x2, int y2, int rx, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
//this creates particles from a brush, don't use if you want to create one particle
|
//this creates particles from a brush, don't use if you want to create one particle
|
||||||
int Simulation::create_parts(int x, int y, int rx, int ry, int c, int flags, Brush * cBrush)
|
int Simulation::CreateParts(int x, int y, int rx, int ry, int c, int flags, Brush * cBrush)
|
||||||
{
|
{
|
||||||
int i, j, r, f = 0, u, v, oy, ox, b = 0, dw = 0, stemp = 0, p;//n;
|
int i, j, r, f = 0, u, v, oy, ox, b = 0, dw = 0, stemp = 0, p;//n;
|
||||||
|
|
||||||
@ -531,32 +623,6 @@ int Simulation::create_parts(int x, int y, int rx, int ry, int c, int flags, Bru
|
|||||||
if (c==SPC_WIND || c==PT_FIGH)
|
if (c==SPC_WIND || c==PT_FIGH)
|
||||||
return 0;
|
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 (c==PT_LIGH)
|
||||||
{
|
{
|
||||||
if (lighting_recreate>0 && rx+ry>0)
|
if (lighting_recreate>0 && rx+ry>0)
|
||||||
@ -574,48 +640,6 @@ int Simulation::create_parts(int x, int y, int rx, int ry, int c, int flags, Bru
|
|||||||
else return 0;
|
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<XRES/CELL&&oy>=0&&oy<YRES/CELL)
|
|
||||||
{
|
|
||||||
i = ox;
|
|
||||||
j = oy;
|
|
||||||
if (b==WL_FAN)
|
|
||||||
{
|
|
||||||
fvx[j][i] = 0.0f;
|
|
||||||
fvy[j][i] = 0.0f;
|
|
||||||
}
|
|
||||||
if (b==WL_STREAM)
|
|
||||||
{
|
|
||||||
i = x + rx/2;
|
|
||||||
j = y + ry/2;
|
|
||||||
for (v=-1; v<2; v++)
|
|
||||||
for (u=-1; u<2; u++)
|
|
||||||
if (i+u>=0 && i+u<XRES/CELL &&
|
|
||||||
j+v>=0 && j+v<YRES/CELL &&
|
|
||||||
bmap[j+v][i+u] == WL_STREAM)
|
|
||||||
return 1;
|
|
||||||
bmap[j][i] = WL_STREAM;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (b==0 && bmap[j][i]==WL_GRAV) gravwl_timeout = 60;
|
|
||||||
bmap[j][i] = b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//eraser
|
//eraser
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
{
|
{
|
||||||
@ -696,7 +720,64 @@ int Simulation::create_parts(int x, int y, int rx, int ry, int c, int flags, Bru
|
|||||||
return !f;
|
return !f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulation::create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags, Brush * cBrush)
|
int Simulation::CreateWalls(int x, int y, int rx, int ry, int c, int flags, Brush * cBrush)
|
||||||
|
{
|
||||||
|
int i, j, r, f = 0, u, v, oy, ox, b = 0, dw = 0, stemp = 0, p;//n;
|
||||||
|
|
||||||
|
if(cBrush)
|
||||||
|
{
|
||||||
|
rx = cBrush->GetRadius().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<XRES/CELL&&oy>=0&&oy<YRES/CELL)
|
||||||
|
{
|
||||||
|
i = ox;
|
||||||
|
j = oy;
|
||||||
|
if (b==WL_FAN)
|
||||||
|
{
|
||||||
|
fvx[j][i] = 0.0f;
|
||||||
|
fvy[j][i] = 0.0f;
|
||||||
|
}
|
||||||
|
if (b==WL_STREAM)
|
||||||
|
{
|
||||||
|
i = x + rx/2;
|
||||||
|
j = y + ry/2;
|
||||||
|
for (v=-1; v<2; v++)
|
||||||
|
for (u=-1; u<2; u++)
|
||||||
|
if (i+u>=0 && i+u<XRES/CELL &&
|
||||||
|
j+v>=0 && j+v<YRES/CELL &&
|
||||||
|
bmap[j+v][i+u] == WL_STREAM)
|
||||||
|
return 1;
|
||||||
|
bmap[j][i] = WL_STREAM;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (b==0 && bmap[j][i]==WL_GRAV) gravwl_timeout = 60;
|
||||||
|
bmap[j][i] = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Simulation::CreateLine(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;
|
int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy;
|
||||||
float e, de;
|
float e, de;
|
||||||
@ -732,9 +813,9 @@ void Simulation::create_line(int x1, int y1, int x2, int y2, int rx, int ry, int
|
|||||||
for (x=x1; x<=x2; x++)
|
for (x=x1; x<=x2; x++)
|
||||||
{
|
{
|
||||||
if (cp)
|
if (cp)
|
||||||
create_parts(y, x, rx, ry, c, flags, cBrush);
|
CreateParts(y, x, rx, ry, c, flags, cBrush);
|
||||||
else
|
else
|
||||||
create_parts(x, y, rx, ry, c, flags, cBrush);
|
CreateParts(x, y, rx, ry, c, flags, cBrush);
|
||||||
e += de;
|
e += de;
|
||||||
if (e >= 0.5f)
|
if (e >= 0.5f)
|
||||||
{
|
{
|
||||||
@ -743,9 +824,62 @@ void Simulation::create_line(int x1, int y1, int x2, int y2, int rx, int ry, int
|
|||||||
&& ((y1<y2) ? (y<=y2) : (y>=y2)))
|
&& ((y1<y2) ? (y<=y2) : (y>=y2)))
|
||||||
{
|
{
|
||||||
if (cp)
|
if (cp)
|
||||||
create_parts(y, x, rx, ry, c, flags, cBrush);
|
CreateParts(y, x, rx, ry, c, flags, cBrush);
|
||||||
else
|
else
|
||||||
create_parts(x, y, rx, ry, c, flags, cBrush);
|
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<y2) ? 1 : -1;
|
||||||
|
for (x=x1; x<=x2; x++)
|
||||||
|
{
|
||||||
|
if (cp)
|
||||||
|
CreateWalls(y, x, rx, ry, c, flags, cBrush);
|
||||||
|
else
|
||||||
|
CreateWalls(x, y, rx, ry, c, flags, cBrush);
|
||||||
|
e += de;
|
||||||
|
if (e >= 0.5f)
|
||||||
|
{
|
||||||
|
y += sy;
|
||||||
|
if (!(rx+ry) && ((y1<y2) ? (y<=y2) : (y>=y2)))
|
||||||
|
{
|
||||||
|
if (cp)
|
||||||
|
CreateWalls(y, x, rx, ry, c, flags, cBrush);
|
||||||
|
else
|
||||||
|
CreateWalls(x, y, rx, ry, c, flags, cBrush);
|
||||||
}
|
}
|
||||||
e -= 1.0f;
|
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;
|
xmid[i+1] += (rand()%variance)-voffset;
|
||||||
ymid[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(xmid);
|
||||||
free(ymid);
|
free(ymid);
|
||||||
|
@ -244,14 +244,22 @@ public:
|
|||||||
void update_particles();
|
void update_particles();
|
||||||
void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert);
|
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 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);
|
void CreateBox(int x1, int y1, int x2, int y2, int c, int flags);
|
||||||
int create_parts(int x, int y, int rx, int ry, int c, int flags, Brush * cBrush = NULL);
|
int FloodParts(int x, int y, int c, int cm, int bm, int flags);
|
||||||
void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags, Brush * cBrush = NULL);
|
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 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 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 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 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);
|
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_get(int block1, int block2, int resblock1[], int resblock2[]);
|
||||||
inline void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
|
inline void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
|
||||||
|
@ -132,35 +132,26 @@ wall_type * LoadWalls(int & wallCount)
|
|||||||
{
|
{
|
||||||
wall_type wtypes[] =
|
wall_type wtypes[] =
|
||||||
{
|
{
|
||||||
|
{PIXPACK(0x808080), PIXPACK(0x000000), 0, "Erases walls."},
|
||||||
{PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, "Wall. Indestructible. Blocks everything. Conductive."},
|
{PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, "Wall. Indestructible. Blocks everything. Conductive."},
|
||||||
{PIXPACK(0x808080), PIXPACK(0x808080), 0, "E-Wall. Becomes transparent when electricity is connected."},
|
{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(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, "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(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(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), 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(0x808080), PIXPACK(0x000000), 3, "Wall. Indestructible. Blocks everything."},
|
||||||
{PIXPACK(0x3C3C3C), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks particles, allows air"},
|
{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(0x575757), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and gasses, allows powders"},
|
||||||
{PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, "Conductor, allows particles, conducts electricity"},
|
{PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, "Conductor, allows particles, conducts electricity"},
|
||||||
{PIXPACK(0x242424), PIXPACK(0x101010), 0, "E-Hole, absorbs particles, release them when powered"},
|
{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(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(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), 4, "Energy wall, allows only energy type particles to pass"},
|
||||||
{PIXPACK(0xFFAA00), PIXPACK(0xAA5500), -1, "Property edit tool"},
|
|
||||||
};
|
};
|
||||||
wallCount = SC_TOTAL;
|
wallCount = UI_WALLCOUNT;
|
||||||
wall_type * wtypesT = (wall_type*)malloc(SC_TOTAL*sizeof(wall_type));
|
wall_type * wtypesT = (wall_type*)malloc(UI_WALLCOUNT*sizeof(wall_type));
|
||||||
memcpy(wtypesT, wtypes, SC_TOTAL*sizeof(wall_type));
|
memcpy(wtypesT, wtypes, UI_WALLCOUNT*sizeof(wall_type));
|
||||||
return wtypesT;
|
return wtypesT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,23 +27,44 @@
|
|||||||
|
|
||||||
#define UI_WALLSTART 222
|
#define UI_WALLSTART 222
|
||||||
#define UI_ACTUALSTART 122
|
#define UI_ACTUALSTART 122
|
||||||
#define UI_WALLCOUNT 25
|
#define UI_WALLCOUNT 16
|
||||||
|
|
||||||
#define WL_WALLELEC 122
|
#define O_WL_WALLELEC 122
|
||||||
#define WL_EWALL 123
|
#define O_WL_EWALL 123
|
||||||
#define WL_DETECT 124
|
#define O_WL_DETECT 124
|
||||||
#define WL_STREAM 125
|
#define O_WL_STREAM 125
|
||||||
#define WL_SIGN 126
|
#define O_WL_SIGN 126
|
||||||
#define WL_FAN 127
|
#define O_WL_FAN 127
|
||||||
#define WL_FANHELPER 255
|
#define O_WL_FANHELPER 255
|
||||||
#define WL_ALLOWLIQUID 128
|
#define O_WL_ALLOWLIQUID 128
|
||||||
#define WL_DESTROYALL 129
|
#define O_WL_DESTROYALL 129
|
||||||
#define WL_ERASE 130
|
#define O_WL_ERASE 130
|
||||||
#define WL_WALL 131
|
#define O_WL_WALL 131
|
||||||
#define WL_ALLOWAIR 132
|
#define O_WL_ALLOWAIR 132
|
||||||
#define WL_ALLOWSOLID 133
|
#define O_WL_ALLOWSOLID 133
|
||||||
#define WL_ALLOWALLELEC 134
|
#define O_WL_ALLOWALLELEC 134
|
||||||
#define WL_EHOLE 135
|
#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_AIR 236
|
||||||
#define SPC_HEAT 237
|
#define SPC_HEAT 237
|
||||||
@ -54,10 +75,6 @@
|
|||||||
#define SPC_NGRV 244
|
#define SPC_NGRV 244
|
||||||
#define SPC_PROP 246
|
#define SPC_PROP 246
|
||||||
|
|
||||||
#define WL_ALLOWGAS 140
|
|
||||||
#define WL_GRAV 142
|
|
||||||
#define WL_ALLOWENERGY 145
|
|
||||||
|
|
||||||
#define DECO_DRAW 0
|
#define DECO_DRAW 0
|
||||||
#define DECO_ADD 1
|
#define DECO_ADD 1
|
||||||
#define DECO_SUBTRACT 2
|
#define DECO_SUBTRACT 2
|
||||||
|
@ -102,8 +102,8 @@ int Element_BOMB::update(UPDATE_FUNC_ARGS)
|
|||||||
parts[nb].temp = MAX_TEMP;
|
parts[nb].temp = MAX_TEMP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//create_parts(x, y, 9, 9, PT_BOMB);
|
//CreateParts(x, y, 9, 9, PT_BOMB);
|
||||||
//create_parts(x, y, 8, 8, PT_NONE);
|
//CreateParts(x, y, 8, 8, PT_NONE);
|
||||||
sim->kill_part(i);
|
sim->kill_part(i);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
|
|||||||
nearp = sim->nearest_part(i, PT_ETRD, -1);
|
nearp = sim->nearest_part(i, PT_ETRD, -1);
|
||||||
if (nearp!=-1 && sim->parts_avg(i, nearp, PT_INSL)!=PT_INSL)
|
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);
|
sim->part_change_type(i,x,y,ct);
|
||||||
ct = parts[i].ctype = PT_NONE;
|
ct = parts[i].ctype = PT_NONE;
|
||||||
parts[i].life = 20;
|
parts[i].life = 20;
|
||||||
@ -243,7 +243,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
|
|||||||
else if (rt==PT_INST) {
|
else if (rt==PT_INST) {
|
||||||
if (parts[r>>8].life==0 && parts[i].life<4)
|
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) {
|
else if (parts[r>>8].life==0 && parts[i].life<4) {
|
||||||
|
@ -304,7 +304,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
{
|
{
|
||||||
int np = -1;
|
int np = -1;
|
||||||
if (playerp->elem == SPC_AIR)
|
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
|
else if (playerp->elem==PT_LIGH && playerp->frames<30)//limit lightning creation rate
|
||||||
np = -1;
|
np = -1;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user