diff options
| author | Simon Robertshaw <simon@Simons-Mac-Pro.local> | 2012-04-30 20:49:40 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@Simons-Mac-Pro.local> | 2012-04-30 20:49:40 (GMT) |
| commit | 211770e8189b426287adad3d924c20cac203fbd1 (patch) | |
| tree | 51b335ff8e73a4bbfb017a0de4dc7c2f68be05dd /src/elements | |
| parent | 8397b6e51aa817f2b33347bc801fdaee0b4d2700 (diff) | |
| parent | 433c1881bc37ea257999b88eee920c19a92798c5 (diff) | |
| download | powder-211770e8189b426287adad3d924c20cac203fbd1.zip powder-211770e8189b426287adad3d924c20cac203fbd1.tar.gz | |
Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/gel.c | 2 | ||||
| -rw-r--r-- | src/elements/sing.c | 12 | ||||
| -rw-r--r-- | src/elements/tron.c | 38 |
3 files changed, 24 insertions, 28 deletions
diff --git a/src/elements/gel.c b/src/elements/gel.c index efd9d78..5c1b1f5 100644 --- a/src/elements/gel.c +++ b/src/elements/gel.c @@ -14,7 +14,7 @@ int update_GEL(UPDATE_FUNC_ARGS) { if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || (r&0xFF)==PT_CBNW) && parts[i].tmp<100) { - parts[i].tmp = (100+parts[i].tmp)/2; + parts[i].tmp++; kill_part(r>>8); } diff --git a/src/elements/sing.c b/src/elements/sing.c index d6fc273..3e17fe0 100644 --- a/src/elements/sing.c +++ b/src/elements/sing.c @@ -15,21 +15,21 @@ int update_SING(UPDATE_FUNC_ARGS) { if (y+CELL<YRES) pv[y/CELL+1][x/CELL+1] += 0.1f*(singularity-pv[y/CELL+1][x/CELL+1]); } - if (y+CELL>0 && pv[y/CELL-1][x/CELL]<singularity) + if (y-CELL>=0 && pv[y/CELL-1][x/CELL]<singularity) pv[y/CELL-1][x/CELL] += 0.1f*(singularity-pv[y/CELL-1][x/CELL]); - if (x+CELL>0) + if (x-CELL>=0) { pv[y/CELL][x/CELL-1] += 0.1f*(singularity-pv[y/CELL][x/CELL-1]); - if (y+CELL>0) + if (y-CELL>=0) pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-pv[y/CELL-1][x/CELL-1]); } if (parts[i].life<1) { //Pop! - for (rx=-2; rx<3; rx++) { + for (rx=-1; rx<2; rx++) { crx = (x/CELL)+rx; - for (ry=-2; ry<3; ry++) { + for (ry=-1; ry<2; ry++) { cry = (y/CELL)+ry; - if (cry > 0 && crx > 0 && crx < (XRES/CELL) && cry < (YRES/CELL)) { + if (cry >= 0 && crx >= 0 && crx < (XRES/CELL) && cry < (YRES/CELL)) { pv[cry][crx] += (float)parts[i].tmp; } } diff --git a/src/elements/tron.c b/src/elements/tron.c index df8fbe3..00d2e9e 100644 --- a/src/elements/tron.c +++ b/src/elements/tron.c @@ -24,6 +24,7 @@ #define TRON_DEATH 16 //Crashed, now dying int tron_rx[4] = {-1, 0, 1, 0}; int tron_ry[4] = { 0,-1, 0, 1}; +unsigned int tron_colours[32]; int new_tronhead(int x, int y, int i, int direction) { int np = create_part(-1, x , y ,PT_TRON); @@ -90,14 +91,6 @@ int trymovetron(int x, int y, int dir, int i, int len) } int update_TRON(UPDATE_FUNC_ARGS) { int r, rx, ry, np; - if(!parts[i].ctype) - { - int r, g, b; - int hue = (parts[i].tmp&0xF800)>>7; - HSV_to_RGB(hue,255,255,&r,&g,&b); - parts[i].ctype = r<<16 | g<<8 | b; - //Use photon-like wavelength? - } if (parts[i].tmp&TRON_WAIT) { parts[i].tmp &= ~TRON_WAIT; @@ -162,20 +155,12 @@ int update_TRON(UPDATE_FUNC_ARGS) { } int graphics_TRON(GRAPHICS_FUNC_ARGS) { + unsigned int col = tron_colours[(cpart->tmp&0xF800)>>11]; if(cpart->tmp & TRON_HEAD) *pixel_mode |= PMODE_GLOW; - if(cpart->ctype) - { - *colr = (cpart->ctype & 0xFF0000)>>16; - *colg = (cpart->ctype & 0x00FF00)>>8; - *colb = (cpart->ctype & 0x0000FF); - } - else - { - *colr = 255; - *colg = 255; - *colb = 255; - } + *colr = (col & 0xFF0000)>>16; + *colg = (col & 0x00FF00)>>8; + *colb = (col & 0x0000FF); if(cpart->tmp & TRON_DEATH) { *pixel_mode |= FIRE_ADD | PMODE_FLARE; @@ -191,4 +176,15 @@ int graphics_TRON(GRAPHICS_FUNC_ARGS) { *cola = (int)((((float)cpart->life)/((float)cpart->tmp2))*255.0f); } return 0; -}
\ No newline at end of file +} + +void TRON_init_graphics() +{ + int i; + int r, g, b; + for (i=0; i<32; i++) + { + HSV_to_RGB(i<<4,255,255,&r,&g,&b); + tron_colours[i] = r<<16 | g<<8 | b; + } +} |
