diff options
| author | Simon <simon@hardwired.org.uk> | 2010-12-19 17:29:30 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2010-12-19 17:29:30 (GMT) |
| commit | e380237cbc87ed97b16955b40807b0f2427818e9 (patch) | |
| tree | 7ca5cf634c1f6dd2034e7e9faedac2fe6d00344e /src/graphics.c | |
| parent | 24e662bc2d1f398962a59de85f993e8fad7190bc (diff) | |
| parent | ee4bb84395f2e8aaa9e9af7080f03d837b0a0344 (diff) | |
| download | powder-e380237cbc87ed97b16955b40807b0f2427818e9.zip powder-e380237cbc87ed97b16955b40807b0f2427818e9.tar.gz | |
Fix merge
Diffstat (limited to 'src/graphics.c')
| -rw-r--r-- | src/graphics.c | 139 |
1 files changed, 124 insertions, 15 deletions
diff --git a/src/graphics.c b/src/graphics.c index 013d875..3ea4c9c 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1402,6 +1402,31 @@ void draw_parts(pixel *vid) isplayer = 1; //It's a secret. Tssss... } + else if(t==PT_STKM2) //Just draw head here + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player2[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player2[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player2[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player2[2]].pcolors; + } + draw_line(vid , nx, ny+3, player2[3], player2[4], 100, 100, 255, s); + draw_line(vid , player2[3], player2[4], player2[7], player2[8], 100, 100, 255, s); + draw_line(vid , nx, ny+3, player2[11], player2[12], 100, 100, 255, s); + draw_line(vid , player2[11], player2[12], player2[15], player2[16], 100, 100, 255, s); + + isplayer2 = 1; //It's a secret. Tssss... + } if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes { if(t==PT_PHOT) @@ -1434,25 +1459,48 @@ void draw_parts(pixel *vid) } else if(cmode==CM_GRAD)//forgot to put else, broke nothing view { - float frequency = 0.05; - int q = parts[i].temp; - cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors); - cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors); - cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors); - if(cr>=255) + if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370) + { + float frequency = 0.00146; + int q = parts[i].temp-473; + cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors); + cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors); + cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors); + if(cr>=255) cr = 255; - if(cg>=255) + if(cg>=255) cg = 255; - if(cb>=255) + if(cb>=255) cb = 255; - if(cr<=0) + if(cr<=0) cr = 0; - if(cg<=0) + if(cg<=0) cg = 0; - if(cb<=0) + if(cb<=0) cb = 0; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } + else + { + float frequency = 0.05; + int q = parts[i].temp-40; + cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors); + cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors); + cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors); + if(cr>=255) + cr = 255; + if(cg>=255) + cg = 255; + if(cb>=255) + cb = 255; + if(cr<=0) + cr = 0; + if(cg<=0) + cg = 0; + if(cb<=0) + cb = 0; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } } else if(t==PT_MWAX&&cmode == CM_FANCY) @@ -1471,7 +1519,7 @@ void draw_parts(pixel *vid) } } - else if(t==PT_CRAC) + else if(t==PT_SPNG) { cr = PIXR(ptypes[t].pcolors) - parts[i].life*15; cg = PIXG(ptypes[t].pcolors) - parts[i].life*15; @@ -1623,7 +1671,28 @@ void draw_parts(pixel *vid) cr = cr>255?255:cr; cg = cg>255?255:cg; cb = cb>255?255:cb; - blendpixel(vid, nx, ny, cr, cg, cb, 255); + if(fabs(parts[i].vx)+fabs(parts[i].vy)>0 &&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) { + fg = 0; + fb = 0; + fr = 0; + fg = cg/40 * fabs(parts[i].vx)+fabs(parts[i].vy); + fb = cb/40 * fabs(parts[i].vx)+fabs(parts[i].vy); + fr = cr/40 * fabs(parts[i].vx)+fabs(parts[i].vy); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(cr, 0, 255), (int)restrict_flt(cg, 0, 255), (int)restrict_flt(cb, 0, 255)); + x = nx/CELL; + y = ny/CELL; + fg += fire_g[y][x]; + if(fg > 255) fg = 255; + fire_g[y][x] = fg; + fb += fire_b[y][x]; + if(fb > 255) fb = 255; + fire_b[y][x] = fb; + fr += fire_r[y][x]; + if(fr > 255) fr = 255; + fire_r[y][x] = fr; + } + else + blendpixel(vid, nx, ny, cr, cg, cb, 255); } else if(t==PT_PIPE) { @@ -2535,6 +2604,31 @@ void draw_parts(pixel *vid) isplayer = 1; //It's a secret. Tssss... } + else if(t==PT_STKM2) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player2[3], player2[4], R, G, B, s); + draw_line(vid , player2[3], player2[4], player2[7], player2[8], R, G, B, s); + draw_line(vid , nx, ny+3, player2[11], player2[12], R, G, B, s); + draw_line(vid , player2[11], player2[12], player2[15], player2[16], R, G, B, s); + + isplayer2 = 1; //It's a secret. Tssss... + } else { vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); @@ -2963,6 +3057,21 @@ pixel *prerender_save(void *save, int size, int *width, int *height) draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); } + else if(j==PT_STKM2) + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } else fb[y*w+x] = ptypes[j].pcolors; } |
