diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/glow.c | 4 | ||||
| -rw-r--r-- | src/graphics.c | 40 | ||||
| -rw-r--r-- | src/main.c | 13 | ||||
| -rw-r--r-- | src/powder.c | 16 |
4 files changed, 37 insertions, 36 deletions
diff --git a/src/elements/glow.c b/src/elements/glow.c index 621e5b1..d692233 100644 --- a/src/elements/glow.c +++ b/src/elements/glow.c @@ -16,6 +16,10 @@ int update_GLOW(UPDATE_FUNC_ARGS) { parts[r>>8].life = 10; } } + parts[i].ctype = 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) { kill_part(i); return 1; diff --git a/src/graphics.c b/src/graphics.c index ea8d0d5..cea2ba7 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -2370,15 +2370,15 @@ void draw_parts(pixel *vid) } else if (t==PT_GLOW) { - fg = 0; - fb = 0; - fr = 0; - if (pv[ny/CELL][nx/CELL]>0) { - fg = 6 * pv[ny/CELL][nx/CELL]; - fb = 4 * pv[ny/CELL][nx/CELL]; - fr = 2 * pv[ny/CELL][nx/CELL]; - } - 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)); + fr = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f; + fg = restrict_flt(parts[i].ctype, 0, 128)/50.0f; + fb = restrict_flt(parts[i].tmp, 0, 128)/50.0f; + + cr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255); + cg = restrict_flt(64.0f+parts[i].ctype, 0, 255); + cb = restrict_flt(64.0f+parts[i].tmp, 0, 255); + + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb); if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { x = nx/CELL; @@ -2394,19 +2394,15 @@ void draw_parts(pixel *vid) fire_r[y][x] = fr; } if (cmode == CM_BLOB) { - uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); - uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); - uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - 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); + 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_LCRY) @@ -119,7 +119,7 @@ void play_sound(char *file) } static const char *it_msg = - "\brThe Powder Toy - http://powdertoy.co.uk/\n" + "\brThe Powder Toy - http://powdertoy.co.uk, irc.freenode.net #powder\n" "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" "\n" "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" @@ -139,12 +139,8 @@ static const char *it_msg = "The spacebar can be used to pause physics.\n" "'P' will take a screenshot and save it into the current directory.\n" "\n" - "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" - "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" - "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" - "\bgCopyright (c) 2010 cracker64\n" - "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" - "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" + "\bgCopyright (c) 2008-11 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" + "\bgCopyright (c) 2010-11 Simon Robertshaw, Skresanov Savely, cracker64, Bryan Hoyle, Nathan Cousins, jacksonmj\n" "\n" "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" ; @@ -2328,7 +2324,7 @@ int main(int argc, char *argv[]) if (sdl_key==SDLK_BACKQUOTE) { console_mode = !console_mode; - hud_enable = !console_mode; + //hud_enable = !console_mode; } if (sdl_key=='g') { @@ -2616,6 +2612,7 @@ int main(int argc, char *argv[]) } } } + mx = x; my = y; if (update_flag) diff --git a/src/powder.c b/src/powder.c index af91808..e15565b 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1575,10 +1575,12 @@ void update_particles_i(pixel *vid, int start, int inc) } else if (t==PT_LAVA) { if (parts[i].ctype && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA) { - if (ptransitions[parts[i].ctype].tht==PT_LAVA&&pt>=ptransitions[parts[i].ctype].thv) s = 0; - else if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0; + if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0; + else if (ptransitions[parts[i].ctype].tht==PT_LAVA) { + if (pt>=ptransitions[parts[i].ctype].thv) 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 (s) { t = parts[i].ctype; parts[i].ctype = PT_NONE; if (t==PT_THRM) { @@ -1995,7 +1997,9 @@ killed: if (try_move(i, x, y, j, clear_y)) { parts[i].x = clear_xf+(j-clear_x); + parts[i].y = clear_yf; nx = j; + ny = clear_y; s = 1; break; } @@ -2007,11 +2011,11 @@ killed: else r = -1; if (s) - for (j=clear_y+r; j>=0 && j<YRES && j>=clear_y-rt && j<clear_y+rt; j+=r) + for (j=ny+r; j>=0 && j<YRES && j>=ny-rt && j<ny+rt; j+=r) { - if (try_move(i, x, y, nx, j)) + if (try_move(i, nx, ny, nx, j)) { - parts[i].y = clear_yf+(j-clear_y); + parts[i].y += j-ny; break; } if ((pmap[j][nx]&255)!=t || (bmap[j/CELL][nx/CELL] && bmap[j/CELL][nx/CELL]!=WL_STREAM)) |
