Fancier glow, now affected by Velocity, Pressure and Heat

This commit is contained in:
Simon 2011-02-23 20:35:02 +00:00
parent fa76c4b45c
commit 5d4d815ad3
3 changed files with 22 additions and 22 deletions

View File

@ -435,7 +435,7 @@ static const part_type ptypes[PT_NUM] =
{"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", ST_SOLID, TYPE_PART, &update_YEST}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", ST_SOLID, TYPE_PART, &update_YEST},
{"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", ST_SOLID, TYPE_PART, NULL}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", ST_SOLID, TYPE_PART, NULL},
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremely high temperature.", ST_SOLID, TYPE_PART, &update_THRM}, {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremely high temperature.", ST_SOLID, TYPE_PART, &update_THRM},
{"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW}, {"GLOW", PIXPACK(0x445464), 0.3f, 0.02f * CFDS, 0.98f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW},
{"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW, NULL}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW, NULL},
{"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL}, {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL},
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW}, {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW},

View File

@ -16,6 +16,10 @@ int update_GLOW(UPDATE_FUNC_ARGS) {
parts[r>>8].life = 10; parts[r>>8].life = 10;
} }
} }
parts[i].life = pv[y/CELL][x/CELL]*16;
parts[i].tmp = abs((int)((vx[y/CELL][x/CELL]+vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f));
//printf("%f %f\n", parts[i].vx, parts[i].vy);
if (parts[i].type==PT_NONE) { if (parts[i].type==PT_NONE) {
kill_part(i); kill_part(i);
return 1; return 1;

View File

@ -2370,15 +2370,15 @@ void draw_parts(pixel *vid)
} }
else if (t==PT_GLOW) else if (t==PT_GLOW)
{ {
fg = 0; fr = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f;
fb = 0; fg = restrict_flt(parts[i].life, 0, 128)/50.0f;
fr = 0; fb = restrict_flt(parts[i].tmp, 0, 128)/50.0f;
if (pv[ny/CELL][nx/CELL]>0) {
fg = 6 * pv[ny/CELL][nx/CELL]; cr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255);
fb = 4 * pv[ny/CELL][nx/CELL]; cg = restrict_flt(64.0f+parts[i].life, 0, 255);
fr = 2 * pv[ny/CELL][nx/CELL]; cb = restrict_flt(64.0f+parts[i].tmp, 0, 255);
}
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb);
if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{ {
x = nx/CELL; x = nx/CELL;
@ -2394,19 +2394,15 @@ void draw_parts(pixel *vid)
fire_r[y][x] = fr; fire_r[y][x] = fr;
} }
if (cmode == CM_BLOB) { if (cmode == CM_BLOB) {
uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); blendpixel(vid, nx+1, ny, cr, cg, cb, 223);
uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); blendpixel(vid, nx-1, ny, cr, cg, cb, 223);
uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); blendpixel(vid, nx, ny+1, cr, cg, cb, 223);
blendpixel(vid, nx, ny-1, cr, cg, cb, 223);
blendpixel(vid, nx+1, ny, R, G, B, 223); blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112);
blendpixel(vid, nx-1, ny, R, G, B, 223); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112);
blendpixel(vid, nx, ny+1, R, G, B, 223); blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112);
blendpixel(vid, nx, ny-1, R, G, B, 223); blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112);
blendpixel(vid, nx+1, ny-1, R, G, B, 112);
blendpixel(vid, nx-1, ny-1, R, G, B, 112);
blendpixel(vid, nx+1, ny+1, R, G, B, 112);
blendpixel(vid, nx-1, ny+1, R, G, B, 112);
} }
} }
else if (t==PT_LCRY) else if (t==PT_LCRY)