summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-06-16 20:18:10 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-06-25 14:50:07 (GMT)
commita054a784af54e2ca740d046f8bed7f52b71facee (patch)
tree9868319fde0fa5ef46d981a4bb77df442540dd34 /src
parenta12f0b40d18f58377fc355cb3dc605198b0560bb (diff)
downloadpowder-a054a784af54e2ca740d046f8bed7f52b71facee.zip
powder-a054a784af54e2ca740d046f8bed7f52b71facee.tar.gz
Fix soap stamp crashes, and fix stkm head colour
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c22
-rw-r--r--src/main.c2
2 files changed, 15 insertions, 9 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 47bcece..1c40a0e 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1651,6 +1651,7 @@ void draw_parts(pixel *vid)
if (t==PT_STKM) //Just draw head here
{
char buff[10]; //Buffer for HP
+ pixel pc;
if (mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head
{
@@ -1658,13 +1659,15 @@ void draw_parts(pixel *vid)
drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255);
}
+ if ((int)player[2]<PT_NUM) pc = ptypes[(int)player[2]].pcolors;
+ else pc = PIXPACK(0xFFFFFF);
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)player[2]].pcolors;
- vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors;
- vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors;
- vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors;
+ vid[(ny-2)*s+nx+r] = pc;
+ vid[(ny+2)*s+nx+r+1] = pc;
+ vid[(ny+r+1)*s+nx-2] = pc;
+ vid[(ny+r)*s+nx+2] = pc;
}
draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s);
draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s);
@@ -1676,6 +1679,7 @@ void draw_parts(pixel *vid)
else if (t==PT_STKM2) //Just draw head here
{
char buff[10]; //Buffer for HP
+ pixel pc;
if (mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head
{
@@ -1683,13 +1687,15 @@ void draw_parts(pixel *vid)
drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255);
}
+ if ((int)player2[2]<PT_NUM) pc = ptypes[(int)player2[2]].pcolors;
+ else pc = PIXPACK(0xFFFFFF);
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;
+ vid[(ny-2)*s+nx+r] = pc;
+ vid[(ny+2)*s+nx+r+1] = pc;
+ vid[(ny+r+1)*s+nx-2] = pc;
+ vid[(ny+r)*s+nx+2] = pc;
}
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);
diff --git a/src/main.c b/src/main.c
index 34255dd..bfd5c06 100644
--- a/src/main.c
+++ b/src/main.c
@@ -727,7 +727,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
if (j == PT_PHOT)
parts[fp[i]].ctype = 0x3fffffff;
if (j == PT_SOAP)
- parts[k].ctype = 0;
+ parts[fp[i]].ctype = 0;
parts[fp[i]].x = (float)x;
parts[fp[i]].y = (float)y;
m[(x-x0)+(y-y0)*w] = fp[i]+1;