summaryrefslogtreecommitdiff
path: root/src/graphics.c
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2011-04-08 10:09:42 (GMT)
committer Simon <simon@hardwired.org.uk>2011-04-08 10:09:42 (GMT)
commit767d73c5fc51647dcb5da4ed8349da2186c5060c (patch)
treee9cb3540858927af4887553068fd348a95195092 /src/graphics.c
parent1bdf72be1a306ac07641211adb2ec1539e3d0a48 (diff)
downloadpowder-767d73c5fc51647dcb5da4ed8349da2186c5060c.zip
powder-767d73c5fc51647dcb5da4ed8349da2186c5060c.tar.gz
astyle
Diffstat (limited to 'src/graphics.c')
-rw-r--r--src/graphics.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/graphics.c b/src/graphics.c
index b4cd51c..6270547 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1632,7 +1632,7 @@ void draw_parts(pixel *vid)
fr = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f;
fg = restrict_flt(parts[i].ctype, 0, 128)/50.0f;
fb = restrict_flt(parts[i].tmp, 0, 128)/50.0f;
-
+
cr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255);
cg = restrict_flt(64.0f+parts[i].ctype, 0, 255);
cb = restrict_flt(64.0f+parts[i].tmp, 0, 255);
@@ -1808,45 +1808,45 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
- else if(t==PT_LOTE)//colors for life states
+ else if (t==PT_LOTE)//colors for life states
{
- if(parts[i].tmp==2)
+ if (parts[i].tmp==2)
blendpixel(vid, nx, ny, 255, 128, 0, 255);
- else if(parts[i].tmp==1)
+ else if (parts[i].tmp==1)
blendpixel(vid, nx, ny, 255, 255, 0, 255);
else
blendpixel(vid, nx, ny, 255, 0, 0, 255);
}
- else if(t==PT_FRG2)//colors for life states
+ else if (t==PT_FRG2)//colors for life states
{
- if(parts[i].tmp==2)
+ if (parts[i].tmp==2)
blendpixel(vid, nx, ny, 0, 100, 50, 255);
else
blendpixel(vid, nx, ny, 0, 255, 90, 255);
}
- else if(t==PT_STAR)//colors for life states
+ else if (t==PT_STAR)//colors for life states
{
- if(parts[i].tmp==4)
+ if (parts[i].tmp==4)
blendpixel(vid, nx, ny, 0, 0, 128, 255);
- else if(parts[i].tmp==3)
+ else if (parts[i].tmp==3)
blendpixel(vid, nx, ny, 0, 0, 150, 255);
- else if(parts[i].tmp==2)
+ else if (parts[i].tmp==2)
blendpixel(vid, nx, ny, 0, 0, 190, 255);
- else if(parts[i].tmp==1)
+ else if (parts[i].tmp==1)
blendpixel(vid, nx, ny, 0, 0, 230, 255);
else
blendpixel(vid, nx, ny, 0, 0, 70, 255);
}
- else if(t==PT_FROG)//colors for life states
+ else if (t==PT_FROG)//colors for life states
{
- if(parts[i].tmp==2)
+ if (parts[i].tmp==2)
blendpixel(vid, nx, ny, 0, 100, 0, 255);
else
blendpixel(vid, nx, ny, 0, 255, 0, 255);
}
- else if(t==PT_BRAN)//colors for life states
+ else if (t==PT_BRAN)//colors for life states
{
- if(parts[i].tmp==1)
+ if (parts[i].tmp==1)
blendpixel(vid, nx, ny, 150, 150, 0, 255);
else
blendpixel(vid, nx, ny, 255, 255, 0, 255);
@@ -1985,23 +1985,23 @@ void draw_parts(pixel *vid)
float drad = 0.0f;
float ddist = 0.0f;
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
- for(r = 0; r < 4; r++){
+ 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);
- if(ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES){
+ if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES) {
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 && r == 1){
+ if (cmode == CM_FIRE && r == 1) {
fire_rv = fire_r[(ny+nyo)/CELL][(nx+nxo)/CELL];
fire_rv += 1;
- if(fire_rv>255) fire_rv = 255;
+ 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){//draw lines connecting portals
+ if (DEBUG_MODE) {//draw lines connecting portals
blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255);
if (mousex==(nx) && mousey==(ny))
{
@@ -2024,23 +2024,23 @@ void draw_parts(pixel *vid)
float drad = 0.0f;
float ddist = 0.0f;
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
- for(r = 0; r < 4; r++){
+ 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);
- if(ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES){
+ if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES) {
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 && r == 1){
+ if (cmode == CM_FIRE && r == 1) {
fire_bv = fire_b[(ny+nyo)/CELL][(nx+nxo)/CELL];
fire_bv += 1;
- if(fire_bv>255) fire_bv = 255;
+ 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){//draw lines connecting portals
+ if (DEBUG_MODE) {//draw lines connecting portals
blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255);
if (mousex==(nx) && mousey==(ny))
{
@@ -2482,11 +2482,11 @@ void draw_parts(pixel *vid)
fr = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f;
fg = restrict_flt(parts[i].ctype, 0, 128)/50.0f;
fb = restrict_flt(parts[i].tmp, 0, 128)/50.0f;
-
+
cr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255);
cg = restrict_flt(64.0f+parts[i].ctype, 0, 255);
cb = restrict_flt(64.0f+parts[i].tmp, 0, 255);
-
+
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb);
if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
@@ -2711,7 +2711,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny, cr, cg, cb, (gradv*2)>255?255:(gradv*2) );
blendpixel(vid, nx, ny+1, cr, cg, cb, (gradv*2)>255?255:(gradv*2) );
blendpixel(vid, nx, ny-1, cr, cg, cb, (gradv*2)>255?255:(gradv*2) );
- if(gradv>255) gradv=255;
+ if (gradv>255) gradv=255;
blendpixel(vid, nx+1, ny-1, cr, cg, cb, gradv);
blendpixel(vid, nx-1, ny-1, cr, cg, cb, gradv);
blendpixel(vid, nx+1, ny+1, cr, cg, cb, gradv);
@@ -3039,7 +3039,7 @@ void draw_wavelengths(pixel *vid, int x, int y, int h, int wl)
int i,cr,cg,cb,j;
int tmp;
fillrect(vid,x-1,y-1,30+1,h+1,64,64,64,255); // coords -1 size +1 to work around bug in fillrect - TODO: fix fillrect
- for (i=0;i<30;i++)
+ for (i=0; i<30; i++)
{
if ((wl>>i)&1)
{
@@ -3059,7 +3059,7 @@ void draw_wavelengths(pixel *vid, int x, int y, int h, int wl)
cr *= tmp;
cg *= tmp;
cb *= tmp;
- for (j=0;j<h;j++) blendpixel(vid,x+29-i,y+j,cr>255?255:cr,cg>255?255:cg,cb>255?255:cb,255);
+ for (j=0; j<h; j++) blendpixel(vid,x+29-i,y+j,cr>255?255:cr,cg>255?255:cg,cb>255?255:cb,255);
}
}
}
@@ -3090,14 +3090,14 @@ void render_signs(pixel *vid_buf)
drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255);
}
- if(sregexp(signs[i].text, "^{c:[0-9]*|.*}$")==0)
+ if (sregexp(signs[i].text, "^{c:[0-9]*|.*}$")==0)
{
int sldr, startm;
memset(buff, 0, sizeof(buff));
- for(sldr=3; signs[i].text[sldr-1] != '|'; sldr++)
+ for (sldr=3; signs[i].text[sldr-1] != '|'; sldr++)
startm = sldr + 1;
sldr = startm;
- while(signs[i].text[sldr] != '}')
+ while (signs[i].text[sldr] != '}')
{
buff[sldr - startm] = signs[i].text[sldr];
sldr++;
@@ -3106,7 +3106,7 @@ void render_signs(pixel *vid_buf)
}
//Usual text
- if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$"))
+ if (strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$"))
drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255);
x = signs[i].x;