diff options
| author | jacob1 <jfu614@gmail.com> | 2013-05-16 21:01:33 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-05-16 21:01:33 (GMT) |
| commit | 6f8e2c03456552bdd54355606b8b8389f884c06d (patch) | |
| tree | dc51900a69809f0230239dcee562d2758d6e550f /src/simulation | |
| parent | 751da54183acb5f7dae94e815aec1e0daf7bbd36 (diff) | |
| download | powder-6f8e2c03456552bdd54355606b8b8389f884c06d.zip powder-6f8e2c03456552bdd54355606b8b8389f884c06d.tar.gz | |
remove unneeded / duplicate constants, fix SPC_AIR/other tools so it won't conflict with lua elements (the 11th one won't work right now)
Diffstat (limited to 'src/simulation')
| -rw-r--r-- | src/simulation/Elements.h | 35 | ||||
| -rw-r--r-- | src/simulation/Simulation.cpp | 105 | ||||
| -rw-r--r-- | src/simulation/SimulationData.h | 12 | ||||
| -rw-r--r-- | src/simulation/elements/STKM.cpp | 2 | ||||
| -rw-r--r-- | src/simulation/tools/Cool.cpp | 5 | ||||
| -rw-r--r-- | src/simulation/tools/Heat.cpp | 5 |
6 files changed, 28 insertions, 136 deletions
diff --git a/src/simulation/Elements.h b/src/simulation/Elements.h index cb13216..67e2c4b 100644 --- a/src/simulation/Elements.h +++ b/src/simulation/Elements.h @@ -48,41 +48,6 @@ #define BOUNDS_CHECK true -#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 NGT_GOL 0 -#define NGT_HLIF 1 -#define NGT_ASIM 2 -#define NGT_2x2 3 -#define NGT_DANI 4 -#define NGT_AMOE 5 -#define NGT_MOVE 6 -#define NGT_PGOL 7 -#define NGT_DMOE 8 -#define NGT_34 9 -#define NGT_LLIF 10 -#define NGT_STAN 11 -#define NGT_SEED 12 -#define NGT_MAZE 13 -#define NGT_COAG 14 -#define NGT_WALL 15 -#define NGT_GNAR 16 -#define NGT_REPL 17 -#define NGT_MYST 18 -#define NGT_LOTE 19 -#define NGT_FRG2 20 -#define NGT_STAR 21 -#define NGT_FROG 22 -#define NGT_BRAN 23 - #define OLD_PT_WIND 147 //#define PT_NUM 161 diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 946b356..cf8f149 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -2631,43 +2631,12 @@ int Simulation::create_part(int p, int x, int y, int tv) int t = tv & 0xFF; int v = (tv >> 8) & 0xFFFFFF; - if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<=0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM&&t!=SPC_PGRV&&t!=SPC_NGRV)) + if (x<0 || y<0 || x>=XRES || y>=YRES) return -1; - if (t>=0 && t<PT_NUM && !elements[t].Enabled && t!=SPC_AIR) + if (t>=0 && t<PT_NUM && !elements[t].Enabled) return -1; - /*if (t==SPC_HEAT||t==SPC_COOL) - { - if ((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)<PT_NUM) - { - if (t==SPC_HEAT&&parts[pmap[y][x]>>8].temp<MAX_TEMP) - { - if ((pmap[y][x]&0xFF)==PT_PUMP || (pmap[y][x]&0xFF)==PT_GPMP) { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 0.1f, MIN_TEMP, MAX_TEMP); - } else if ((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 50.0f, MIN_TEMP, MAX_TEMP); - } else { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - } - if (t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) - { - if ((pmap[y][x]&0xFF)==PT_PUMP || (pmap[y][x]&0xFF)==PT_GPMP) { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 0.1f, MIN_TEMP, MAX_TEMP); - } else if ((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 50.0f, MIN_TEMP, MAX_TEMP); - } else { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - } - return pmap[y][x]>>8; - } - else - { - return -1; - } - }*/ - if (t==SPC_AIR) + if (tv == SPC_AIR) { pv[y/CELL][x/CELL] += 0.03f; if (y+CELL<YRES) @@ -2680,30 +2649,6 @@ int Simulation::create_part(int p, int x, int y, int tv) } return -1; } - if (t==SPC_VACUUM) - { - pv[y/CELL][x/CELL] -= 0.03f; - if (y+CELL<YRES) - pv[y/CELL+1][x/CELL] -= 0.03f; - if (x+CELL<XRES) - { - pv[y/CELL][x/CELL+1] -= 0.03f; - if (y+CELL<YRES) - pv[y/CELL+1][x/CELL+1] -= 0.03f; - } - return -1; - } - if (t==SPC_PGRV) - { - gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 5; - return -1; - } - if (t==SPC_NGRV) - { - gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = -5; - return -1; - } - if (t==PT_SPRK) { @@ -2712,10 +2657,9 @@ int Simulation::create_part(int p, int x, int y, int tv) if(type == PT_WIRE) { parts[index].ctype = PT_DUST; + return index; } - if (!(type == PT_INST || (elements[type].Properties&PROP_CONDUCTS))) - return -1; - if (parts[index].life!=0) + if (!(type == PT_INST || (elements[type].Properties&PROP_CONDUCTS)) || parts[index].life!=0) return -1; if (p == -2 && type == PT_INST) { @@ -2834,10 +2778,21 @@ int Simulation::create_part(int p, int x, int y, int tv) if (i>parts_lastActiveIndex) parts_lastActiveIndex = i; + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = elements[t].Temperature; + parts[i].tmp = 0; + parts[i].tmp2 = 0; parts[i].dcolour = 0; parts[i].flags = 0; if (t == PT_GLAS || t == PT_QRTZ || t == PT_TUNG) { + parts[i].pavg[0] = 0.0f; parts[i].pavg[1] = pv[y/CELL][x/CELL]; } else @@ -2845,19 +2800,7 @@ int Simulation::create_part(int p, int x, int y, int tv) parts[i].pavg[0] = 0.0f; parts[i].pavg[1] = 0.0f; } - if (t!=PT_STKM&&t!=PT_STKM2&&t!=PT_FIGH)//set everything to default values first, except for stickman. - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = elements[t].Temperature; - parts[i].tmp = 0; - parts[i].tmp2 = 0; - } + switch (t) { case PT_SOAP: @@ -2964,14 +2907,7 @@ int Simulation::create_part(int p, int x, int y, int tv) case PT_STKM: if (player.spwn==0) { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = elements[t].Temperature; Element_STKM::STKM_init_legs(this, &player, i); player.spwn = 1; player.elem = PT_DUST; @@ -2986,14 +2922,7 @@ int Simulation::create_part(int p, int x, int y, int tv) case PT_STKM2: if (player2.spwn==0) { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM2; - parts[i].vx = 0; - parts[i].vy = 0; parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = elements[t].Temperature; Element_STKM::STKM_init_legs(this, &player2, i); player2.spwn = 1; player2.elem = PT_DUST; diff --git a/src/simulation/SimulationData.h b/src/simulation/SimulationData.h index 770d732..219db51 100644 --- a/src/simulation/SimulationData.h +++ b/src/simulation/SimulationData.h @@ -19,8 +19,6 @@ #define SC_CRACKER2 16 #define SC_TOTAL 15 -#define UI_WALLSTART 222 -#define UI_ACTUALSTART 122 #define UI_WALLCOUNT 16 #define O_WL_WALLELEC 122 @@ -61,14 +59,8 @@ #define WL_ALLOWENERGY 15 #define WL_FLOODHELPER 255 -#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 OLD_SPC_AIR 236 +#define SPC_AIR 256 #define DECO_DRAW 0 #define DECO_ADD 1 diff --git a/src/simulation/elements/STKM.cpp b/src/simulation/elements/STKM.cpp index 93d5158..7767266 100644 --- a/src/simulation/elements/STKM.cpp +++ b/src/simulation/elements/STKM.cpp @@ -90,7 +90,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) { parts[i].temp += 1; //Death - if (parts[i].life<1 || (sim->pv[y/CELL][x/CELL]>=4.5f && playerp->elem != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... + if (parts[i].life<1 || (sim->pv[y/CELL][x/CELL]>=4.5f && playerp->elem != SPC_AIR) ) //If his HP is less than 0 or there is very big wind... { for (r=-2; r<=1; r++) { diff --git a/src/simulation/tools/Cool.cpp b/src/simulation/tools/Cool.cpp index 4c5788d..07c24f9 100644 --- a/src/simulation/tools/Cool.cpp +++ b/src/simulation/tools/Cool.cpp @@ -12,7 +12,10 @@ int Tool_Cool::Perform(Simulation * sim, Particle * cpart, int x, int y, float s { if(!cpart) return 0; - cpart->temp -= strength; + if (cpart->type == PT_PUMP || cpart->type == PT_GPMP) + cpart->temp -= .1f*strength; + else + cpart->temp -= strength; if(cpart->temp > MAX_TEMP) cpart->temp = MAX_TEMP; if(cpart->temp < 0) diff --git a/src/simulation/tools/Heat.cpp b/src/simulation/tools/Heat.cpp index 1be3e6e..2d6510c 100644 --- a/src/simulation/tools/Heat.cpp +++ b/src/simulation/tools/Heat.cpp @@ -12,7 +12,10 @@ int Tool_Heat::Perform(Simulation * sim, Particle * cpart, int x, int y, float s { if(!cpart) return 0; - cpart->temp += strength; + if (cpart->type == PT_PUMP || cpart->type == PT_GPMP) + cpart->temp += .1f*strength; + else + cpart->temp += strength; if(cpart->temp > MAX_TEMP) cpart->temp = MAX_TEMP; if(cpart->temp < 0) |
