From 77646c71040182fd7871407c3fd1f404e2e4f4b0 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Aug 2010 03:09:45 +0800 Subject: [PATCH 1/4] sorta glow-ish --- powder.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/powder.c b/powder.c index 54f0f96b8..03c7a7f6e 100755 --- a/powder.c +++ b/powder.c @@ -3180,8 +3180,20 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } - else if(t==PT_PLSM) + } else if(t==PT_URAN) { + cr=0x70; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, 255, 255, 255, 255); + blendpixel(vid, nx+1, ny, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx-1, ny, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx, ny+1, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx, ny-1, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 255); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 255); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 255); + } else if(t==PT_PLSM) { float ttemp = parts[i].life; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); From 9249455ba7d1987f8b730ea585ac86b15374b4c3 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Aug 2010 03:31:10 +0800 Subject: [PATCH 2/4] added glow-ish uran and plut --- powder.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/powder.c b/powder.c index 03c7a7f6e..b3ab34d40 100755 --- a/powder.c +++ b/powder.c @@ -3181,18 +3181,63 @@ justdraw: blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } } else if(t==PT_URAN) { - cr=0x70; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, 255, 255, 255, 255); - blendpixel(vid, nx+1, ny, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx-1, ny, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx, ny+1, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx, ny-1, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 255); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 255); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 255); + cr=0x70; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, cr, cr, cr, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny, cr, cg, cb, 32); + blendpixel(vid, nx, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); + } else if(t==PT_PLUT) { + cr=0x40; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, cr, cr, cr, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny, cr, cg, cb, 32); + blendpixel(vid, nx, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); } else if(t==PT_PLSM) { float ttemp = parts[i].life; From 1682788324048e4d8fc6a6fcbb7cb044cd2b6441 Mon Sep 17 00:00:00 2001 From: ief015 Date: Mon, 16 Aug 2010 16:09:22 -0400 Subject: [PATCH 3/4] > ief015 -Ctrl+Z Undo (ctrl+z will only to revert to the undo state, there is no redo, though I can change this if it becomes necessary) -I don't know what those inline keywords were for, but they were causing errors. --- powder.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/powder.c b/powder.c index 9c7d2d96a..eb5b6d6cb 100644 --- a/powder.c +++ b/powder.c @@ -5,6 +5,7 @@ * Copyright (c) 2010 Simon Robertshaw * Copyright (c) 2010 Skresanov Savely * Copyright (c) 2010 Bryan Hoyle + * Copyright (c) 2010 Nathan Cousins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -113,6 +114,7 @@ char *it_msg = "Shift+drag will create straight lines of particles.\n" "Ctrl+drag will result in filled rectangles.\n" "Ctrl+Shift+click will flood-fill a closed area.\n" + "Ctrl+Z will act as Undo.\n" "Middle click or Alt+Click to \"sample\" the particles.\n" "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" "Use 'S' to save parts of the window as 'stamps'.\n" @@ -128,6 +130,7 @@ char *it_msg = "\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 Bryan Hoyle (New elements)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" "\n" "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" @@ -169,11 +172,20 @@ struct sign unsigned char bmap[YRES/CELL][XRES/CELL]; unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + unsigned cmode = 3; float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; #define TSTEPP 0.3f #define TSTEPV 0.4f @@ -340,7 +352,7 @@ void *update_air_th(void *arg) return NULL; } -inline unsigned clamp_flt(float f, float min, float max) +unsigned clamp_flt(float f, float min, float max) { if(f=XRES || y>=YRES) @@ -1272,7 +1288,7 @@ void set_emap(int x, int y) set_emap(x, y+1); } } -inline int parts_avg(int ci, int ni) + int parts_avg(int ci, int ni) { int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; if((pmr>>8) < NPART && (pmr>>8) >= 0) @@ -4474,7 +4490,7 @@ void *build_thumb(int *size, int bzip2) return d; } -inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) { unsigned char *d,*c=thumb; @@ -5434,7 +5450,7 @@ void del_stamp(int d) #include "font.h" -inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -5449,7 +5465,7 @@ inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) { int i, j, w, bn = 0, ba = 0; char *rp = font_data + font_ptrs[c]; @@ -9875,6 +9891,7 @@ int main(int argc, char *argv[]) #endif menu_count(); parts = calloc(sizeof(particle), NPART); + cb_parts = calloc(sizeof(particle), NPART); for(i=0; i 50) it = 50; } + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + { + int cbx, cby, cbi; + + for(cbi=0; cbi Date: Mon, 16 Aug 2010 16:23:46 -0400 Subject: [PATCH 4/4] readded inlines, my bad --- powder.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/powder.c b/powder.c index eb5b6d6cb..d403ff8f1 100644 --- a/powder.c +++ b/powder.c @@ -352,7 +352,7 @@ void *update_air_th(void *arg) return NULL; } -unsigned clamp_flt(float f, float min, float max) +inline unsigned clamp_flt(float f, float min, float max) { if(f=XRES || y>=YRES) @@ -1288,7 +1288,7 @@ void set_emap(int x, int y) set_emap(x, y+1); } } - int parts_avg(int ci, int ni) + inline int parts_avg(int ci, int ni) { int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; if((pmr>>8) < NPART && (pmr>>8) >= 0) @@ -5450,7 +5450,7 @@ void del_stamp(int d) #include "font.h" -void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -5465,7 +5465,7 @@ void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } -int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) { int i, j, w, bn = 0, ba = 0; char *rp = font_data + font_ptrs[c];