summaryrefslogtreecommitdiff
path: root/src/graphics.c
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2011-03-24 19:41:45 (GMT)
committer Simon <simon@hardwired.org.uk>2011-03-24 19:41:45 (GMT)
commit3ab47ae9d76e9e5e0416f81e43de15417354caf5 (patch)
treed80fbec366baa970cd565ca5a17decb444036fad /src/graphics.c
parentfe90c86fa1f1365d07dc6eee83b074d08efec05a (diff)
downloadpowder-3ab47ae9d76e9e5e0416f81e43de15417354caf5.zip
powder-3ab47ae9d76e9e5e0416f81e43de15417354caf5.tar.gz
Effects for PRTO and PRTI
Diffstat (limited to 'src/graphics.c')
-rw-r--r--src/graphics.c90
1 files changed, 68 insertions, 22 deletions
diff --git a/src/graphics.c b/src/graphics.c
index fb3d384..917d267 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1341,6 +1341,8 @@ void xor_rect(pixel *vid, int x, int y, int w, int h)
void draw_parts(pixel *vid)
{
int i, x, y, t, nx, ny, r, s;
+ int orbd[4] = {0, 0, 0, 0};
+ int orbl[4] = {0, 0, 0, 0};
int cr, cg, cb;
float fr, fg, fb;
float pt = R_TEMP;
@@ -1921,32 +1923,76 @@ void draw_parts(pixel *vid)
}
}
}
- else if (t==PT_PRTI && DEBUG_MODE)
- {
- blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255);
- if (mousex==(nx) && mousey==(ny))
- {
- int z;
- for (z = 0; z<NPART; z++) {
- if (parts[z].type)
- {
- if (parts[z].type==PT_PRTO&&parts[z].tmp==parts[i].tmp)
- xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
+ else if (t==PT_PRTI)
+ {
+ int nxo = 0;
+ int nyo = 0;
+ int fire_rv = 0;
+ float drad = 0.0f;
+ float ddist = 0.0f;
+ orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
+ for(r = 0; r < 4; r++){
+ ddist = ((float)orbd[r])/16.0f;
+ drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
+ nxo = ddist*cos(drad);
+ nyo = ddist*sin(drad);
+ addpixel(vid, nx+nxo, ny+nyo, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), 255-orbd[r]);
+ if(cmode == CM_FIRE){
+ fire_rv = fire_r[(ny+nyo)/CELL][(nx+nxo)/CELL];
+ fire_rv += (255-orbd[r])/32;
+ if(fire_rv>255) fire_rv = 255;
+ fire_r[(ny+nyo)/CELL][(nx+nxo)/CELL] = fire_rv;
+ }
+ addpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), 200);
+ }
+ if(DEBUG_MODE){
+ blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255);
+ if (mousex==(nx) && mousey==(ny))
+ {
+ int z;
+ for (z = 0; z<NPART; z++) {
+ if (parts[z].type)
+ {
+ if (parts[z].type==PT_PRTO&&parts[z].tmp==parts[i].tmp)
+ xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
+ }
}
}
}
}
- else if (t==PT_PRTO && DEBUG_MODE)
- {
- blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255);
- if (mousex==(nx) && mousey==(ny))
- {
- int z;
- for (z = 0; z<NPART; z++) {
- if (parts[z].type)
- {
- if (parts[z].type==PT_PRTI&&parts[z].tmp==parts[i].tmp)
- xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
+ else if (t==PT_PRTO)
+ {
+ int nxo = 0;
+ int nyo = 0;
+ int fire_bv = 0;
+ float drad = 0.0f;
+ float ddist = 0.0f;
+ orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
+ for(r = 0; r < 4; r++){
+ ddist = ((float)orbd[r])/16.0f;
+ drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
+ nxo = ddist*cos(drad);
+ nyo = ddist*sin(drad);
+ addpixel(vid, nx+nxo, ny+nyo, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), 255-orbd[r]);
+ if(cmode == CM_FIRE){
+ fire_bv = fire_b[(ny+nyo)/CELL][(nx+nxo)/CELL];
+ fire_bv += (255-orbd[r])/32;
+ if(fire_bv>255) fire_bv = 255;
+ fire_b[(ny+nyo)/CELL][(nx+nxo)/CELL] = fire_bv;
+ }
+ addpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), 200);
+ }
+ if(DEBUG_MODE){
+ blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255);
+ if (mousex==(nx) && mousey==(ny))
+ {
+ int z;
+ for (z = 0; z<NPART; z++) {
+ if (parts[z].type)
+ {
+ if (parts[z].type==PT_PRTI&&parts[z].tmp==parts[i].tmp)
+ xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
+ }
}
}
}