Less buggy DLAY
This commit is contained in:
parent
58d96de4ce
commit
3bd5a4711c
@ -131,6 +131,7 @@
|
|||||||
#define PT_IRON 76
|
#define PT_IRON 76
|
||||||
#define PT_MORT 77
|
#define PT_MORT 77
|
||||||
#define PT_LIFE 78
|
#define PT_LIFE 78
|
||||||
|
#define PT_DLAY 79
|
||||||
|
|
||||||
#define PT_SPNG 90
|
#define PT_SPNG 90
|
||||||
#define PT_RIME 91
|
#define PT_RIME 91
|
||||||
@ -309,6 +310,7 @@ int update_MERC(UPDATE_FUNC_ARGS);
|
|||||||
int update_PBCN(UPDATE_FUNC_ARGS);
|
int update_PBCN(UPDATE_FUNC_ARGS);
|
||||||
int update_GPMP(UPDATE_FUNC_ARGS);
|
int update_GPMP(UPDATE_FUNC_ARGS);
|
||||||
int update_CLST(UPDATE_FUNC_ARGS);
|
int update_CLST(UPDATE_FUNC_ARGS);
|
||||||
|
int update_DLAY(UPDATE_FUNC_ARGS);
|
||||||
|
|
||||||
int update_MISC(UPDATE_FUNC_ARGS);
|
int update_MISC(UPDATE_FUNC_ARGS);
|
||||||
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
|
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
|
||||||
@ -465,7 +467,7 @@ static const part_type ptypes[PT_NUM] =
|
|||||||
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, &update_IRON},
|
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, &update_IRON},
|
||||||
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT},
|
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT},
|
||||||
{"LIFE", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"LIFE", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
/*FREE*/{"HLIF", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "High Life! B36/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"DLAY", PIXPACK(0x753590), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, 4.0f+273.15f, 0, "Conducts with temperature-dependent delay. (use HEAT/COOL).", ST_SOLID, TYPE_SOLID, &update_DLAY},
|
||||||
/*FREE*/{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
/*FREE*/{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
/*FREE*/{"2x2", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
/*FREE*/{"2x2", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
/*FREE*/{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
/*FREE*/{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
@ -635,18 +637,18 @@ static part_transition ptransitions[PT_NUM] =
|
|||||||
/* HSWC */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* HSWC */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* IRON */ {IPL, NT, IPH, NT, ITL, NT, 1687.0f,PT_LAVA},
|
/* IRON */ {IPL, NT, IPH, NT, ITL, NT, 1687.0f,PT_LAVA},
|
||||||
/* MORT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* MORT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* LIFE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* DLAY */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* SPNG */ {IPL, NT, IPH, NT, ITL, NT, 2730.0f,PT_FIRE},
|
/* SPNG */ {IPL, NT, IPH, NT, ITL, NT, 2730.0f,PT_FIRE},
|
||||||
/* RIME */ {IPL, NT, IPH, NT, ITL, NT, 273.15f,PT_WATR},
|
/* RIME */ {IPL, NT, IPH, NT, ITL, NT, 273.15f,PT_WATR},
|
||||||
/* FOG */ {IPL, NT, IPH, NT, ITL, NT, 373.15f,PT_WTRV},
|
/* FOG */ {IPL, NT, IPH, NT, ITL, NT, 373.15f,PT_WTRV},
|
||||||
@ -691,19 +693,19 @@ static part_transition ptransitions[PT_NUM] =
|
|||||||
/* SING */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* SING */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* QRTZ */ {IPL, NT, IPH, NT, ITL, NT, 2573.15f,PT_LAVA},
|
/* QRTZ */ {IPL, NT, IPH, NT, ITL, NT, 2573.15f,PT_LAVA},
|
||||||
/* PQRT */ {IPL, NT, IPH, NT, ITL, NT, 2573.15f,PT_LAVA},
|
/* PQRT */ {IPL, NT, IPH, NT, ITL, NT, 2573.15f,PT_LAVA},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* BOYL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* BOYL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* H2 */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
/* H2 */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||||
/* SOAP */ {IPL, NT, IPH, NT, ITL, NT, ITL, NT},
|
/* SOAP */ {IPL, NT, IPH, NT, ITL, NT, ITL, NT},
|
||||||
|
48
src/elements/dlay.c
Normal file
48
src/elements/dlay.c
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include <element.h>
|
||||||
|
|
||||||
|
int update_DLAY(UPDATE_FUNC_ARGS) {
|
||||||
|
int r, rx, ry, oldl;
|
||||||
|
oldl = parts[i].life;
|
||||||
|
if (parts[i].life>0)
|
||||||
|
parts[i].life--;
|
||||||
|
//if (parts[i].life==1)
|
||||||
|
//{
|
||||||
|
if (parts[i].temp>=256.0+273.15)
|
||||||
|
parts[i].temp=256.0+273.15;
|
||||||
|
if (parts[i].temp<= -256.0+273.15)
|
||||||
|
parts[i].temp = -256.0+273.15;
|
||||||
|
|
||||||
|
for (rx=-2; rx<3; rx++)
|
||||||
|
for (ry=-2; ry<3; ry++)
|
||||||
|
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
|
{
|
||||||
|
r = pmap[y+ry][x+rx];
|
||||||
|
if ((r>>8)>=NPART || !r)
|
||||||
|
continue;
|
||||||
|
if ((r&0xFF)==PT_SPRK && parts[i].life==0 && parts[r>>8].ctype==PT_PSCN)
|
||||||
|
{
|
||||||
|
parts[i].life = (int)(parts[i].temp-273.15);
|
||||||
|
}
|
||||||
|
else if ((r&0xFF)==PT_DLAY)
|
||||||
|
{
|
||||||
|
if(!parts[i].life && parts[r>>8].life)
|
||||||
|
{
|
||||||
|
parts[i].life = parts[r>>8].life;
|
||||||
|
if((r>>8)>i) //If the other particle hasn't been life updated
|
||||||
|
parts[i].life--;
|
||||||
|
}
|
||||||
|
else if(parts[i].life && !parts[r>>8].life)
|
||||||
|
{
|
||||||
|
parts[r>>8].life = parts[i].life;
|
||||||
|
if((r>>8)>i) //If the other particle hasn't been life updated
|
||||||
|
parts[r>>8].life++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if((r&0xFF)==PT_NSCN && oldl==1)
|
||||||
|
{
|
||||||
|
create_part(-1, x+rx, y+ry, PT_SPRK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
return 0;
|
||||||
|
}
|
@ -2856,6 +2856,31 @@ void draw_parts(pixel *vid)
|
|||||||
blendpixel(vid, nx-1, ny+1, GR, GR/2, 10, 112);
|
blendpixel(vid, nx-1, ny+1, GR, GR/2, 10, 112);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (t==PT_DLAY)
|
||||||
|
{
|
||||||
|
int stage = (int)(((float)parts[i].life/(parts[i].temp-273.15))*100.0f);
|
||||||
|
cr = PIXR(ptypes[t].pcolors)+stage;
|
||||||
|
cg = PIXG(ptypes[t].pcolors)+stage;
|
||||||
|
cb = PIXB(ptypes[t].pcolors)+stage;
|
||||||
|
if(cr>255)
|
||||||
|
cr = 255;
|
||||||
|
if(cg>255)
|
||||||
|
cg = 255;
|
||||||
|
if(cb>255)
|
||||||
|
cb = 255;
|
||||||
|
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb);
|
||||||
|
if (cmode == CM_BLOB) {
|
||||||
|
blendpixel(vid, nx+1, ny, cr, cg, cb, 223);
|
||||||
|
blendpixel(vid, nx-1, ny, cr, cg, cb, 223);
|
||||||
|
blendpixel(vid, nx, ny+1, cr, cg, cb, 223);
|
||||||
|
blendpixel(vid, nx, ny-1, cr, cg, cb, 223);
|
||||||
|
|
||||||
|
blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112);
|
||||||
|
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112);
|
||||||
|
blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112);
|
||||||
|
blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (t==PT_HSWC)
|
else if (t==PT_HSWC)
|
||||||
{
|
{
|
||||||
uint8 GR = 0x3B+((parts[i].life>10?10:parts[i].life)*19);
|
uint8 GR = 0x3B+((parts[i].life>10?10:parts[i].life)*19);
|
||||||
|
Loading…
Reference in New Issue
Block a user