summaryrefslogtreecommitdiff
path: root/src/simulation/elements/PQRT.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-05-20 15:26:51 (GMT)
committer jacob1 <jfu614@gmail.com>2013-05-20 15:26:51 (GMT)
commit826b966668fe37d836de91cf29a6db0d1afee1f4 (patch)
treef617c944418a227769408b75b075d334df93417c /src/simulation/elements/PQRT.cpp
parent77bf649fb4482c86ac1fd9b3233f062b53226007 (diff)
downloadpowder-826b966668fe37d836de91cf29a6db0d1afee1f4.zip
powder-826b966668fe37d836de91cf29a6db0d1afee1f4.tar.gz
reduce rand() chances to 5x the old values in elements that were changed to 3x3 loop checks instead of 5x5. Also some other fixes I found when looking at what had been changed.
Diffstat (limited to 'src/simulation/elements/PQRT.cpp')
-rw-r--r--src/simulation/elements/PQRT.cpp111
1 files changed, 3 insertions, 108 deletions
diff --git a/src/simulation/elements/PQRT.cpp b/src/simulation/elements/PQRT.cpp
index 665f5a4..5510c7a 100644
--- a/src/simulation/elements/PQRT.cpp
+++ b/src/simulation/elements/PQRT.cpp
@@ -26,7 +26,7 @@ Element_PQRT::Element_PQRT()
Weight = 90;
- Temperature = R_TEMP+0.0f +273.15f;
+ Temperature = R_TEMP+273.15f;
HeatConduct = 3;
Description = "Powdered quartz, broken form of QRTZ.";
@@ -42,113 +42,8 @@ Element_PQRT::Element_PQRT()
HighTemperature = 2573.15f;
HighTemperatureTransition = PT_LAVA;
- Update = &Element_PQRT::update;
- Graphics = &Element_PQRT::graphics;
+ Update = &Element_QRTZ::update;
+ Graphics = &Element_QRTZ::graphics;
}
-//#TPT-Directive ElementHeader Element_PQRT static int update(UPDATE_FUNC_ARGS)
-int Element_PQRT::update(UPDATE_FUNC_ARGS)
-{
- int r, tmp, trade, rx, ry, np;
- // absorb SLTW
- if (parts[i].ctype!=-1)
- for (rx=-1; rx<2; rx++)
- for (ry=-1; ry<2; ry++)
- if (BOUNDS_CHECK && (rx || ry))
- {
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- else if ((r&0xFF)==PT_SLTW && !(rand()%833))
- {
- sim->kill_part(r>>8);
- parts[i].ctype ++;
- }
- }
- // grow and diffuse
- if (parts[i].ctype>0)
- {
- bool stopgrow=false;
- int rnd, sry, srx;
- for ( trade = 0; trade<9; trade ++)
- {
- rnd = rand()%0x3FF;
- rx = (rnd%5)-2;
- srx = (rnd%3)-1;
- rnd = rnd>>3;
- ry = (rnd%5)-2;
- sry = (rnd%3)-1;
- if (BOUNDS_CHECK && (rx || ry))
- {
- if (!stopgrow)//try to grow
- {
- if (!pmap[y+sry][x+srx] && parts[i].ctype!=0)
- {
- np = sim->create_part(-1,x+srx,y+sry,PT_QRTZ);
- if (np>-1)
- {
- parts[np].tmp = parts[i].tmp;
- parts[i].ctype--;
- if (rand()%2)
- {
- parts[np].ctype=-1;//dead qrtz
- }
- else if (!parts[i].ctype && !(rand()%15))
- {
- parts[i].ctype=-1;
- }
- stopgrow=true;
- }
- }
- }
- //diffusion
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- else if ((r&0xFF)==PT_PQRT && (parts[i].ctype>parts[r>>8].ctype) && parts[r>>8].ctype>=0 )
- {
- tmp = parts[i].ctype - parts[r>>8].ctype;
- if (tmp ==1)
- {
- parts[r>>8].ctype ++;
- parts[i].ctype --;
- break;
- }
- if (tmp>0)
- {
- parts[r>>8].ctype += tmp/2;
- parts[i].ctype -= tmp/2;
- break;
- }
- }
- }
- }
- }
- return 0;
-}
-
-
-//#TPT-Directive ElementHeader Element_PQRT static int graphics(GRAPHICS_FUNC_ARGS)
-int Element_PQRT::graphics(GRAPHICS_FUNC_ARGS)
- //QRTZ and PQRT
-{
- int t = cpart->type, z = cpart->tmp - 5;//speckles!
- /*if (cpart->temp>(ptransitions[t].thv-800.0f))//hotglow for quartz
- {
- float frequency = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
- int q = (cpart->temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):cpart->temp-(ptransitions[t].thv-800.0f);
- *colr += sin(frequency*q) * 226 + (z * 16);
- *colg += sin(frequency*q*4.55 +3.14) * 34 + (z * 16);
- *colb += sin(frequency*q*2.22 +3.14) * 64 + (z * 16);
- }
- else*/
- {
- *colr += z * 16;
- *colg += z * 16;
- *colb += z * 16;
- }
- return 0;
-}
-
-
Element_PQRT::~Element_PQRT() {}