rename TUGN to TUNG (more popular spelling). Broken BRMT smelts back into TUGN

This commit is contained in:
jacob1 2013-05-13 21:10:45 -04:00
parent 8aa9f96843
commit 7856f727a5
6 changed files with 117 additions and 75 deletions

View File

@ -740,7 +740,7 @@ void GameController::ResetAir()
sim->air->Clear(); sim->air->Clear();
for (int i = 0; i < NPART; i++) for (int i = 0; i < NPART; i++)
{ {
if (sim->parts[i].type == PT_QRTZ || sim->parts[i].type == PT_GLAS || sim->parts[i].type == PT_TUGN) if (sim->parts[i].type == PT_QRTZ || sim->parts[i].type == PT_GLAS || sim->parts[i].type == PT_TUNG)
{ {
sim->parts[i].pavg[0] = sim->parts[i].pavg[1] = 0; sim->parts[i].pavg[0] = sim->parts[i].pavg[1] = 0;
} }

View File

@ -2917,7 +2917,7 @@ int Simulation::create_part(int p, int x, int y, int tv)
parts[i].dcolour = 0; parts[i].dcolour = 0;
parts[i].flags = 0; parts[i].flags = 0;
if (t == PT_GLAS || t == PT_QRTZ || t == PT_TUGN) if (t == PT_GLAS || t == PT_QRTZ || t == PT_TUNG)
{ {
parts[i].pavg[1] = pv[y/CELL][x/CELL]; parts[i].pavg[1] = pv[y/CELL][x/CELL];
} }
@ -3793,7 +3793,7 @@ void Simulation::update_particles_i(int start, int inc)
if (elements[t].Diffusion)//the random diffusion that gasses have if (elements[t].Diffusion)//the random diffusion that gasses have
{ {
#ifdef REALISTIC #ifdef REALISTIC
//The magic number controlls diffusion speed //The magic number controls diffusion speed
parts[i].vx += 0.05*sqrtf(parts[i].temp)*elements[t].Diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); parts[i].vx += 0.05*sqrtf(parts[i].temp)*elements[t].Diffusion*(rand()/(0.5f*RAND_MAX)-1.0f);
parts[i].vy += 0.05*sqrtf(parts[i].temp)*elements[t].Diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); parts[i].vy += 0.05*sqrtf(parts[i].temp)*elements[t].Diffusion*(rand()/(0.5f*RAND_MAX)-1.0f);
#else #else
@ -3836,13 +3836,11 @@ void Simulation::update_particles_i(int start, int inc)
h_count = 0; h_count = 0;
#ifdef REALISTIC #ifdef REALISTIC
if (t&&(t!=PT_HSWC||parts[i].life==10)&&(elements[t].HeatConduct*gel_scale)) if (t&&(t!=PT_HSWC||parts[i].life==10)&&(elements[t].HeatConduct*gel_scale))
{
float c_Cm = 0.0f;
#else #else
if (t&&(t!=PT_HSWC||parts[i].life==10)&&(elements[t].HeatConduct*gel_scale)>(rand()%250)) if (t&&(t!=PT_HSWC||parts[i].life==10)&&(elements[t].HeatConduct*gel_scale)>(rand()%250))
#endif
{ {
float c_Cm = 0.0f; float c_Cm = 0.0f;
#endif
if (aheat_enable && !(elements[t].Properties&PROP_NOAMBHEAT)) if (aheat_enable && !(elements[t].Properties&PROP_NOAMBHEAT))
{ {
#ifdef REALISTIC #ifdef REALISTIC
@ -3926,7 +3924,8 @@ void Simulation::update_particles_i(int start, int inc)
if ((t==PT_ICEI || t==PT_SNOW) && (parts[i].ctype==0 || parts[i].ctype>=PT_NUM || parts[i].ctype==PT_ICEI || parts[i].ctype==PT_SNOW)) if ((t==PT_ICEI || t==PT_SNOW) && (parts[i].ctype==0 || parts[i].ctype>=PT_NUM || parts[i].ctype==PT_ICEI || parts[i].ctype==PT_SNOW))
parts[i].ctype = PT_WATR; parts[i].ctype = PT_WATR;
if (ctemph>elements[t].HighTemperature&&elements[t].HighTemperatureTransition>-1) { if (ctemph>elements[t].HighTemperature && elements[t].HighTemperatureTransition>-1)
{
// particle type change due to high temperature // particle type change due to high temperature
#ifdef REALISTIC #ifdef REALISTIC
float dbt = ctempl - pt; float dbt = ctempl - pt;
@ -3947,10 +3946,14 @@ void Simulation::update_particles_i(int start, int inc)
if (elements[t].HighTemperatureTransition != PT_NUM) if (elements[t].HighTemperatureTransition != PT_NUM)
t = elements[t].HighTemperatureTransition; t = elements[t].HighTemperatureTransition;
#endif #endif
else if (t==PT_ICEI || t==PT_SNOW) { else if (t == PT_ICEI || t == PT_SNOW)
if (parts[i].ctype<PT_NUM&&parts[i].ctype!=t) { {
if (elements[parts[i].ctype].LowTemperatureTransition==t&&pt<=elements[parts[i].ctype].LowTemperature) s = 0; if (parts[i].ctype < PT_NUM && parts[i].ctype != t)
else { {
if (elements[parts[i].ctype].LowTemperatureTransition==t && pt<=elements[parts[i].ctype].LowTemperature)
s = 0;
else
{
#ifdef REALISTIC #ifdef REALISTIC
//One ice table value for all it's kinds //One ice table value for all it's kinds
if (platent[t] <= (c_heat - (elements[parts[i].ctype].LowTemperature - dbt)*c_Cm)) if (platent[t] <= (c_heat - (elements[parts[i].ctype].LowTemperature - dbt)*c_Cm))
@ -3972,9 +3975,11 @@ void Simulation::update_particles_i(int start, int inc)
#endif #endif
} }
} }
else s = 0; else
s = 0;
} }
else if (t==PT_SLTW) { else if (t == PT_SLTW)
{
#ifdef REALISTIC #ifdef REALISTIC
if (platent[t] <= (c_heat - (elements[t].HighTemperature - dbt)*c_Cm)) if (platent[t] <= (c_heat - (elements[t].HighTemperature - dbt)*c_Cm))
{ {
@ -3989,12 +3994,27 @@ void Simulation::update_particles_i(int start, int inc)
s = 0; s = 0;
} }
#else #else
if (rand()%4==0) t = PT_SALT; if (rand()%4 == 0)
else t = PT_WTRV; t = PT_SALT;
else
t = PT_WTRV;
#endif #endif
} }
else s = 0; else if (t == PT_BRMT)
} else if (ctempl<elements[t].LowTemperature&&elements[t].LowTemperatureTransition>-1) { {
if (parts[i].ctype == PT_TUNG && ctemph <= 3695.0)
s = 0;
else
{
t = PT_LAVA;
parts[i].type = PT_TUNG;
}
}
else
s = 0;
}
else if (ctempl<elements[t].LowTemperature && elements[t].LowTemperatureTransition > -1)
{
// particle type change due to low temperature // particle type change due to low temperature
#ifdef REALISTIC #ifdef REALISTIC
float dbt = ctempl - pt; float dbt = ctempl - pt;
@ -4015,25 +4035,39 @@ void Simulation::update_particles_i(int start, int inc)
if (elements[t].LowTemperatureTransition != PT_NUM) if (elements[t].LowTemperatureTransition != PT_NUM)
t = elements[t].LowTemperatureTransition; t = elements[t].LowTemperatureTransition;
#endif #endif
else if (t==PT_WTRV) { else if (t == PT_WTRV)
if (pt<273.0f) t = PT_RIME; {
else t = PT_DSTW; if (pt < 273.0f)
t = PT_RIME;
else
t = PT_DSTW;
} }
else if (t==PT_LAVA) { else if (t == PT_LAVA)
if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA) { {
if (parts[i].ctype==PT_THRM&&pt>=elements[PT_BMTL].HighTemperature) s = 0; if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA)
else if ((parts[i].ctype==PT_VIBR || parts[i].ctype==PT_BVBR) && pt>=273.15f) s = 0; {
else if (parts[i].ctype==PT_TUGN) { if (parts[i].ctype==PT_THRM&&pt>=elements[PT_BMTL].HighTemperature)
if (pt>3695.0) s = 0; s = 0;
else if ((parts[i].ctype==PT_VIBR || parts[i].ctype==PT_BVBR) && pt>=273.15f)
s = 0;
else if (parts[i].ctype==PT_TUNG)
{
if (pt>3695.0)
s = 0;
} }
else if (elements[parts[i].ctype].HighTemperatureTransition==PT_LAVA) { else if (elements[parts[i].ctype].HighTemperatureTransition == PT_LAVA)
if (pt>=elements[parts[i].ctype].HighTemperature) s = 0; {
if (pt >= elements[parts[i].ctype].HighTemperature)
s = 0;
} }
else if (pt>=973.0f) s = 0; // freezing point for lava with any other (not listed in ptransitions as turning into lava) ctype else if (pt>=973.0f)
if (s) { s = 0; // freezing point for lava with any other (not listed in ptransitions as turning into lava) ctype
if (s)
{
t = parts[i].ctype; t = parts[i].ctype;
parts[i].ctype = PT_NONE; parts[i].ctype = PT_NONE;
if (t==PT_THRM) { if (t == PT_THRM)
{
parts[i].tmp = 0; parts[i].tmp = 0;
t = PT_BMTL; t = PT_BMTL;
} }
@ -4044,12 +4078,16 @@ void Simulation::update_particles_i(int start, int inc)
} }
} }
} }
else if (pt<973.0f) t = PT_STNE; else if (pt<973.0f)
else s = 0; t = PT_STNE;
else
s = 0;
} }
else s = 0; else
s = 0;
} }
else s = 0; else
s = 0;
#ifdef REALISTIC #ifdef REALISTIC
pt = restrict_flt(pt, MIN_TEMP, MAX_TEMP); pt = restrict_flt(pt, MIN_TEMP, MAX_TEMP);
for (j=0; j<8; j++) for (j=0; j<8; j++)
@ -4057,30 +4095,37 @@ void Simulation::update_particles_i(int start, int inc)
parts[surround_hconduct[j]].temp = pt; parts[surround_hconduct[j]].temp = pt;
} }
#endif #endif
if (s) { // particle type change occurred if (s) // particle type change occurred
{
if (t==PT_ICEI || t==PT_LAVA || t==PT_SNOW) if (t==PT_ICEI || t==PT_LAVA || t==PT_SNOW)
parts[i].ctype = parts[i].type; parts[i].ctype = parts[i].type;
if (!(t==PT_ICEI&&parts[i].ctype==PT_FRZW)) parts[i].life = 0; if (!(t==PT_ICEI && parts[i].ctype==PT_FRZW))
parts[i].life = 0;
if (elements[t].State==ST_GAS && elements[parts[i].type].State!=ST_GAS) if (elements[t].State==ST_GAS && elements[parts[i].type].State!=ST_GAS)
pv[y/CELL][x/CELL] += 0.50f; pv[y/CELL][x/CELL] += 0.50f;
part_change_type(i,x,y,t); part_change_type(i,x,y,t);
if (t==PT_FIRE || t==PT_PLSM || t==PT_CFLM) if (t==PT_FIRE || t==PT_PLSM || t==PT_CFLM)
parts[i].life = rand()%50+120; parts[i].life = rand()%50+120;
if (t==PT_LAVA) { if (t == PT_LAVA)
{
if (parts[i].ctype == PT_BRMT) parts[i].ctype = PT_BMTL; if (parts[i].ctype == PT_BRMT) parts[i].ctype = PT_BMTL;
else if (parts[i].ctype == PT_SAND) parts[i].ctype = PT_GLAS; else if (parts[i].ctype == PT_SAND) parts[i].ctype = PT_GLAS;
else if (parts[i].ctype == PT_BGLA) parts[i].ctype = PT_GLAS; else if (parts[i].ctype == PT_BGLA) parts[i].ctype = PT_GLAS;
else if (parts[i].ctype == PT_PQRT) parts[i].ctype = PT_QRTZ; else if (parts[i].ctype == PT_PQRT) parts[i].ctype = PT_QRTZ;
parts[i].life = rand()%120+240; parts[i].life = rand()%120+240;
} }
if (t==PT_NONE) { if (t == PT_NONE)
{
kill_part(i); kill_part(i);
goto killed; goto killed;
} }
} }
pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP);
if (t==PT_LAVA) { if (t == PT_LAVA)
{
parts[i].life = restrict_flt((parts[i].temp-700)/7, 0.0f, 400.0f); parts[i].life = restrict_flt((parts[i].temp-700)/7, 0.0f, 400.0f);
if (parts[i].ctype==PT_THRM&&parts[i].tmp>0) if (parts[i].ctype==PT_THRM&&parts[i].tmp>0)
{ {
@ -4093,11 +4138,7 @@ void Simulation::update_particles_i(int start, int inc)
parts[i].temp = MAX_TEMP; parts[i].temp = MAX_TEMP;
} }
} }
#ifdef REALISTIC //needed to fix update_particles_i parsing
} }
#else
}
#endif
else parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); else parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP);
} }

