summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-05-28 20:24:07 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-29 12:34:50 (GMT)
commita2c171fbf91e024767ecb8a800a3d7ec13e5d611 (patch)
treea4d5b0644e3c0c6bd5a72249024883cf7ddc17c9 /src
parent6a2f357efd2dac87a4a9f30206717500440d2a76 (diff)
downloadpowder-a2c171fbf91e024767ecb8a800a3d7ec13e5d611.zip
powder-a2c171fbf91e024767ecb8a800a3d7ec13e5d611.tar.gz
Remove remaining references to old decorations buffer
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c33
-rw-r--r--src/interface.c18
-rw-r--r--src/main.c8
3 files changed, 24 insertions, 35 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 7192de9..df94f78 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -3070,7 +3070,8 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112);
blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112);
}
- blendpixel(vid, nx, ny, (parts[i].dcolour>>16)&0xFF, (parts[i].dcolour>>8)&0xFF, (parts[i].dcolour)&0xFF, (parts[i].dcolour>>24)&0xFF);
+ if (decorations_enable)
+ blendpixel(vid, nx, ny, (parts[i].dcolour>>16)&0xFF, (parts[i].dcolour>>8)&0xFF, (parts[i].dcolour)&0xFF, (parts[i].dcolour>>24)&0xFF);
}
#endif
}
@@ -3249,19 +3250,7 @@ void draw_walls(pixel *vid)
}
}
-void draw_decorations(pixel *vid_buf,pixel *decorations)
-{
- /*int i,r,g,b;
- for (i=0; i<(XRES+BARSIZE)*YRES; i++)
- {
- r = (decorations[i]&0xFF0000)>>16;
- g = (decorations[i]&0x00FF00)>>8;
- b = decorations[i]&0x0000FF;
- if (r>0 || g>0 || b>0)
- vid_buf[i] = PIXRGB(r,g,b);
- }*/
-}
-void create_decorations(pixel *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 i,j,rp;
if (rx==0 && ry==0)
@@ -3269,7 +3258,7 @@ void create_decorations(pixel *decorations,int x, int y, int rx, int ry, int r,
rp = pmap[y][x];
if ((rp>>8)>=NPART || !rp)
return;
- parts[rp>>8].dcolour = ((255<<24)|(r<<16)|(g<<8)|b);//decorations[(y)*(XRES+BARSIZE)+(x)] = PIXRGB(r, g, b);
+ parts[rp>>8].dcolour = ((255<<24)|(r<<16)|(g<<8)|b);
return;
}
for (j=-ry; j<=ry; j++)
@@ -3282,7 +3271,7 @@ void create_decorations(pixel *decorations,int x, int y, int rx, int ry, int r,
parts[rp>>8].dcolour = ((255<<24)|(r<<16)|(g<<8)|b);
}
}
-void line_decorations(pixel *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 cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy;
float e, de;
@@ -3316,9 +3305,9 @@ void line_decorations(pixel *decorations,int x1, int y1, int x2, int y2, int rx,
for (x=x1; x<=x2; x++)
{
if (cp)
- create_decorations(decorations,y, x, rx, ry, r, g, b);
+ create_decorations(y, x, rx, ry, r, g, b);
else
- create_decorations(decorations,x, y, rx, ry, r, g, b);
+ create_decorations(x, y, rx, ry, r, g, b);
e += de;
if (e >= 0.5f)
{
@@ -3326,15 +3315,15 @@ void line_decorations(pixel *decorations,int x1, int y1, int x2, int y2, int rx,
if (!(rx+ry))
{
if (cp)
- create_decorations(decorations,y, x, rx, ry, r, g, b);
+ create_decorations(y, x, rx, ry, r, g, b);
else
- create_decorations(decorations,x, y, rx, ry, r, g, b);
+ create_decorations(x, y, rx, ry, r, g, b);
}
e -= 1.0f;
}
}
}
-void box_decorations(pixel *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 i, j;
if (x1>x2)
@@ -3351,7 +3340,7 @@ void box_decorations(pixel *decorations,int x1, int y1, int x2, int y2, int r, i
}
for (j=y1; j<=y2; j++)
for (i=x1; i<=x2; i++)
- create_decorations(decorations,i, j, 0, 0, r, g, b);
+ create_decorations(i, j, 0, 0, r, g, b);
}
//draws the photon colors in the HUD
diff --git a/src/interface.c b/src/interface.c
index c501ddd..f274dc5 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -4334,7 +4334,7 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) {
return NULL;
}
-unsigned int decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy, unsigned int savedColor)
+unsigned int decorations_ui(pixel *vid_buf,int *bsx,int *bsy, unsigned int savedColor)
{//TODO: have the text boxes be editable and update the color. Maybe use 0-360 for H in hsv to fix minor inaccuracies (rgb of 0,0,255 , comes back as 0,3,255)
int i,ss,hh,vv,cr=127,cg=0,cb=0,b = 0,mx,my,bq = 0,j, lb=0,lx=0,ly=0,lm=0,hidden=0;
int window_offset_x_left = 2;
@@ -4401,7 +4401,7 @@ unsigned int decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy,
my /= sdl_scale;
memcpy(vid_buf,old_buf,(XRES+BARSIZE)*(YRES+MENUSIZE)*PIXELSIZE);
- draw_parts(vid_buf);//draw_decorations(vid_buf,decorations);
+ draw_parts(vid_buf);
//ui_edit_process(mx, my, b, &box_R);
//ui_edit_process(mx, my, b, &box_G);
//ui_edit_process(mx, my, b, &box_B);
@@ -4536,7 +4536,11 @@ unsigned int decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy,
}
if(b && !bq && mx >= window_offset_x + 230 && my >= window_offset_y +255+6 && mx <= window_offset_x + 230 +26 && my <= window_offset_y +255+5 +13)
if (confirm_ui(vid_buf, "Reset Decoration Layer", "Do you really want to erase everything?", "Erase") )
- memset(decorations, 0,(XRES+BARSIZE)*YRES*PIXELSIZE);
+ {
+ int i;
+ for (i=0;i<NPART;i++)
+ parts[i].dcolour = 0;
+ }
}
else if (mx > XRES || my > YRES)
{
@@ -4584,7 +4588,7 @@ unsigned int decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy,
}
else if(lb!=3)//while mouse is held down, it draws lines between previous and current positions
{
- line_decorations(decorations,lx, ly, mx, my, *bsx, *bsy, cr, cg, cb);
+ line_decorations(lx, ly, mx, my, *bsx, *bsy, cr, cg, cb);
lx = mx;
ly = my;
}
@@ -4625,7 +4629,7 @@ unsigned int decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy,
}
else //normal click, draw deco
{
- create_decorations(decorations,mx,my,*bsx,*bsy,cr,cg,cb);
+ create_decorations(mx,my,*bsx,*bsy,cr,cg,cb);
lx = mx;
ly = my;
lb = b;
@@ -4644,9 +4648,9 @@ unsigned int decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy,
if (lb && lm) //lm is box/line tool
{
if (lm == 1)//line
- line_decorations(decorations,lx, ly, mx, my, *bsx, *bsy, cr, cg, cb);
+ line_decorations(lx, ly, mx, my, *bsx, *bsy, cr, cg, cb);
else//box
- box_decorations(decorations,lx, ly, mx, my, cr, cg, cb);
+ box_decorations(lx, ly, mx, my, cr, cg, cb);
lm = 0;
}
lb = 0;
diff --git a/src/main.c b/src/main.c
index 446f167..e53c6ae 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1437,8 +1437,7 @@ int main(int argc, char *argv[])
parts[i].life = i+1;
parts[NPART-1].life = -1;
pfree = 0;
-
- decorations = calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
+
pers_bg = calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
fire_bg = calloc(XRES*YRES, PIXELSIZE);
@@ -2173,7 +2172,7 @@ int main(int argc, char *argv[])
}
else
{
- hsvSave = decorations_ui(vid_buf,decorations,&bsx,&bsy,hsvSave);//decoration_mode = !decoration_mode;
+ hsvSave = decorations_ui(vid_buf,&bsx,&bsy,hsvSave);//decoration_mode = !decoration_mode;
decorations_enable = 1;
sys_pause=1;
}
@@ -2470,7 +2469,6 @@ int main(int argc, char *argv[])
}
}
menu_ui_v3(vid_buf, active_menu, &sl, &sr, &dae, b, bq, x, y); //draw the elements in the current menu
- if (decorations_enable) draw_decorations(vid_buf,decorations);
if (zoom_en && x>=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy //change mouse position while it is in a zoom window
&& x<sdl_scale*(zoom_wx+ZFACTOR*ZSIZE)
&& y<sdl_scale*(zoom_wy+ZFACTOR*ZSIZE))
@@ -2825,8 +2823,6 @@ int main(int argc, char *argv[])
isplayer = 0;
ISSPAWN1 = 0;
ISSPAWN2 = 0;
-
- memset(decorations, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
}
if (x>=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476)))
{