Jacob's laziness made me do this again.
CELL checks +-1 aren't required. Moo
This commit is contained in:
parent
63843c2bd7
commit
3263c9437a
@ -62,13 +62,15 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
|||||||
bool isBlackDeco = false;
|
bool isBlackDeco = false;
|
||||||
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
|
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
|
||||||
int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
|
int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
|
||||||
int colored = 0;
|
int colored = 0, rt;
|
||||||
for (docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi) {
|
for (docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi) {
|
||||||
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
|
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r = pmap[y+nyi+nyy][x+nxi+nxx];
|
r = pmap[y+nyi+nyy][x+nxi+nxx];
|
||||||
if (!r) {
|
rt = r & 0xFF;
|
||||||
|
r = r >> 8;
|
||||||
|
if (!rt) {
|
||||||
int nr = sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
|
int nr = sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
|
||||||
if (nr!=-1) {
|
if (nr!=-1) {
|
||||||
if (destroy) {//if it came from PSCN
|
if (destroy) {//if it came from PSCN
|
||||||
@ -81,61 +83,52 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
|||||||
parts[nr].dcolour = 0xFF000000;
|
parts[nr].dcolour = 0xFF000000;
|
||||||
}
|
}
|
||||||
} else if (!destroy) {
|
} else if (!destroy) {
|
||||||
if ((r&0xFF)==PT_BRAY) {
|
if (rt==PT_BRAY) {
|
||||||
//cases for hitting different BRAY modes
|
//cases for hitting different BRAY modes
|
||||||
switch(parts[r>>8].tmp) {
|
switch(parts[r].tmp) {
|
||||||
case 0://normal white
|
case 0://normal white
|
||||||
if (nyy!=0 || nxx!=0) {
|
if (nyy!=0 || nxx!=0) {
|
||||||
parts[r>>8].life = 1020;//makes it last a while
|
parts[r].life = 1020;//makes it last a while
|
||||||
parts[r>>8].tmp = 1;
|
parts[r].tmp = 1;
|
||||||
if (!parts[r>>8].ctype)//and colors it if it isn't already
|
if (!parts[r].ctype)//and colors it if it isn't already
|
||||||
parts[r>>8].ctype = colored;
|
parts[r].ctype = colored;
|
||||||
}
|
}
|
||||||
case 2://red bray, stop
|
case 2://red bray, stop
|
||||||
default://stop any other random tmp mode
|
default://stop any other random tmp mode
|
||||||
docontinue = 0;//then stop it
|
docontinue = 0;//then stop it
|
||||||
break;
|
break;
|
||||||
case 1://long life, reset it
|
case 1://long life, reset it
|
||||||
parts[r>>8].life = 1020;
|
parts[r].life = 1020;
|
||||||
//docontinue = 1;
|
//docontinue = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isBlackDeco)
|
if (isBlackDeco)
|
||||||
parts[r>>8].dcolour = 0xFF000000;
|
parts[r].dcolour = 0xFF000000;
|
||||||
} else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT
|
} else if (rt==PT_FILT) {//get color if passed through FILT
|
||||||
if (parts[r>>8].tmp != 6)
|
if (parts[r].tmp != 6)
|
||||||
{
|
{
|
||||||
colored = Element_FILT::interactWavelengths(&parts[r>>8], colored);
|
colored = Element_FILT::interactWavelengths(&parts[r], colored);
|
||||||
if (!colored)
|
if (!colored)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
isBlackDeco = (parts[r>>8].dcolour==0xFF000000);
|
isBlackDeco = (parts[r].dcolour==0xFF000000);
|
||||||
parts[r>>8].life = 4;
|
parts[r].life = 4;
|
||||||
//this if prevents BRAY from stopping on certain materials
|
//this if prevents BRAY from stopping on certain materials
|
||||||
} else if ((r&0xFF)!=PT_STOR && (r&0xFF)!=PT_INWR && ((r&0xFF)!=PT_SPRK || parts[r>>8].ctype!=PT_INWR) && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI && !((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
|
} else if (rt == PT_STOR) {
|
||||||
if (nyy!=0 || nxx!=0) {
|
if (parts[r].tmp)
|
||||||
sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
|
|
||||||
}
|
|
||||||
if (!(nostop && parts[r>>8].type==PT_SPRK && parts[r>>8].ctype >= 0 && parts[r>>8].ctype < PT_NUM && (sim->elements[parts[r>>8].ctype].Properties&PROP_CONDUCTS))) {
|
|
||||||
docontinue = 0;
|
|
||||||
} else {
|
|
||||||
docontinue = 1;
|
|
||||||
}
|
|
||||||
} else if((r&0xFF)==PT_STOR) {
|
|
||||||
if(parts[r>>8].tmp)
|
|
||||||
{
|
{
|
||||||
//Cause STOR to release
|
//Cause STOR to release
|
||||||
for (ry1 = 1; ry1 >= -1; ry1--){
|
for (ry1 = 1; ry1 >= -1; ry1--){
|
||||||
for (rx1 = 0; rx1 >= -1 && rx1 <= 1; rx1 = -rx1 - rx1 + 1){
|
for (rx1 = 0; rx1 >= -1 && rx1 <= 1; rx1 = -rx1 - rx1 + 1){
|
||||||
int np = sim->create_part(-1, x+nxi+nxx+rx1, y+nyi+nyy+ry1, parts[r>>8].tmp);
|
int np = sim->create_part(-1, x + nxi + nxx + rx1, y + nyi + nyy + ry1, parts[r].tmp);
|
||||||
if (np != -1)
|
if (np != -1)
|
||||||
{
|
{
|
||||||
parts[np].temp = parts[r>>8].temp;
|
parts[np].temp = parts[r].temp;
|
||||||
parts[np].life = parts[r>>8].tmp2;
|
parts[np].life = parts[r].tmp2;
|
||||||
parts[np].tmp = parts[r>>8].pavg[0];
|
parts[np].tmp = parts[r].pavg[0];
|
||||||
parts[np].ctype = parts[r>>8].pavg[1];
|
parts[np].ctype = parts[r].pavg[1];
|
||||||
parts[r>>8].tmp = 0;
|
parts[r].tmp = 0;
|
||||||
parts[r>>8].life = 10;
|
parts[r].life = 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,27 +136,36 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parts[r>>8].life = 10;
|
parts[r].life = 10;
|
||||||
|
}
|
||||||
|
} else if (rt != PT_INWR && (rt != PT_SPRK || parts[r].ctype != PT_INWR) && rt != PT_ARAY && rt != PT_WIFI && !(rt == PT_SWCH && parts[r].life >= 10)) {
|
||||||
|
if (nyy!=0 || nxx!=0) {
|
||||||
|
sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
|
||||||
|
}
|
||||||
|
if (!(nostop && parts[r].type==PT_SPRK && parts[r].ctype >= 0 && parts[r].ctype < PT_NUM && (sim->elements[parts[r].ctype].Properties&PROP_CONDUCTS))) {
|
||||||
|
docontinue = 0;
|
||||||
|
} else {
|
||||||
|
docontinue = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (destroy) {
|
} else if (destroy) {
|
||||||
if ((r&0xFF)==PT_BRAY) {
|
if (rt==PT_BRAY) {
|
||||||
parts[r>>8].tmp = 2;
|
parts[r].tmp = 2;
|
||||||
parts[r>>8].life = 1;
|
parts[r].life = 1;
|
||||||
docontinue = 1;
|
docontinue = 1;
|
||||||
if (isBlackDeco)
|
if (isBlackDeco)
|
||||||
parts[r>>8].dcolour = 0xFF000000;
|
parts[r].dcolour = 0xFF000000;
|
||||||
//this if prevents red BRAY from stopping on certain materials
|
//this if prevents red BRAY from stopping on certain materials
|
||||||
} else if ((r&0xFF)==PT_STOR || (r&0xFF)==PT_INWR || ((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_INWR) || (r&0xFF)==PT_ARAY || (r&0xFF)==PT_WIFI || (r&0xFF)==PT_FILT || ((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
|
} else if (rt==PT_STOR || rt==PT_INWR || (rt==PT_SPRK && parts[r].ctype==PT_INWR) || rt==PT_ARAY || rt==PT_WIFI || rt==PT_FILT || (rt==PT_SWCH && parts[r].life>=10)) {
|
||||||
if((r&0xFF)==PT_STOR)
|
if(rt==PT_STOR)
|
||||||
{
|
{
|
||||||
parts[r>>8].tmp = 0;
|
parts[r].tmp = 0;
|
||||||
parts[r>>8].life = 0;
|
parts[r].life = 0;
|
||||||
}
|
}
|
||||||
else if ((r&0xFF)==PT_FILT)
|
else if (rt==PT_FILT)
|
||||||
{
|
{
|
||||||
isBlackDeco = (parts[r>>8].dcolour==0xFF000000);
|
isBlackDeco = (parts[r].dcolour==0xFF000000);
|
||||||
parts[r>>8].life = 2;
|
parts[r].life = 2;
|
||||||
}
|
}
|
||||||
docontinue = 1;
|
docontinue = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,12 +46,13 @@ Element_BIZR::Element_BIZR()
|
|||||||
Graphics = &Element_BIZR::graphics;
|
Graphics = &Element_BIZR::graphics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BLEND 0.95f
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_BIZR static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_BIZR static int update(UPDATE_FUNC_ARGS)
|
||||||
int Element_BIZR::update(UPDATE_FUNC_ARGS)
|
int Element_BIZR::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, rx, ry, nr, ng, nb, na;
|
int r, rx, ry, nr, ng, nb, na;
|
||||||
float tr, tg, tb, ta, mr, mg, mb, ma;
|
float tr, tg, tb, ta, mr, mg, mb, ma;
|
||||||
float blend;
|
|
||||||
if(parts[i].dcolour){
|
if(parts[i].dcolour){
|
||||||
for (rx=-2; rx<3; rx++)
|
for (rx=-2; rx<3; rx++)
|
||||||
for (ry=-2; ry<3; ry++)
|
for (ry=-2; ry<3; ry++)
|
||||||
@ -62,7 +63,6 @@ int Element_BIZR::update(UPDATE_FUNC_ARGS)
|
|||||||
continue;
|
continue;
|
||||||
if ((r&0xFF)!=PT_BIZR && (r&0xFF)!=PT_BIZRG && (r&0xFF)!=PT_BIZRS)
|
if ((r&0xFF)!=PT_BIZR && (r&0xFF)!=PT_BIZRG && (r&0xFF)!=PT_BIZRS)
|
||||||
{
|
{
|
||||||
blend = 0.95f;
|
|
||||||
tr = (parts[r>>8].dcolour>>16)&0xFF;
|
tr = (parts[r>>8].dcolour>>16)&0xFF;
|
||||||
tg = (parts[r>>8].dcolour>>8)&0xFF;
|
tg = (parts[r>>8].dcolour>>8)&0xFF;
|
||||||
tb = (parts[r>>8].dcolour)&0xFF;
|
tb = (parts[r>>8].dcolour)&0xFF;
|
||||||
@ -73,10 +73,10 @@ int Element_BIZR::update(UPDATE_FUNC_ARGS)
|
|||||||
mb = (parts[i].dcolour)&0xFF;
|
mb = (parts[i].dcolour)&0xFF;
|
||||||
ma = (parts[i].dcolour>>24)&0xFF;
|
ma = (parts[i].dcolour>>24)&0xFF;
|
||||||
|
|
||||||
nr = (tr*blend) + (mr*(1-blend));
|
nr = (tr*BLEND) + (mr*(1 - BLEND));
|
||||||
ng = (tg*blend) + (mg*(1-blend));
|
ng = (tg*BLEND) + (mg*(1 - BLEND));
|
||||||
nb = (tb*blend) + (mb*(1-blend));
|
nb = (tb*BLEND) + (mb*(1 - BLEND));
|
||||||
na = (ta*blend) + (ma*(1-blend));
|
na = (ta*BLEND) + (ma*(1 - BLEND));
|
||||||
|
|
||||||
parts[r>>8].dcolour = nr<<16 | ng<<8 | nb | na<<24;
|
parts[r>>8].dcolour = nr<<16 | ng<<8 | nb | na<<24;
|
||||||
}
|
}
|
||||||
@ -91,6 +91,7 @@ int Element_BIZR::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
//BIZR, BIZRG, BIZRS
|
//BIZR, BIZRG, BIZRS
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
float brightness = fabs(cpart->vx) + fabs(cpart->vy);
|
||||||
if (cpart->ctype&0x3FFFFFFF)
|
if (cpart->ctype&0x3FFFFFFF)
|
||||||
{
|
{
|
||||||
*colg = 0;
|
*colg = 0;
|
||||||
@ -102,17 +103,19 @@ int Element_BIZR::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
for (x=0; x<12; x++)
|
for (x=0; x<12; x++)
|
||||||
*colg += (cpart->ctype >> (x+9)) & 1;
|
*colg += (cpart->ctype >> (x+9)) & 1;
|
||||||
x = *colr+*colg+*colb+1;
|
x = 624 / (*colr + *colg + *colb + 1);
|
||||||
*colr = *colr*624/x;
|
*colr *= x;
|
||||||
*colg = *colg*624/x;
|
*colg *= x;
|
||||||
*colb = *colb*624/x;
|
*colb *= x;
|
||||||
}
|
}
|
||||||
if(fabs(cpart->vx)+fabs(cpart->vy)>0)
|
|
||||||
|
if(brightness>0)
|
||||||
{
|
{
|
||||||
|
brightness /= 5;
|
||||||
*firea = 255;
|
*firea = 255;
|
||||||
*fireg = *colg/5 * (fabs(cpart->vx)+fabs(cpart->vy));
|
*fireg = *colg * brightness;
|
||||||
*fireb = *colb/5 * (fabs(cpart->vx)+fabs(cpart->vy));
|
*fireb = *colb * brightness;
|
||||||
*firer = *colr/5 * (fabs(cpart->vx)+fabs(cpart->vy));
|
*firer = *colr * brightness;
|
||||||
*pixel_mode |= FIRE_ADD;
|
*pixel_mode |= FIRE_ADD;
|
||||||
}
|
}
|
||||||
*pixel_mode |= PMODE_BLUR;
|
*pixel_mode |= PMODE_BLUR;
|
||||||
|
@ -50,24 +50,19 @@ Element_BOYL::Element_BOYL()
|
|||||||
int Element_BOYL::update(UPDATE_FUNC_ARGS)
|
int Element_BOYL::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
if (sim->pv[y/CELL][x/CELL]<(parts[i].temp/100))
|
float limit = parts[i].temp / 100;
|
||||||
sim->pv[y/CELL][x/CELL] += 0.001f*((parts[i].temp/100)-sim->pv[y/CELL][x/CELL]);
|
if (sim->pv[y / CELL][x / CELL] < limit)
|
||||||
if (y+CELL<YRES && sim->pv[y/CELL+1][x/CELL]<(parts[i].temp/100))
|
sim->pv[y / CELL][x / CELL] += 0.001f*(limit - sim->pv[y / CELL][x / CELL]);
|
||||||
sim->pv[y/CELL+1][x/CELL] += 0.001f*((parts[i].temp/100)-sim->pv[y/CELL+1][x/CELL]);
|
if (sim->pv[y / CELL + 1][x / CELL] < limit)
|
||||||
if (x+CELL<XRES)
|
sim->pv[y / CELL + 1][x / CELL] += 0.001f*(limit - sim->pv[y / CELL + 1][x / CELL]);
|
||||||
{
|
if (sim->pv[y / CELL - 1][x / CELL] < limit)
|
||||||
sim->pv[y/CELL][x/CELL+1] += 0.001f*((parts[i].temp/100)-sim->pv[y/CELL][x/CELL+1]);
|
sim->pv[y / CELL - 1][x / CELL] += 0.001f*(limit - sim->pv[y / CELL - 1][x / CELL]);
|
||||||
if (y+CELL<YRES)
|
|
||||||
sim->pv[y/CELL+1][x/CELL+1] += 0.001f*((parts[i].temp/100)-sim->pv[y/CELL+1][x/CELL+1]);
|
sim->pv[y / CELL][x / CELL + 1] += 0.001f*(limit - sim->pv[y / CELL][x / CELL + 1]);
|
||||||
}
|
sim->pv[y / CELL + 1][x / CELL + 1] += 0.001f*(limit - sim->pv[y / CELL + 1][x / CELL + 1]);
|
||||||
if (y-CELL>=0 && sim->pv[y/CELL-1][x/CELL]<(parts[i].temp/100))
|
sim->pv[y / CELL][x / CELL - 1] += 0.001f*(limit - sim->pv[y / CELL][x / CELL - 1]);
|
||||||
sim->pv[y/CELL-1][x/CELL] += 0.001f*((parts[i].temp/100)-sim->pv[y/CELL-1][x/CELL]);
|
sim->pv[y / CELL - 1][x / CELL - 1] += 0.001f*(limit - sim->pv[y / CELL - 1][x / CELL - 1]);
|
||||||
if (x-CELL>=0)
|
|
||||||
{
|
|
||||||
sim->pv[y/CELL][x/CELL-1] += 0.001f*((parts[i].temp/100)-sim->pv[y/CELL][x/CELL-1]);
|
|
||||||
if (y-CELL>=0)
|
|
||||||
sim->pv[y/CELL-1][x/CELL-1] += 0.001f*((parts[i].temp/100)-sim->pv[y/CELL-1][x/CELL-1]);
|
|
||||||
}
|
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
if (BOUNDS_CHECK && (rx || ry))
|
if (BOUNDS_CHECK && (rx || ry))
|
||||||
|
@ -70,7 +70,7 @@ int Element_BREC::update(UPDATE_FUNC_ARGS)
|
|||||||
int r = pmap[y+ry][x+rx];
|
int r = pmap[y+ry][x+rx];
|
||||||
if (!r)
|
if (!r)
|
||||||
continue;
|
continue;
|
||||||
if (parts[r>>8].type == PT_LAVA && parts[r>>8].ctype == PT_CLST)
|
if ((r&0xFF) == PT_LAVA && parts[r>>8].ctype == PT_CLST)
|
||||||
{
|
{
|
||||||
float pres = std::max(sim->pv[y/CELL][x/CELL]*10.0f, 0.0f);
|
float pres = std::max(sim->pv[y/CELL][x/CELL]*10.0f, 0.0f);
|
||||||
if (parts[r>>8].temp >= pres+sim->elements[PT_CRMC].HighTemperature+50.0f)
|
if (parts[r>>8].temp >= pres+sim->elements[PT_CRMC].HighTemperature+50.0f)
|
||||||
|
@ -52,13 +52,7 @@ int Element_CBNW::update(UPDATE_FUNC_ARGS)
|
|||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
if (sim->pv[y/CELL][x/CELL]<=3)
|
if (sim->pv[y/CELL][x/CELL]<=3)
|
||||||
{
|
{
|
||||||
if(sim->pv[y/CELL][x/CELL]<=-0.5)
|
if (sim->pv[y/CELL][x/CELL] <= -0.5 || !(rand()%4000))
|
||||||
{
|
|
||||||
sim->part_change_type(i,x,y,PT_CO2);
|
|
||||||
parts[i].ctype = 5;
|
|
||||||
sim->pv[y/CELL][x/CELL] += 0.5f;
|
|
||||||
}
|
|
||||||
else if(!(rand()%4000))
|
|
||||||
{
|
{
|
||||||
sim->part_change_type(i,x,y,PT_CO2);
|
sim->part_change_type(i,x,y,PT_CO2);
|
||||||
parts[i].ctype = 5;
|
parts[i].ctype = 5;
|
||||||
|
@ -93,10 +93,10 @@ int Element_CLST::update(UPDATE_FUNC_ARGS)
|
|||||||
int Element_CLST::graphics(GRAPHICS_FUNC_ARGS)
|
int Element_CLST::graphics(GRAPHICS_FUNC_ARGS)
|
||||||
|
|
||||||
{
|
{
|
||||||
int z = cpart->tmp - 5;//speckles!
|
int z =( cpart->tmp - 5) * 16;//speckles!
|
||||||
*colr += z * 16;
|
*colr += z;
|
||||||
*colg += z * 16;
|
*colg += z;
|
||||||
*colb += z * 16;
|
*colb += z;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ Element_COAL::Element_COAL()
|
|||||||
//#TPT-Directive ElementHeader Element_COAL static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_COAL static int update(UPDATE_FUNC_ARGS)
|
||||||
int Element_COAL::update(UPDATE_FUNC_ARGS)
|
int Element_COAL::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int t = parts[i].type;
|
|
||||||
if (parts[i].life<=0) {
|
if (parts[i].life<=0) {
|
||||||
sim->create_part(i, x, y, PT_FIRE);
|
sim->create_part(i, x, y, PT_FIRE);
|
||||||
return 1;
|
return 1;
|
||||||
@ -57,7 +56,7 @@ int Element_COAL::update(UPDATE_FUNC_ARGS)
|
|||||||
parts[i].life--;
|
parts[i].life--;
|
||||||
sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
|
sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
|
||||||
}
|
}
|
||||||
if (t == PT_COAL)
|
if (parts[i].type == PT_COAL)
|
||||||
{
|
{
|
||||||
if ((sim->pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40)
|
if ((sim->pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40)
|
||||||
parts[i].tmp=39;
|
parts[i].tmp=39;
|
||||||
@ -73,6 +72,7 @@ int Element_COAL::update(UPDATE_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FREQUENCY 3.1415/(2*300.0f-(300.0f-200.0f))
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_COAL static int graphics(GRAPHICS_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_COAL static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
int Element_COAL::graphics(GRAPHICS_FUNC_ARGS)
|
int Element_COAL::graphics(GRAPHICS_FUNC_ARGS)
|
||||||
@ -87,14 +87,15 @@ int Element_COAL::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
|
|
||||||
*colg = *colb = *colr;
|
*colg = *colb = *colr;
|
||||||
|
|
||||||
if((cpart->temp-295.15f) > 300.0f-200.0f)
|
// ((cpart->temp-295.15f) > 300.0f-200.0f)
|
||||||
|
if (cpart->temp > 395.15f)
|
||||||
{
|
{
|
||||||
float frequency = 3.1415/(2*300.0f-(300.0f-200.0f));
|
// q = ((cpart->temp-295.15f)>300.0f)?300.0f-(300.0f-200.0f):(cpart->temp-295.15f)-(300.0f-200.0f);
|
||||||
int q = ((cpart->temp-295.15f)>300.0f)?300.0f-(300.0f-200.0f):(cpart->temp-295.15f)-(300.0f-200.0f);
|
int q = (cpart->temp > 595.15f) ? 200.0f : cpart->temp - 395.15f;
|
||||||
|
|
||||||
*colr += sin(frequency*q) * 226;
|
*colr += sin(FREQUENCY*q) * 226;
|
||||||
*colg += sin(frequency*q*4.55 +3.14) * 34;
|
*colg += sin(FREQUENCY*q*4.55 + 3.14) * 34;
|
||||||
*colb += sin(frequency*q*2.22 +3.14) * 64;
|
*colb += sin(FREQUENCY*q*2.22 + 3.14) * 64;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,10 @@ int Element_CRMC::update(UPDATE_FUNC_ARGS)
|
|||||||
//#TPT-Directive ElementHeader Element_CRMC static int graphics(GRAPHICS_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_CRMC static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
int Element_CRMC::graphics(GRAPHICS_FUNC_ARGS)
|
int Element_CRMC::graphics(GRAPHICS_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int z = cpart->tmp2 - 2;
|
int z = (cpart->tmp2 - 2) * 8;
|
||||||
*colr += z * 8;
|
*colr += z;
|
||||||
*colg += z * 8;
|
*colg += z;
|
||||||
*colb += z * 8;
|
*colb += z;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,15 +50,10 @@ Element_DCEL::Element_DCEL()
|
|||||||
int Element_DCEL::update(UPDATE_FUNC_ARGS)
|
int Element_DCEL::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
float multiplier;
|
float multiplier = 1.0f/1.1f;
|
||||||
if (parts[i].life!=0)
|
if (parts[i].life!=0)
|
||||||
{
|
{
|
||||||
float change = parts[i].life > 100 ? 100 : (parts[i].life < 0 ? 0 : parts[i].life);
|
multiplier = 1.0f - ((parts[i].life > 100 ? 100 : (parts[i].life < 0 ? 0 : parts[i].life)) / 100.0f);
|
||||||
multiplier = 1.0f-(change/100.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
multiplier = 1.0f/1.1f;
|
|
||||||
}
|
}
|
||||||
parts[i].tmp = 0;
|
parts[i].tmp = 0;
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
|
@ -52,7 +52,7 @@ int Element_DEUT::update(UPDATE_FUNC_ARGS)
|
|||||||
int r, rx, ry, trade, np;
|
int r, rx, ry, trade, np;
|
||||||
float gravtot = fabs(sim->gravy[(y/CELL)*(XRES/CELL)+(x/CELL)])+fabs(sim->gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]);
|
float gravtot = fabs(sim->gravy[(y/CELL)*(XRES/CELL)+(x/CELL)])+fabs(sim->gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]);
|
||||||
int maxlife = ((10000/(parts[i].temp + 1))-1);
|
int maxlife = ((10000/(parts[i].temp + 1))-1);
|
||||||
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
|
if (!(rand()%((int)parts[i].temp+1)))
|
||||||
maxlife ++;
|
maxlife ++;
|
||||||
// Compress when Newtonian gravity is applied
|
// Compress when Newtonian gravity is applied
|
||||||
// multiplier=1 when gravtot=0, multiplier -> 5 as gravtot -> inf
|
// multiplier=1 when gravtot=0, multiplier -> 5 as gravtot -> inf
|
||||||
@ -83,9 +83,10 @@ int Element_DEUT::update(UPDATE_FUNC_ARGS)
|
|||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
if (BOUNDS_CHECK && (rx || ry))
|
if (BOUNDS_CHECK && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
//Leave if there is nothing to do
|
||||||
if (parts[i].life <= maxlife)
|
if (parts[i].life <= maxlife)
|
||||||
continue;
|
goto trade;
|
||||||
|
r = pmap[y+ry][x+rx];
|
||||||
if ((!r)&&parts[i].life>=1)//if nothing then create deut
|
if ((!r)&&parts[i].life>=1)//if nothing then create deut
|
||||||
{
|
{
|
||||||
np = sim->create_part(-1,x+rx,y+ry,PT_DEUT);
|
np = sim->create_part(-1,x+rx,y+ry,PT_DEUT);
|
||||||
@ -95,6 +96,7 @@ int Element_DEUT::update(UPDATE_FUNC_ARGS)
|
|||||||
parts[np].life = 0;
|
parts[np].life = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
trade:
|
||||||
for ( trade = 0; trade<4; trade ++)
|
for ( trade = 0; trade<4; trade ++)
|
||||||
{
|
{
|
||||||
rx = rand()%5-2;
|
rx = rand()%5-2;
|
||||||
|
@ -173,14 +173,6 @@ int Element_EMP::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
*colr = cpart->life*1.5;
|
*colr = cpart->life*1.5;
|
||||||
*colg = cpart->life*1.5;
|
*colg = cpart->life*1.5;
|
||||||
*colb = 200-(cpart->life);
|
*colb = 200-(cpart->life);
|
||||||
if (*colr>255)
|
|
||||||
*colr = 255;
|
|
||||||
if (*colg>255)
|
|
||||||
*colg = 255;
|
|
||||||
if (*colb>255)
|
|
||||||
*colb = 255;
|
|
||||||
if (*colb<=0)
|
|
||||||
*colb = 0;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -150,10 +150,10 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS)
|
|||||||
int Element_QRTZ::graphics(GRAPHICS_FUNC_ARGS)
|
int Element_QRTZ::graphics(GRAPHICS_FUNC_ARGS)
|
||||||
//QRTZ and PQRT
|
//QRTZ and PQRT
|
||||||
{
|
{
|
||||||
int z = cpart->tmp2 - 5;//speckles!
|
int z = (cpart->tmp2 - 5) * 16;//speckles!
|
||||||
*colr += z * 16;
|
*colr += z;
|
||||||
*colg += z * 16;
|
*colg += z;
|
||||||
*colb += z * 16;
|
*colb += z;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ void Element_SOAP::attach(Particle * parts, int i1, int i2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define FREEZING 248.15f
|
#define FREEZING 248.15f
|
||||||
|
#define BLEND 0.85f
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_SOAP static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_SOAP static int update(UPDATE_FUNC_ARGS)
|
||||||
int Element_SOAP::update(UPDATE_FUNC_ARGS)
|
int Element_SOAP::update(UPDATE_FUNC_ARGS)
|
||||||
@ -94,7 +95,6 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
|
|||||||
{
|
{
|
||||||
int r, rx, ry, nr, ng, nb, na;
|
int r, rx, ry, nr, ng, nb, na;
|
||||||
float tr, tg, tb, ta;
|
float tr, tg, tb, ta;
|
||||||
float blend;
|
|
||||||
|
|
||||||
//0x01 - bubble on/off
|
//0x01 - bubble on/off
|
||||||
//0x02 - first mate yes/no
|
//0x02 - first mate yes/no
|
||||||
@ -258,15 +258,14 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
|
|||||||
continue;
|
continue;
|
||||||
if ((r&0xFF)!=PT_SOAP)
|
if ((r&0xFF)!=PT_SOAP)
|
||||||
{
|
{
|
||||||
blend = 0.85f;
|
|
||||||
tr = (parts[r>>8].dcolour>>16)&0xFF;
|
tr = (parts[r>>8].dcolour>>16)&0xFF;
|
||||||
tg = (parts[r>>8].dcolour>>8)&0xFF;
|
tg = (parts[r>>8].dcolour>>8)&0xFF;
|
||||||
tb = (parts[r>>8].dcolour)&0xFF;
|
tb = (parts[r>>8].dcolour)&0xFF;
|
||||||
ta = (parts[r>>8].dcolour>>24)&0xFF;
|
ta = (parts[r>>8].dcolour>>24)&0xFF;
|
||||||
nr = (tr*blend);
|
nr = (tr*BLEND);
|
||||||
ng = (tg*blend);
|
ng = (tg*BLEND);
|
||||||
nb = (tb*blend);
|
nb = (tb*BLEND);
|
||||||
na = (ta*blend);
|
na = (ta*BLEND);
|
||||||
parts[r>>8].dcolour = nr<<16 | ng<<8 | nb | na<<24;
|
parts[r>>8].dcolour = nr<<16 | ng<<8 | nb | na<<24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user