From 6f8e2c03456552bdd54355606b8b8389f884c06d Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 16 May 2013 17:01:33 -0400 Subject: 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) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 06441c8..265ff27 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -947,6 +947,11 @@ void GameSave::readOPS(char * data, int dataLength) case PT_PSTN: if (savedVersion < 87 && particles[newIndex].ctype) particles[newIndex].life = 1; + case PT_STKM: + case PT_STKM2: + case PT_FIGH: + if (savedVersion < 88 && particles[newIndex].ctype == OLD_SPC_AIR) + particles[newIndex].ctype = SPC_AIR; } newIndex++; } @@ -1566,6 +1571,9 @@ void GameSave::readPSv(char * data, int dataLength) particles[i-1].ctype = (((unsigned char)(firw_data[caddress]))<<16) | (((unsigned char)(firw_data[caddress+1]))<<8) | ((unsigned char)(firw_data[caddress+2])); } } + if (ver < 88) //fix air blowing stickmen + if ((particles[i-1].type == PT_STKM || particles[i-1].type == PT_STKM2 || particles[i-1].type == PT_FIGH) && particles[i-1].ctype == OLD_SPC_AIR) + particles[i-1].ctype == SPC_AIR; } } 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=0 && t>8].temp>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+CELLparts_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) -- cgit v0.9.2-21-gd62e