diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-06-20 20:45:33 (GMT) |
|---|---|---|
| committer | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-06-20 21:15:45 (GMT) |
| commit | 1d5b08194291db72c05e68eed592e8fcb6101c63 (patch) | |
| tree | 39945df4b183ef2bbcaf0cc1432a3a02b547f5f6 /src/elements/fwrk.c | |
| parent | 9b2c2a78a6f4ba4fb13f04f17a649caeaf416d8d (diff) | |
| download | powder-1d5b08194291db72c05e68eed592e8fcb6101c63.zip powder-1d5b08194291db72c05e68eed592e8fcb6101c63.tar.gz | |
Replace all explosion sparks with new element (EMBR)
Replaces: BOMB sparks and flash, electrons + glass sparks, sparks from
IGNC, sparks from TNT explosion, and sparks from FWRK and FIRW.
Diffstat (limited to 'src/elements/fwrk.c')
| -rw-r--r-- | src/elements/fwrk.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/src/elements/fwrk.c b/src/elements/fwrk.c index 173b6e7..f54877b 100644 --- a/src/elements/fwrk.c +++ b/src/elements/fwrk.c @@ -34,33 +34,29 @@ int update_FWRK(UPDATE_FUNC_ARGS) { parts[i].life=0; if ((parts[i].life<3&&parts[i].life>0)||(parts[i].vy>6&&parts[i].life>0)) { - int q = (rand()%255+1); - int w = (rand()%255+1); - int e = (rand()%255+1); - for (rx=-1; rx<2; rx++) - for (ry=-2; ry<3; ry++) - if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) - { - if (5>=rand()%8) - { - if (!pmap[y+ry][x+rx]) - { - np = create_part(-1, x+rx, y+ry , PT_DUST); - pv[y/CELL][x/CELL] += 2.00f*CFDS; - if (np!=-1) - { - parts[np].vy = -(rand()%10-1); - parts[np].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ; - parts[np].life= rand()%37+18; - parts[np].tmp=q; - parts[np].tmp2=w; - parts[np].ctype=e; - parts[np].temp= rand()%20+6000; - parts[np].dcolour = parts[i].dcolour; - } - } - } - } + int r = (rand()%245+11); + int g = (rand()%245+11); + int b = (rand()%245+11); + int n; + float angle, magnitude; + unsigned col = (r<<16) | (g<<8) | b; + for (n=0; n<40; n++) + { + np = create_part(-3, x, y, PT_EMBR); + if (np>-1) + { + magnitude = ((rand()%60)+40)*0.05f; + angle = (rand()%6284)*0.001f;//(in radians, between 0 and 2*pi) + parts[np].vx = parts[i].vx + cosf(angle)*magnitude; + parts[np].vy = parts[i].vy + sinf(angle)*magnitude - 2.5f; + parts[np].ctype = col; + parts[np].tmp = 1; + parts[np].life = rand()%40+70; + parts[np].temp = (rand()%500)+5750.0f; + parts[np].dcolour = parts[i].dcolour; + } + } + pv[y/CELL][x/CELL] += 8.0f; kill_part(i); return 1; } |
