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)

This commit is contained in:
jacob1 2013-05-16 17:01:33 -04:00
parent 751da54183
commit 6f8e2c0345
7 changed files with 36 additions and 136 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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++)
{

View File

@ -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)

View File

@ -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)