summaryrefslogtreecommitdiff
path: root/src/graphics.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-05-30 02:18:47 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-06-02 19:24:02 (GMT)
commite3ef7f05f00f67906ef75eaac518294ec7622b45 (patch)
tree9c68c8f28b56dd74d669c5f47642e37e09fbcc84 /src/graphics.c
parent469de0cae01e709e527d20cdbd5fb23c09ca5db9 (diff)
downloadpowder-e3ef7f05f00f67906ef75eaac518294ec7622b45.zip
powder-e3ef7f05f00f67906ef75eaac518294ec7622b45.tar.gz
some more deco editor changes. Right click deletes decoration again.
Diffstat (limited to 'src/graphics.c')
-rw-r--r--src/graphics.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 9974720..33560fc 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -3271,7 +3271,7 @@ void draw_walls(pixel *vid)
}
}
-void create_decorations(int x, int y, int rx, int ry, int r, int g, int b)
+void create_decorations(int x, int y, int rx, int ry, int r, int g, int b, int click)
{
int i,j,rp;
if (rx==0 && ry==0)
@@ -3279,7 +3279,10 @@ void create_decorations(int x, int y, int rx, int ry, int r, int g, int b)
rp = pmap[y][x];
if ((rp>>8)>=NPART || !rp)
return;
- parts[rp>>8].dcolour = ((255<<24)|(r<<16)|(g<<8)|b);
+ if (click == 4)
+ parts[rp>>8].dcolour = 0;
+ else
+ parts[rp>>8].dcolour = ((255<<24)|(r<<16)|(g<<8)|b);
return;
}
for (j=-ry; j<=ry; j++)
@@ -3289,10 +3292,13 @@ void create_decorations(int x, int y, int rx, int ry, int r, int g, int b)
rp = pmap[y+j][x+i];
if ((rp>>8)>=NPART || !rp)
continue;
- parts[rp>>8].dcolour = ((255<<24)|(r<<16)|(g<<8)|b);
+ if (click == 4)
+ parts[rp>>8].dcolour = 0;
+ else
+ parts[rp>>8].dcolour = ((255<<24)|(r<<16)|(g<<8)|b);
}
}
-void line_decorations(int x1, int y1, int x2, int y2, int rx, int ry, int r, int g, int b)
+void line_decorations(int x1, int y1, int x2, int y2, int rx, int ry, int r, int g, int b, int click)
{
int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy;
float e, de;
@@ -3326,9 +3332,9 @@ void line_decorations(int x1, int y1, int x2, int y2, int rx, int ry, int r, int
for (x=x1; x<=x2; x++)
{
if (cp)
- create_decorations(y, x, rx, ry, r, g, b);
+ create_decorations(y, x, rx, ry, r, g, b, click);
else
- create_decorations(x, y, rx, ry, r, g, b);
+ create_decorations(x, y, rx, ry, r, g, b, click);
e += de;
if (e >= 0.5f)
{
@@ -3336,15 +3342,15 @@ void line_decorations(int x1, int y1, int x2, int y2, int rx, int ry, int r, int
if (!(rx+ry))
{
if (cp)
- create_decorations(y, x, rx, ry, r, g, b);
+ create_decorations(y, x, rx, ry, r, g, b, click);
else
- create_decorations(x, y, rx, ry, r, g, b);
+ create_decorations(x, y, rx, ry, r, g, b, click);
}
e -= 1.0f;
}
}
}
-void box_decorations(int x1, int y1, int x2, int y2, int r, int g, int b)
+void box_decorations(int x1, int y1, int x2, int y2, int r, int g, int b, int click)
{
int i, j;
if (x1>x2)
@@ -3361,7 +3367,7 @@ void box_decorations(int x1, int y1, int x2, int y2, int r, int g, int b)
}
for (j=y1; j<=y2; j++)
for (i=x1; i<=x2; i++)
- create_decorations(i, j, 0, 0, r, g, b);
+ create_decorations(i, j, 0, 0, r, g, b, click);
}
//draws the photon colors in the HUD