summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-08-19 19:30:53 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-08-19 19:30:53 (GMT)
commitaa01aacebe460e44694a05426a9973f6b21583dd (patch)
tree13c55a1ac2c67d36a1b244c8d5e92887cf5b8cc9 /src
parent2bbfdc72fbb6def95bbe79ece64c849e43d0c001 (diff)
parent7ae7d5fd5659b8df11775cd10f72f327d960f05a (diff)
downloadpowder-aa01aacebe460e44694a05426a9973f6b21583dd.zip
powder-aa01aacebe460e44694a05426a9973f6b21583dd.tar.gz
Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c42
-rw-r--r--src/interface.c4
2 files changed, 21 insertions, 25 deletions
diff --git a/src/graphics.c b/src/graphics.c
index c5f1f55..3c61a08 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -4441,35 +4441,29 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
j=d[p++];
if (j<PT_NUM && j>0)
{
- if (j==PT_STKM)
+ if (j==PT_STKM || j==PT_STKM2)
{
- //Stickman drawing
- for (k=-2; k<=1; k++)
+ pixel lc, hc=PIXRGB(255, 224, 178);
+ if (j==PT_STKM) lc = PIXRGB(255, 255, 255);
+ else lc = PIXRGB(100, 100, 255);
+ //only need to check upper bound of y coord - lower bounds and x<w are checked in draw_line
+ draw_line(fb , x-2, y-2, x+2, y-2, PIXR(lc), PIXG(lc), PIXB(lc), w);
+ if (y+2<h)
{
- 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-2, y+2, x+2, y+2, PIXR(lc), PIXG(lc), PIXB(lc), w);
+ draw_line(fb , x-2, y-2, x-2, y+2, PIXR(lc), PIXG(lc), PIXB(lc), w);
+ draw_line(fb , x+2, y-2, x+2, y+2, PIXR(lc), PIXG(lc), PIXB(lc), 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);
- 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++)
+ if (y+6<h)
+ {
+ draw_line(fb , x, y+3, x-1, y+6, PIXR(hc), PIXG(hc), PIXB(hc), w);
+ draw_line(fb , x, y+3, x+1, y+6, PIXR(hc), PIXG(hc), PIXB(hc), w);
+ }
+ if (y+12<h)
{
- 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-1, y+6, x-3, y+12, PIXR(hc), PIXG(hc), PIXB(hc), w);
+ draw_line(fb , x+1, y+6, x+3, y+12, PIXR(hc), PIXG(hc), PIXB(hc), 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);
- 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;
diff --git a/src/interface.c b/src/interface.c
index 3a5662c..939699b 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -5470,7 +5470,7 @@ void catalogue_ui(pixel * vid_buf)
int listy = 0, listxc;
int listx = 0, listyc;
pixel * vid_buf2;
- float scrollvel, offsetf = 0.0f;
+ float scrollvel = 0.0f, offsetf = 0.0f;
char savetext[128] = "";
char * last = mystrdup("");
savelist_e *saves, *cssave, *csave;
@@ -5687,6 +5687,8 @@ openfin:
if(saves)
free_saveslist(saves);
+ free(last);
+ free(vid_buf2);
return;
}