View File

@ -40,7 +40,7 @@ Element_BRMT::Element_BRMT()
LowTemperature = ITL; LowTemperature = ITL;
LowTemperatureTransition = NT; LowTemperatureTransition = NT;
HighTemperature = 1273.0f; HighTemperature = 1273.0f;
HighTemperatureTransition = PT_LAVA; HighTemperatureTransition = ST;
Update = &Element_BRMT::update; Update = &Element_BRMT::update;

View File

@ -92,7 +92,7 @@ int Element_DMG::update(UPDATE_FUNC_ARGS)
sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BCOL); sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BCOL);
else if(t == PT_QRTZ) else if(t == PT_QRTZ)
sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_PQRT); sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_PQRT);
else if(t == PT_TUGN) else if(t == PT_TUNG)
sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BRMT); sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BRMT);
} }
} }

View File

@ -158,7 +158,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
} }
} }
break; break;
case PT_TUGN: case PT_TUNG:
if(parts[i].temp < 3595.0){ if(parts[i].temp < 3595.0){
parts[i].temp += (rand()%20)-4; parts[i].temp += (rand()%20)-4;
} }

View File

@ -1,10 +1,10 @@
#include "simulation/Elements.h" #include "simulation/Elements.h"
#include "simulation/Air.h" #include "simulation/Air.h"
//#TPT-Directive ElementClass Element_TUGN PT_TUGN 171 //#TPT-Directive ElementClass Element_TUNG PT_TUNG 171
Element_TUGN::Element_TUGN() Element_TUNG::Element_TUNG()
{ {
Identifier = "DEFAULT_PT_TUGN"; Identifier = "DEFAULT_PT_TUNG";
Name = "TUGN"; Name = "TUNG";
Colour = PIXPACK(0x505050); Colour = PIXPACK(0x505050);
MenuVisible = 1; MenuVisible = 1;
MenuSection = SC_ELEC; MenuSection = SC_ELEC;
@ -29,7 +29,7 @@ Element_TUGN::Element_TUGN()
Temperature = R_TEMP+0.0f +273.15f; Temperature = R_TEMP+0.0f +273.15f;
HeatConduct = 251; HeatConduct = 251;
Description = "Brittle metal with a very high melting point."; Description = "Tungsten. Brittle metal with a very high melting point.";
State = ST_SOLID; State = ST_SOLID;
Properties = TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC; Properties = TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC;
@ -45,15 +45,15 @@ Element_TUGN::Element_TUGN()
/*HighTemperature = 3895.0f; /*HighTemperature = 3895.0f;
HighTemperatureTransition = PT_LAVA;*/ HighTemperatureTransition = PT_LAVA;*/
Update = &Element_TUGN::update; Update = &Element_TUNG::update;
Graphics = &Element_TUGN::graphics; Graphics = &Element_TUNG::graphics;
} }
#define MELTING_POINT 3695.0 #define MELTING_POINT 3695.0
//#TPT-Directive ElementHeader Element_TUGN static int update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_TUNG static int update(UPDATE_FUNC_ARGS)
int Element_TUGN::update(UPDATE_FUNC_ARGS) int Element_TUNG::update(UPDATE_FUNC_ARGS)
{ {
bool splode = false; bool splode = false;
if(parts[i].temp > 2400.0) if(parts[i].temp > 2400.0)
@ -85,7 +85,7 @@ int Element_TUGN::update(UPDATE_FUNC_ARGS)
else else
{ {
sim->part_change_type(i, x, y, PT_LAVA); sim->part_change_type(i, x, y, PT_LAVA);
parts[i].ctype = PT_TUGN; parts[i].ctype = PT_TUNG;
return 1; return 1;
} }
if(splode) if(splode)
@ -101,13 +101,14 @@ int Element_TUGN::update(UPDATE_FUNC_ARGS)
if (parts[i].pavg[1]-parts[i].pavg[0] > 0.50f || parts[i].pavg[1]-parts[i].pavg[0] < -0.50f) if (parts[i].pavg[1]-parts[i].pavg[0] > 0.50f || parts[i].pavg[1]-parts[i].pavg[0] < -0.50f)
{ {
sim->part_change_type(i,x,y,PT_BRMT); sim->part_change_type(i,x,y,PT_BRMT);
parts[i].ctype = PT_TUNG;
} }
return 0; return 0;
} }
//#TPT-Directive ElementHeader Element_TUGN static int graphics(GRAPHICS_FUNC_ARGS) //#TPT-Directive ElementHeader Element_TUNG static int graphics(GRAPHICS_FUNC_ARGS)
int Element_TUGN::graphics(GRAPHICS_FUNC_ARGS) int Element_TUNG::graphics(GRAPHICS_FUNC_ARGS)
{ {
double startTemp = (MELTING_POINT - 1500.0); double startTemp = (MELTING_POINT - 1500.0);
double tempOver = (((cpart->temp - startTemp)/1500.0)*M_PI) - (M_PI/2.0); double tempOver = (((cpart->temp - startTemp)/1500.0)*M_PI) - (M_PI/2.0);
@ -129,4 +130,4 @@ int Element_TUGN::graphics(GRAPHICS_FUNC_ARGS)
return 0; return 0;
} }
Element_TUGN::~Element_TUGN() {} Element_TUNG::~Element_TUNG() {}