diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-23 12:52:26 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-23 12:52:26 (GMT) |
| commit | 1c7b9d9949f4aca2ceba44b9d41420ad34c69f94 (patch) | |
| tree | f917e85e29ac8c95b4ed894ea4b8b764e2290c47 /src/elements/pipe.c | |
| parent | 014c1fbad669b0cf1abd881e696f0c7e432b3707 (diff) | |
| download | powder-1c7b9d9949f4aca2ceba44b9d41420ad34c69f94.zip powder-1c7b9d9949f4aca2ceba44b9d41420ad34c69f94.tar.gz | |
Pass particle pointer to graphics update function instead of index. Make PIPE use subcall to get graphics info. Cache for particle graphics properties. Stickman PSPEC_STICKMAN added and implemented
Diffstat (limited to 'src/elements/pipe.c')
| -rw-r--r-- | src/elements/pipe.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/elements/pipe.c b/src/elements/pipe.c index 7411932..7014536 100644 --- a/src/elements/pipe.c +++ b/src/elements/pipe.c @@ -235,3 +235,85 @@ int update_PIPE(UPDATE_FUNC_ARGS) { } return 0; } + +int graphics_PIPE(GRAPHICS_FUNC_ARGS) +{ + if (cpart->ctype==2) + { + *colr = 50; + *colg = 1; + *colb = 1; + } + else if (cpart->ctype==3) + { + *colr = 1; + *colg = 50; + *colb = 1; + } + else if (cpart->ctype==4) + { + *colr = 1; + *colg = 1; + *colb = 50; + } + else if (cpart->temp<272.15&&cpart->ctype!=1) + { + if (cpart->temp>173.25&&cpart->temp<273.15) + { + *colr = 50; + *colg = 1; + *colb = 1; + } + if (cpart->temp>73.25&&cpart->temp<=173.15) + { + *colr = 1; + *colg = 50; + *colb = 1; + } + if (cpart->temp>=0&&cpart->temp<=73.15) + { + *colr = 1; + *colg = 1; + *colb = 50; + } + } + if ((cpart->tmp&0xFF)>0 && (cpart->tmp&0xFF)<PT_NUM) + { + //Create a temp. particle and do a subcall. + particle tpart; + int t; + memset(&tpart, 0, sizeof(particle)); + tpart.type = cpart->tmp&0xFF; + tpart.temp = cpart->temp; + tpart.life = cpart->flags; + tpart.tmp = cpart->pavg[0]; + tpart.ctype = cpart->pavg[1]; + t = tpart.type; + if (graphicscache[t].isready) + { + *pixel_mode = graphicscache[t].pixel_mode; + *colr = graphicscache[t].colr; + *colg = graphicscache[t].colg; + *colb = graphicscache[t].colb; + *firea = graphicscache[t].firea; + *firer = graphicscache[t].firer; + *fireg = graphicscache[t].fireg; + *fireb = graphicscache[t].fireb; + } + else + { + if (ptypes[t].graphics_func) + { + (*(ptypes[t].graphics_func))(&tpart, nx, ny, pixel_mode, colr, colg, colb, firea, firer, fireg, fireb); + } + else + { + graphics_DEFAULT(&tpart, nx, ny, pixel_mode, colr, colg, colb, firea, firer, fireg, fireb); + } + } + //*colr = PIXR(ptypes[cpart->tmp&0xFF].pcolors); + //*colg = PIXG(ptypes[cpart->tmp&0xFF].pcolors); + //*colb = PIXB(ptypes[cpart->tmp&0xFF].pcolors); + } + return 0; +} |
