some VIBR changes/fixes
This commit is contained in:
parent
04b76a4b48
commit
cd7ca6d417
@ -22,7 +22,7 @@ Element_VIBR::Element_VIBR()
|
|||||||
Flammable = 0;
|
Flammable = 0;
|
||||||
Explosive = 0;
|
Explosive = 0;
|
||||||
Meltable = 0;
|
Meltable = 0;
|
||||||
Hardness = 1;
|
Hardness = 0;
|
||||||
|
|
||||||
Weight = 100;
|
Weight = 100;
|
||||||
|
|
||||||
@ -47,26 +47,26 @@ Element_VIBR::Element_VIBR()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Element_VIBR::update(UPDATE_FUNC_ARGS) {
|
int Element_VIBR::update(UPDATE_FUNC_ARGS) {
|
||||||
int r, rx, ry, rt, lol, ftw, trade;
|
int r, rx, ry, rt, transfer, trade;
|
||||||
rt = parts[r>>8].type;
|
rt = parts[r>>8].type;
|
||||||
//Heat absorption code
|
//Heat absorption code
|
||||||
if (parts[i].temp>(273.15f+0.0f))
|
if (parts[i].temp>274.65f)
|
||||||
{
|
{
|
||||||
parts[i].ctype+=3;
|
parts[i].ctype++;
|
||||||
parts[i].temp-=3;
|
parts[i].temp-=3;
|
||||||
}
|
}
|
||||||
if (parts[i].temp<(273.15f-1.0f))
|
if (parts[i].temp<271.65f)
|
||||||
{
|
{
|
||||||
parts[i].ctype-=3;
|
parts[i].ctype--;
|
||||||
parts[i].temp+=3;
|
parts[i].temp+=3;
|
||||||
}
|
}
|
||||||
//Pressure absorption code
|
//Pressure absorption code
|
||||||
if (sim->pv[y/CELL][x/CELL]>0 && sim->pv[y/CELL][x/CELL]>0.5)
|
if (sim->pv[y/CELL][x/CELL]>2.5)
|
||||||
{
|
{
|
||||||
parts[i].tmp++;
|
parts[i].tmp++;
|
||||||
sim->pv[y/CELL][x/CELL]--;
|
sim->pv[y/CELL][x/CELL]--;
|
||||||
}
|
}
|
||||||
if (sim->pv[y/CELL][x/CELL]<-5)
|
if (sim->pv[y/CELL][x/CELL]<-2.5)
|
||||||
{
|
{
|
||||||
sim->pv[y/CELL][x/CELL]++;
|
sim->pv[y/CELL][x/CELL]++;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ int r, rx, ry, rt, lol, ftw, trade;
|
|||||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
|
sim->part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
|
||||||
}
|
}
|
||||||
//Release all heat
|
//Release all heat
|
||||||
if ((3000<parts[i].ctype && parts[i].ctype<3333) || parts[i].tmp>90 || (80<parts[i].tmp2 && parts[i].tmp2<100))
|
if ((1000<parts[i].ctype && parts[i].ctype<1200) || parts[i].tmp>90 || (80<parts[i].tmp2 && parts[i].tmp2<100))
|
||||||
{
|
{
|
||||||
for(rx=-1; rx<2; rx++)
|
for(rx=-1; rx<2; rx++)
|
||||||
for(ry=-1; ry<2; ry++)
|
for(ry=-1; ry<2; ry++)
|
||||||
@ -94,11 +94,11 @@ int r, rx, ry, rt, lol, ftw, trade;
|
|||||||
parts[r>>8].temp = MAX_TEMP;
|
parts[r>>8].temp = MAX_TEMP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (3200<parts[i].ctype || parts[i].tmp>95 || 90<parts[i].tmp2)
|
if (1200<parts[i].ctype || parts[i].tmp>95 || 90<parts[i].tmp2)
|
||||||
parts[i].ctype-=3;
|
parts[i].ctype--;
|
||||||
}
|
}
|
||||||
//Explosion code
|
//Explosion code
|
||||||
if (parts[i].ctype>3333 || parts[i].tmp>100 || parts[i].tmp2>100)
|
if (parts[i].ctype>1200 || parts[i].tmp>100 || parts[i].tmp2>100)
|
||||||
{
|
{
|
||||||
sim->part_change_type(i,x,y,PT_EXOT);
|
sim->part_change_type(i,x,y,PT_EXOT);
|
||||||
sim->create_part(-1,x,y-1,PT_ELEC);
|
sim->create_part(-1,x,y-1,PT_ELEC);
|
||||||
@ -117,14 +117,14 @@ int r, rx, ry, rt, lol, ftw, trade;
|
|||||||
if (!r)
|
if (!r)
|
||||||
continue;
|
continue;
|
||||||
//Melts into EXOT
|
//Melts into EXOT
|
||||||
if ((r&0xFF)==PT_EXOT && 1>(rand()%250))
|
if ((r&0xFF)==PT_EXOT && !(rand()%250))
|
||||||
{
|
{
|
||||||
sim->part_change_type(i,x,y,PT_EXOT);
|
sim->part_change_type(i,x,y,PT_EXOT);
|
||||||
}
|
}
|
||||||
//Absorbs energy particles
|
//Absorbs energy particles
|
||||||
if ((r&0xFF)==PT_NEUT || (r&0xFF)==PT_ELEC || (r&0xFF)==PT_PHOT)
|
if ((r&0xFF)==PT_NEUT || (r&0xFF)==PT_ELEC || (r&0xFF)==PT_PHOT)
|
||||||
{
|
{
|
||||||
parts[i].tmp2+=3;
|
parts[i].tmp2++;
|
||||||
sim->kill_part(r>>8);
|
sim->kill_part(r>>8);
|
||||||
}
|
}
|
||||||
if ((r&0xFF)==PT_BOYL)
|
if ((r&0xFF)==PT_BOYL)
|
||||||
@ -134,42 +134,48 @@ int r, rx, ry, rt, lol, ftw, trade;
|
|||||||
}
|
}
|
||||||
for (trade = 0; trade < 9; trade++)
|
for (trade = 0; trade < 9; trade++)
|
||||||
{
|
{
|
||||||
rx = rand()%5-2;
|
int random = rand();
|
||||||
ry = rand()%5-2;
|
rx = random%7-3;
|
||||||
|
ry = (random>>3)%7-3;
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if (!r)
|
if ((r&0xFF)!=PT_VIBR)
|
||||||
continue;
|
continue;
|
||||||
if ((r&0xFF)==PT_VIBR&&(parts[i].tmp>parts[r>>8].tmp)&&parts[i].tmp>0)//diffusion
|
if (parts[i].tmp > parts[r>>8].tmp) { //tmp diffusion
|
||||||
{
|
transfer = parts[i].tmp - parts[r>>8].tmp;
|
||||||
lol = parts[i].tmp - parts[r>>8].tmp;
|
if (transfer == 1) {
|
||||||
if (lol ==1)
|
|
||||||
{
|
|
||||||
parts[r>>8].tmp++;
|
parts[r>>8].tmp++;
|
||||||
parts[i].tmp--;
|
parts[i].tmp--;
|
||||||
trade = 9;
|
trade = 9;
|
||||||
}
|
} else if (transfer > 0) {
|
||||||
else if (lol>0)
|
parts[r>>8].tmp += transfer/2;
|
||||||
{
|
parts[i].tmp -= transfer/2;
|
||||||
parts[r>>8].tmp += lol/2;
|
|
||||||
parts[i].tmp -= lol/2;
|
|
||||||
trade = 9;
|
trade = 9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((r&0xFF)==PT_VIBR&&(parts[i].tmp2>parts[r>>8].tmp2)&&parts[i].tmp2>0)//diffusion
|
if (parts[i].tmp2 > parts[r>>8].tmp2) { //tmp2 diffusion
|
||||||
{
|
transfer = parts[i].tmp2 - parts[r>>8].tmp2;
|
||||||
ftw = parts[i].tmp2 - parts[r>>8].tmp2;
|
if (transfer == 1)
|
||||||
if (ftw ==1)
|
|
||||||
{
|
{
|
||||||
parts[r>>8].tmp2++;
|
parts[r>>8].tmp2++;
|
||||||
parts[i].tmp2--;
|
parts[i].tmp2--;
|
||||||
|
trade = 9; }
|
||||||
|
else if (transfer > 0) {
|
||||||
|
parts[r>>8].tmp2 += transfer/2;
|
||||||
|
parts[i].tmp2 -= transfer/2;
|
||||||
trade = 9;
|
trade = 9;
|
||||||
}
|
}
|
||||||
else if (ftw>0)
|
}
|
||||||
{
|
if (parts[i].ctype > parts[r>>8].ctype) { //ctype diffusion
|
||||||
parts[r>>8].tmp2 += ftw/2;
|
transfer = parts[i].ctype - parts[r>>8].ctype;
|
||||||
parts[i].tmp2 -= ftw/2;
|
if (transfer == 1) {
|
||||||
|
parts[r>>8].ctype++;
|
||||||
|
parts[i].ctype--;
|
||||||
|
trade = 9;
|
||||||
|
} else if (transfer > 0) {
|
||||||
|
parts[r>>8].ctype += transfer/2;
|
||||||
|
parts[i].ctype -= transfer/2;
|
||||||
trade = 9;
|
trade = 9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,35 +187,37 @@ int r, rx, ry, rt, lol, ftw, trade;
|
|||||||
int Element_VIBR::graphics(GRAPHICS_FUNC_ARGS)
|
int Element_VIBR::graphics(GRAPHICS_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
float maxtemp = fmax(cpart->tmp,cpart->temp);
|
float maxtemp = fmax(cpart->tmp,cpart->temp);
|
||||||
if (cpart->ctype > 1000 && cpart->ctype < 2000)
|
int gradient = max(cpart->ctype/12.0f, cpart->tmp);
|
||||||
|
gradient = max(gradient, cpart->tmp2);
|
||||||
|
if (gradient > 31 && gradient < 63)
|
||||||
{
|
{
|
||||||
*colr += (int)restrict_flt((cpart->ctype-1000)/20,0,51);
|
*colr += (int)restrict_flt((gradient-31)*0.627,0,51);
|
||||||
*colg += (int)restrict_flt((cpart->ctype-1000)/18,0,55);
|
*colg += (int)restrict_flt((gradient-31)*0.582,0,55);
|
||||||
*colb += (int)restrict_flt((cpart->ctype-1000)/20,0,51);
|
*colb += (int)restrict_flt((gradient-31)*0.627,0,51);
|
||||||
}
|
}
|
||||||
else if (cpart->ctype >= 2000 && cpart->ctype < 3000)
|
else if (gradient >= 63 && gradient < 94)
|
||||||
{
|
{
|
||||||
*colr += (int)restrict_flt((cpart->ctype-2000)/20+51,51,100);
|
*colr += (int)restrict_flt((gradient-63)*.636+51,51,100);
|
||||||
*colg += (int)restrict_flt((cpart->ctype-2000)/31+55,55,87);
|
*colg += (int)restrict_flt((gradient-63)*.969+55,55,87);
|
||||||
*colb += (int)restrict_flt((cpart->ctype-2000)/20+51,51,100);
|
*colb += (int)restrict_flt((gradient-63)*.636+51,51,100);
|
||||||
}
|
}
|
||||||
else if (cpart->ctype >= 3000 && cpart->ctype < 3200)
|
else if (gradient >= 94 && gradient < 100)
|
||||||
{
|
{
|
||||||
*colr += (int)restrict_flt((cpart->ctype-3000)/1.7+100,100,218);
|
*colr += (int)restrict_flt((gradient-94)*19.7+100,100,218);
|
||||||
*colg += (int)restrict_flt((cpart->ctype-3000)/2+87,87,192);
|
*colg += (int)restrict_flt((gradient-94)*17.5+87,87,192);
|
||||||
*colb += (int)restrict_flt((cpart->ctype-3000)/1.7+100,100,218);
|
*colb += (int)restrict_flt((gradient-94)*19.7+100,100,218);
|
||||||
}
|
}
|
||||||
else if (cpart->ctype >= 3200)
|
else if (gradient >= 100)
|
||||||
{
|
{
|
||||||
*pixel_mode = PMODE_NONE;
|
*pixel_mode = PMODE_NONE;
|
||||||
*pixel_mode |= FIRE_ADD;
|
*pixel_mode |= FIRE_BLEND;
|
||||||
*firea = 90;
|
*firea = 90;
|
||||||
*firer = *colr;
|
|
||||||
*fireg = *colg;
|
|
||||||
*fireb = *colb;
|
|
||||||
*colr = 146;
|
*colr = 146;
|
||||||
*colg = 158;
|
*colg = 158;
|
||||||
*colb = 113;
|
*colb = 113;
|
||||||
|
*firer = *colr;
|
||||||
|
*fireg = *colg;
|
||||||
|
*fireb = *colb;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user