summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2010-09-01 10:40:29 (GMT)
committer Simon <simon@hardwired.org.uk>2010-09-01 10:40:29 (GMT)
commitcf85eabee95be1e4947935183d1366cba6f42245 (patch)
tree74169763bd8a27fad15d601110a9579e7f96bbd8
parent75d3e18fbfb3dfb8f757cbe3d36d5953c2621956 (diff)
downloadpowder-cf85eabee95be1e4947935183d1366cba6f42245.zip
powder-cf85eabee95be1e4947935183d1366cba6f42245.tar.gz
Fixed zoom, removed plastic, fixed oil, more moving around. Experimental Neutron behaviour
-rw-r--r--defines.h15
-rw-r--r--graphics.c301
-rw-r--r--graphics.h8
-rw-r--r--interface.c392
-rw-r--r--interface.h10
-rw-r--r--main.c797
-rw-r--r--misc.c74
-rw-r--r--misc.h23
-rw-r--r--powder.c22
-rw-r--r--powder.h164
10 files changed, 904 insertions, 902 deletions
diff --git a/defines.h b/defines.h
index 7a14da2..c38de16 100644
--- a/defines.h
+++ b/defines.h
@@ -32,8 +32,8 @@
#define ZSIZE_D 16
#define ZFACTOR_D 8
-static unsigned char ZFACTOR = 256/ZSIZE_D;
-static unsigned char ZSIZE = ZSIZE_D;
+extern unsigned char ZFACTOR;
+extern unsigned char ZSIZE;
#define CELL 4
#define ISTP (CELL/2)
@@ -63,6 +63,8 @@ typedef unsigned int pixel;
typedef unsigned char uint8;
+extern int amd;
+
extern int legacy_enable;
extern int sys_pause;
@@ -101,4 +103,13 @@ extern unsigned char last_major, last_minor, update_flag;
extern char http_proxy_string[256];
+//Functions in main.c
+void thumb_cache_inval(char *id);
+void thumb_cache_add(char *id, void *thumb, int size);
+int thumb_cache_find(char *id, void **thumb, int *size);
+void *build_thumb(int *size, int bzip2);
+void *build_save(int *size, int x0, int y0, int w, int h);
+int parse_save(void *save, int size, int replace, int x0, int y0);
+void del_stamp(int d);
+void sdl_seticon(void);
#endif \ No newline at end of file
diff --git a/graphics.c b/graphics.c
index ba13d95..fa742be 100644
--- a/graphics.c
+++ b/graphics.c
@@ -1108,8 +1108,8 @@ void xor_rect(pixel *vid, int x, int y, int w, int h)
void draw_parts(pixel *vid)
{
- int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp, pavg;
- float mv, dx, dy, ix, iy, lx, ly, d, pp;
+ int i, x, y, t, nx, ny, r, s;
+ int cr, cg, cb;
float pt = R_TEMP;
for(i = 0; i<NPART; i++){
if(parts[i].type){
@@ -1574,7 +1574,7 @@ void draw_parts(pixel *vid)
}
} else if(t==PT_PLSM)
{
- float ttemp = parts[i].life;
+ float ttemp = (float)parts[i].life;
int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
uint8 R = plasma_data[caddress];
uint8 G = plasma_data[caddress+1];
@@ -1957,4 +1957,299 @@ void render_zoom(pixel *img)
xor_pixel(zoom_x+ZSIZE, zoom_y+j, img);
}
}
+}
+
+pixel *prerender_save(void *save, int size, int *width, int *height)
+{
+ unsigned char *d,*c=save;
+ int i,j,k,x,y,rx,ry,p=0;
+ int bw,bh,w,h;
+ pixel *fb;
+
+ if(size<16)
+ return NULL;
+ if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66)
+ return NULL;
+ if(c[4]>SAVE_VERSION)
+ return NULL;
+
+ bw = c[6];
+ bh = c[7];
+ w = bw*CELL;
+ h = bh*CELL;
+
+ if(c[5]!=CELL)
+ return NULL;
+
+ i = (unsigned)c[8];
+ i |= ((unsigned)c[9])<<8;
+ i |= ((unsigned)c[10])<<16;
+ i |= ((unsigned)c[11])<<24;
+ d = malloc(i);
+ if(!d)
+ return NULL;
+ fb = calloc(w*h, PIXELSIZE);
+ if(!fb)
+ {
+ free(d);
+ return NULL;
+ }
+
+ if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0))
+ goto corrupt;
+ size = i;
+
+ if(size < bw*bh)
+ goto corrupt;
+
+ k = 0;
+ for(y=0; y<bh; y++)
+ for(x=0; x<bw; x++)
+ {
+ rx = x*CELL;
+ ry = y*CELL;
+ switch(d[p])
+ {
+ case 1:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
+ case 2:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
+ case 3:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ if(!(j%2) && !(i%2))
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
+ break;
+ case 4:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
+ k++;
+ break;
+ case 6:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0xFF8080);
+ break;
+ case 7:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ if(!(i&j&1))
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
+ case 8:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ if(!(j%2) && !(i%2))
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
+ else
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
+ }
+ p++;
+ }
+ p += 2*k;
+ if(p>=size)
+ goto corrupt;
+
+ for(y=0; y<h; y++)
+ for(x=0; x<w; x++)
+ {
+ if(p >= size)
+ goto corrupt;
+ j=d[p++];
+ if(j<PT_NUM && j>0)
+ {
+ if(j==PT_STKM) //Stickman should be drawed another way
+ {
+ //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;
+ }
+ }
+
+ free(d);
+ *width = w;
+ *height = h;
+ return fb;
+
+corrupt:
+ free(d);
+ free(fb);
+ return NULL;
+}
+
+int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl)
+{
+ unsigned char *d,*c=thumb;
+ int i,j,x,y,a,t,r,g,b,sx,sy;
+
+ if(bzip2)
+ {
+ if(size<16)
+ return 1;
+ if(c[3]!=0x74 || c[2]!=0x49 || c[1]!=0x68 || c[0]!=0x53)
+ return 1;
+ if(c[4]>PT_NUM)
+ return 2;
+ if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL)
+ return 3;
+ i = XRES*YRES;
+ d = malloc(i);
+ if(!d)
+ return 1;
+
+ if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0))
+ return 1;
+ size = i;
+ }
+ else
+ d = c;
+
+ if(size < XRES*YRES)
+ {
+ if(bzip2)
+ free(d);
+ return 1;
+ }
+
+ sy = 0;
+ for(y=0; y+scl<=YRES; y+=scl)
+ {
+ sx = 0;
+ for(x=0; x+scl<=XRES; x+=scl)
+ {
+ a = 0;
+ r = g = b = 0;
+ for(j=0; j<scl; j++)
+ for(i=0; i<scl; i++)
+ {
+ t = d[(y+j)*XRES+(x+i)];
+ if(t==0xFF)
+ {
+ r += 256;
+ g += 256;
+ b += 256;
+ a += 2;
+ }
+ else if(t)
+ {
+ if(t>=PT_NUM)
+ goto corrupt;
+ r += PIXR(ptypes[t].pcolors);
+ g += PIXG(ptypes[t].pcolors);
+ b += PIXB(ptypes[t].pcolors);
+ a ++;
+ }
+ }
+ if(a)
+ {
+ a = 256/a;
+ r = (r*a)>>8;
+ g = (g*a)>>8;
+ b = (b*a)>>8;
+ }
+
+ drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255);
+ sx++;
+ }
+ sy++;
+ }
+
+ if(bzip2)
+ free(d);
+ return 0;
+
+corrupt:
+ if(bzip2)
+ free(d);
+ return 1;
+}
+
+void render_cursor(pixel *vid, int x, int y, int t, int r)
+{
+ int i,j,c;
+ if(t<PT_NUM||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM)
+ {
+ if(r<=0)
+ xor_pixel(x, y, vid);
+ else
+ for(j=0; j<=r; j++)
+ for(i=0; i<=r; i++)
+ if(i*i+j*j<=r*r && ((i+1)*(i+1)+j*j>r*r || i*i+(j+1)*(j+1)>r*r))
+ {
+ xor_pixel(x+i, y+j, vid);
+ if(j) xor_pixel(x+i, y-j, vid);
+ if(i) xor_pixel(x-i, y+j, vid);
+ if(i&&j) xor_pixel(x-i, y-j, vid);
+ }
+ }
+ else
+ {
+ int tc;
+ c = (r/CELL) * CELL;
+ x = (x/CELL) * CELL;
+ y = (y/CELL) * CELL;
+
+ tc = !((c%(CELL*2))==0);
+
+ x -= c/2;
+ y -= c/2;
+
+ x += tc*(CELL/2);
+ y += tc*(CELL/2);
+
+ for(i=0; i<CELL+c; i++)
+ {
+ xor_pixel(x+i, y, vid);
+ xor_pixel(x+i, y+CELL+c-1, vid);
+ }
+ for(i=1; i<CELL+c-1; i++)
+ {
+ xor_pixel(x, y+i, vid);
+ xor_pixel(x+CELL+c-1, y+i, vid);
+ }
+ }
+}
+
+void sdl_open(void)
+{
+ if(SDL_Init(SDL_INIT_VIDEO)<0)
+ {
+ fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError());
+ exit(1);
+ }
+ atexit(SDL_Quit);
+#ifdef PIX16
+ sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE);
+#else
+ sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE);
+#endif
+ if(!sdl_scrn)
+ {
+ fprintf(stderr, "Creating window: %s\n", SDL_GetError());
+ exit(1);
+ }
+ SDL_WM_SetCaption("The Powder Toy", "Powder Toy");
+ sdl_seticon();
+ SDL_EnableUNICODE(1);
+ //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
} \ No newline at end of file
diff --git a/graphics.h b/graphics.h
index a4015e2..8e48d52 100644
--- a/graphics.h
+++ b/graphics.h
@@ -127,4 +127,12 @@ void dim_copy(pixel *dst, pixel *src);
void render_zoom(pixel *img);
+pixel *prerender_save(void *save, int size, int *width, int *height);
+
+int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl);
+
+void render_cursor(pixel *vid, int x, int y, int t, int r);
+
+void sdl_open(void);
+
#endif \ No newline at end of file
diff --git a/interface.c b/interface.c
index 9a3fe4c..f6ef749 100644
--- a/interface.c
+++ b/interface.c
@@ -3,6 +3,7 @@
#include <string.h>
#include <bzlib.h>
#include <math.h>
+#include <time.h>
#include "http.h"
#include "md5.h"
#include "font.h"
@@ -56,6 +57,8 @@ int Z_keysym = 'z';
int zoom_en = 0;
int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2;
int zoom_wx=0, zoom_wy=0;
+unsigned char ZFACTOR = 256/ZSIZE_D;
+unsigned char ZSIZE = ZSIZE_D;
void menu_count(void)
{
@@ -2427,4 +2430,393 @@ finish:
strcpy(search_expr, ed.str);
return 0;
+}
+
+int search_results(char *str, int votes)
+{
+ int i,j;
+ char *p,*q,*r,*s,*vu,*vd,*pu;
+
+ for(i=0; i<GRID_X*GRID_Y; i++)
+ {
+ if(search_ids[i])
+ {
+ free(search_ids[i]);
+ search_ids[i] = NULL;
+ }
+ if(search_names[i])
+ {
+ free(search_names[i]);
+ search_names[i] = NULL;
+ }
+ if(search_owners[i])
+ {
+ free(search_owners[i]);
+ search_owners[i] = NULL;
+ }
+ if(search_thumbs[i])
+ {
+ free(search_thumbs[i]);
+ search_thumbs[i] = NULL;
+ search_thsizes[i] = 0;
+ }
+ }
+ for(j=0; j<TAG_MAX; j++)
+ if(tag_names[j])
+ {
+ free(tag_names[j]);
+ tag_names[j] = NULL;
+ }
+
+ if(!str || !*str)
+ return 0;
+
+ i = 0;
+ j = 0;
+ s = NULL;
+ do_open = 0;
+ while(1)
+ {
+ if(!*str)
+ break;
+ p = strchr(str, '\n');
+ if(!p)
+ p = str + strlen(str);
+ else
+ *(p++) = 0;
+ if(!strncmp(str, "OPEN ", 5))
+ {
+ do_open = 1;
+ if(i>=GRID_X*GRID_Y)
+ break;
+ if(votes)
+ {
+ pu = strchr(str+5, ' ');
+ if(!pu)
+ return i;
+ *(pu++) = 0;
+ s = strchr(pu, ' ');
+ if(!s)
+ return i;
+ *(s++) = 0;
+ vu = strchr(s, ' ');
+ if(!vu)
+ return i;
+ *(vu++) = 0;
+ vd = strchr(vu, ' ');
+ if(!vd)
+ return i;
+ *(vd++) = 0;
+ q = strchr(vd, ' ');
+ }
+ else
+ {
+ pu = strchr(str+5, ' ');
+ if(!pu)
+ return i;
+ *(pu++) = 0;
+ vu = strchr(pu, ' ');
+ if(!vu)
+ return i;
+ *(vu++) = 0;
+ vd = strchr(vu, ' ');
+ if(!vd)
+ return i;
+ *(vd++) = 0;
+ q = strchr(vd, ' ');
+ }
+ if(!q)
+ return i;
+ *(q++) = 0;
+ r = strchr(q, ' ');
+ if(!r)
+ return i;
+ *(r++) = 0;
+ search_ids[i] = mystrdup(str+5);
+
+ search_publish[i] = atoi(pu);
+ search_scoreup[i] = atoi(vu);
+ search_scoredown[i] = atoi(vd);
+
+ search_owners[i] = mystrdup(q);
+ search_names[i] = mystrdup(r);
+
+ if(s)
+ search_votes[i] = atoi(s);
+ thumb_cache_find(str, search_thumbs+i, search_thsizes+i);
+ i++;
+ }
+ else if(!strncmp(str, "TAG ", 4))
+ {
+ if(j >= TAG_MAX)
+ {
+ str = p;
+ continue;
+ }
+ q = strchr(str+4, ' ');
+ if(!q)
+ {
+ str = p;
+ continue;
+ }
+ *(q++) = 0;
+ tag_names[j] = mystrdup(str+4);
+ tag_votes[j] = atoi(q);
+ j++;
+ }
+ else
+ {
+ if(i>=GRID_X*GRID_Y)
+ break;
+ if(votes)
+ {
+ pu = strchr(str, ' ');
+ if(!pu)
+ return i;
+ *(pu++) = 0;
+ s = strchr(pu, ' ');
+ if(!s)
+ return i;
+ *(s++) = 0;
+ vu = strchr(s, ' ');
+ if(!vu)
+ return i;
+ *(vu++) = 0;
+ vd = strchr(vu, ' ');
+ if(!vd)
+ return i;
+ *(vd++) = 0;
+ q = strchr(vd, ' ');
+ }
+ else
+ {
+ pu = strchr(str, ' ');
+ if(!pu)
+ return i;
+ *(pu++) = 0;
+ vu = strchr(pu, ' ');
+ if(!vu)
+ return i;
+ *(vu++) = 0;
+ vd = strchr(vu, ' ');
+ if(!vd)
+ return i;
+ *(vd++) = 0;
+ q = strchr(vd, ' ');
+ }
+ if(!q)
+ return i;
+ *(q++) = 0;
+ r = strchr(q, ' ');
+ if(!r)
+ return i;
+ *(r++) = 0;
+ search_ids[i] = mystrdup(str);
+
+ search_publish[i] = atoi(pu);
+ search_scoreup[i] = atoi(vu);
+ search_scoredown[i] = atoi(vd);
+
+ search_owners[i] = mystrdup(q);
+ search_names[i] = mystrdup(r);
+
+ if(s)
+ search_votes[i] = atoi(s);
+ thumb_cache_find(str, search_thumbs+i, search_thsizes+i);
+ i++;
+ }
+ str = p;
+ }
+ if(*str)
+ i++;
+ return i;
+}
+
+int execute_tagop(pixel *vid_buf, char *op, char *tag)
+{
+ int status;
+ char *result;
+
+ char *names[] = {"ID", "Tag", NULL};
+ char *parts[2];
+
+ char *uri = malloc(strlen(SERVER)+strlen(op)+36);
+ sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op);
+
+ parts[0] = svf_id;
+ parts[1] = tag;
+
+ result = http_multipart_post(
+ uri,
+ names, parts, NULL,
+ svf_user, svf_pass,
+ &status, NULL);
+
+ free(uri);
+
+ if(status!=200)
+ {
+ error_ui(vid_buf, status, http_ret_text(status));
+ if(result)
+ free(result);
+ return 1;
+ }
+ if(result && strncmp(result, "OK", 2))
+ {
+ error_ui(vid_buf, 0, result);
+ free(result);
+ return 1;
+ }
+
+ if(result[2])
+ {
+ strncpy(svf_tags, result+3, 255);
+ svf_id[15] = 0;
+ }
+
+ if(result)
+ free(result);
+
+ return 0;
+}
+
+void execute_save(pixel *vid_buf)
+{
+ int status;
+ char *result;
+
+ char *names[] = {"Name", "Data:save.bin", "Thumb:thumb.bin", "Publish", "ID", NULL};
+ char *parts[5];
+ int plens[5];
+
+ parts[0] = svf_name;
+ plens[0] = strlen(svf_name);
+ parts[1] = build_save(plens+1, 0, 0, XRES, YRES);
+ parts[2] = build_thumb(plens+2, 1);
+ parts[3] = (svf_publish==1)?"Public":"Private";
+ plens[3] = strlen((svf_publish==1)?"Public":"Private");
+
+ if(svf_id[0])
+ {
+ parts[4] = svf_id;
+ plens[4] = strlen(svf_id);
+ }
+ else
+ names[4] = NULL;
+
+ result = http_multipart_post(
+ "http://" SERVER "/Save.api",
+ names, parts, plens,
+ svf_user, svf_pass,
+ &status, NULL);
+
+ if(svf_last)
+ free(svf_last);
+ svf_last = parts[1];
+ svf_lsize = plens[1];
+
+ free(parts[2]);
+
+ if(status!=200)
+ {
+ error_ui(vid_buf, status, http_ret_text(status));
+ if(result)
+ free(result);
+ return;
+ }
+ if(result && strncmp(result, "OK", 2))
+ {
+ error_ui(vid_buf, 0, result);
+ free(result);
+ return;
+ }
+
+ if(result[2])
+ {
+ strncpy(svf_id, result+3, 15);
+ svf_id[15] = 0;
+ }
+
+ if(!svf_id[0])
+ {
+ error_ui(vid_buf, 0, "No ID supplied by server");
+ free(result);
+ return;
+ }
+
+ thumb_cache_inval(svf_id);
+
+ svf_own = 1;
+ if(result)
+ free(result);
+}
+
+void execute_delete(pixel *vid_buf, char *id)
+{
+ int status;
+ char *result;
+
+ char *names[] = {"ID", NULL};
+ char *parts[1];
+
+ parts[0] = id;
+
+ result = http_multipart_post(
+ "http://" SERVER "/Delete.api",
+ names, parts, NULL,
+ svf_user, svf_pass,
+ &status, NULL);
+
+ if(status!=200)
+ {
+ error_ui(vid_buf, status, http_ret_text(status));
+ if(result)
+ free(result);
+ return;
+ }
+ if(result && strncmp(result, "OK", 2))
+ {
+ error_ui(vid_buf, 0, result);
+ free(result);
+ return;
+ }
+
+ if(result)
+ free(result);
+}
+
+int execute_vote(pixel *vid_buf, char *id, char *action)
+{
+ int status;
+ char *result;
+
+ char *names[] = {"ID", "Action", NULL};
+ char *parts[2];
+
+ parts[0] = id;
+ parts[1] = action;
+
+ result = http_multipart_post(
+ "http://" SERVER "/Vote.api",
+ names, parts, NULL,
+ svf_user, svf_pass,
+ &status, NULL);
+
+ if(status!=200)
+ {
+ error_ui(vid_buf, status, http_ret_text(status));
+ if(result)
+ free(result);
+ return 0;
+ }
+ if(result && strncmp(result, "OK", 2))
+ {
+ error_ui(vid_buf, 0, result);
+ free(result);
+ return 0;
+ }
+
+ if(result)
+ free(result);
+ return 1;
} \ No newline at end of file
diff --git a/interface.h b/interface.h
index 76536eb..7910c66 100644
--- a/interface.h
+++ b/interface.h
@@ -168,5 +168,15 @@ char *download_ui(pixel *vid_buf, char *uri, int *len);
int search_ui(pixel *vid_buf);
+int search_results(char *str, int votes);
+
+int execute_tagop(pixel *vid_buf, char *op, char *tag);
+
+void execute_save(pixel *vid_buf);
+
+void execute_delete(pixel *vid_buf, char *id);
+
+int execute_vote(pixel *vid_buf, char *id, char *action);
+
#endif
diff --git a/main.c b/main.c
index 1d818a8..7d20ff2 100644
--- a/main.c
+++ b/main.c
@@ -102,10 +102,6 @@ int amd = 1;
sign signs[MAXSIGNS];
-/***********************************************************
- * AIR FLOW SIMULATOR *
- ***********************************************************/
-
int numCores = 4;
int core_count()
@@ -133,18 +129,8 @@ int core_count()
return numCPU;
}
-/***********************************************************
- * PARTICLE SIMULATOR *
- ***********************************************************/
int mousex, mousey = 0; //They contain mouse position
-
-
-
-/***********************************************************
- * SDL OUTPUT *
- ***********************************************************/
-
void sdl_seticon(void)
{
#ifdef WIN32
@@ -161,30 +147,6 @@ void sdl_seticon(void)
#endif
}
-void sdl_open(void)
-{
- if(SDL_Init(SDL_INIT_VIDEO)<0)
- {
- fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError());
- exit(1);
- }
- atexit(SDL_Quit);
-#ifdef PIX16
- sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE);
-#else
- sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE);
-#endif
- if(!sdl_scrn)
- {
- fprintf(stderr, "Creating window: %s\n", SDL_GetError());
- exit(1);
- }
- SDL_WM_SetCaption("The Powder Toy", "Powder Toy");
- sdl_seticon();
- SDL_EnableUNICODE(1);
- //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
-}
-
int frame_idx=0;
void dump_frame(pixel *src, int w, int h, int pitch)
{
@@ -265,93 +227,6 @@ void *build_thumb(int *size, int bzip2)
return d;
}
-int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl)
-{
- unsigned char *d,*c=thumb;
- int i,j,x,y,a,t,r,g,b,sx,sy;
-
- if(bzip2)
- {
- if(size<16)
- return 1;
- if(c[3]!=0x74 || c[2]!=0x49 || c[1]!=0x68 || c[0]!=0x53)
- return 1;
- if(c[4]>PT_NUM)
- return 2;
- if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL)
- return 3;
- i = XRES*YRES;
- d = malloc(i);
- if(!d)
- return 1;
-
- if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0))
- return 1;
- size = i;
- }
- else
- d = c;
-
- if(size < XRES*YRES)
- {
- if(bzip2)
- free(d);
- return 1;
- }
-
- sy = 0;
- for(y=0; y+scl<=YRES; y+=scl)
- {
- sx = 0;
- for(x=0; x+scl<=XRES; x+=scl)
- {
- a = 0;
- r = g = b = 0;
- for(j=0; j<scl; j++)
- for(i=0; i<scl; i++)
- {
- t = d[(y+j)*XRES+(x+i)];
- if(t==0xFF)
- {
- r += 256;
- g += 256;
- b += 256;
- a += 2;
- }
- else if(t)
- {
- if(t>=PT_NUM)
- goto corrupt;
- r += PIXR(ptypes[t].pcolors);
- g += PIXG(ptypes[t].pcolors);
- b += PIXB(ptypes[t].pcolors);
- a ++;
- }
- }
- if(a)
- {
- a = 256/a;
- r = (r*a)>>8;
- g = (g*a)>>8;
- b = (b*a)>>8;
- }
-
- drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255);
- sx++;
- }
- sy++;
- }
-
- if(bzip2)
- free(d);
- return 0;
-
-corrupt:
- if(bzip2)
- free(d);
- return 1;
-}
-
void *build_save(int *size, int x0, int y0, int w, int h)
{
unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c;
@@ -788,144 +663,6 @@ corrupt:
return 1;
}
-pixel *prerender_save(void *save, int size, int *width, int *height)
-{
- unsigned char *d,*c=save;
- int i,j,k,x,y,rx,ry,p=0;
- int bw,bh,w,h;
- pixel *fb;
-
- if(size<16)
- return NULL;
- if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66)
- return NULL;
- if(c[4]>SAVE_VERSION)
- return NULL;
-
- bw = c[6];
- bh = c[7];
- w = bw*CELL;
- h = bh*CELL;
-
- if(c[5]!=CELL)
- return NULL;
-
- i = (unsigned)c[8];
- i |= ((unsigned)c[9])<<8;
- i |= ((unsigned)c[10])<<16;
- i |= ((unsigned)c[11])<<24;
- d = malloc(i);
- if(!d)
- return NULL;
- fb = calloc(w*h, PIXELSIZE);
- if(!fb)
- {
- free(d);
- return NULL;
- }
-
- if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0))
- goto corrupt;
- size = i;
-
- if(size < bw*bh)
- goto corrupt;
-
- k = 0;
- for(y=0; y<bh; y++)
- for(x=0; x<bw; x++)
- {
- rx = x*CELL;
- ry = y*CELL;
- switch(d[p])
- {
- case 1:
- for(j=0; j<CELL; j++)
- for(i=0; i<CELL; i++)
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
- break;
- case 2:
- for(j=0; j<CELL; j+=2)
- for(i=(j>>1)&1; i<CELL; i+=2)
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
- break;
- case 3:
- for(j=0; j<CELL; j++)
- for(i=0; i<CELL; i++)
- if(!(j%2) && !(i%2))
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
- break;
- case 4:
- for(j=0; j<CELL; j+=2)
- for(i=(j>>1)&1; i<CELL; i+=2)
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
- k++;
- break;
- case 6:
- for(j=0; j<CELL; j+=2)
- for(i=(j>>1)&1; i<CELL; i+=2)
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0xFF8080);
- break;
- case 7:
- for(j=0; j<CELL; j++)
- for(i=0; i<CELL; i++)
- if(!(i&j&1))
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
- break;
- case 8:
- for(j=0; j<CELL; j++)
- for(i=0; i<CELL; i++)
- if(!(j%2) && !(i%2))
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
- else
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
- break;
- }
- p++;
- }
- p += 2*k;
- if(p>=size)
- goto corrupt;
-
- for(y=0; y<h; y++)
- for(x=0; x<w; x++)
- {
- if(p >= size)
- goto corrupt;
- j=d[p++];
- if(j<PT_NUM && j>0)
- {
- if(j==PT_STKM) //Stickman should be drawed another way
- {
- //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;
- }
- }
-
- free(d);
- *width = w;
- *height = h;
- return fb;
-
-corrupt:
- free(d);
- free(fb);
- return NULL;
-}
-
// stamps library
stamp stamps[STAMP_MAX];//[STAMP_X*STAMP_Y];
@@ -948,27 +685,6 @@ void stamp_gen_name(char *fn)
sprintf(fn, "%08x%02x", last_time, last_name);
}
-void *file_load(char *fn, int *size)
-{
- FILE *f = fopen(fn, "rb");
- void *s;
-
- if(!f)
- return NULL;
- fseek(f, 0, SEEK_END);
- *size = ftell(f);
- fseek(f, 0, SEEK_SET);
- s = malloc(*size);
- if(!s)
- {
- fclose(f);
- return NULL;
- }
- fread(s, *size, 1, f);
- fclose(f);
- return s;
-}
-
void stamp_update(void)
{
FILE *f;
@@ -1118,222 +834,8 @@ void del_stamp(int d)
stamp_init();
}
-int execute_tagop(pixel *vid_buf, char *op, char *tag)
-{
- int status;
- char *result;
-
- char *names[] = {"ID", "Tag", NULL};
- char *parts[2];
-
- char *uri = malloc(strlen(SERVER)+strlen(op)+36);
- sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op);
-
- parts[0] = svf_id;
- parts[1] = tag;
-
- result = http_multipart_post(
- uri,
- names, parts, NULL,
- svf_user, svf_pass,
- &status, NULL);
-
- free(uri);
-
- if(status!=200)
- {
- error_ui(vid_buf, status, http_ret_text(status));
- if(result)
- free(result);
- return 1;
- }
- if(result && strncmp(result, "OK", 2))
- {
- error_ui(vid_buf, 0, result);
- free(result);
- return 1;
- }
-
- if(result[2])
- {
- strncpy(svf_tags, result+3, 255);
- svf_id[15] = 0;
- }
-
- if(result)
- free(result);
-
- return 0;
-}
-
void thumb_cache_inval(char *id);
-void execute_save(pixel *vid_buf)
-{
- int status;
- char *result;
-
- char *names[] = {"Name", "Data:save.bin", "Thumb:thumb.bin", "Publish", "ID", NULL};
- char *parts[5];
- int plens[5];
-
- parts[0] = svf_name;
- plens[0] = strlen(svf_name);
- parts[1] = build_save(plens+1, 0, 0, XRES, YRES);
- parts[2] = build_thumb(plens+2, 1);
- parts[3] = (svf_publish==1)?"Public":"Private";
- plens[3] = strlen((svf_publish==1)?"Public":"Private");
-
- if(svf_id[0])
- {
- parts[4] = svf_id;
- plens[4] = strlen(svf_id);
- }
- else
- names[4] = NULL;
-
- result = http_multipart_post(
- "http://" SERVER "/Save.api",
- names, parts, plens,
- svf_user, svf_pass,
- &status, NULL);
-
- if(svf_last)
- free(svf_last);
- svf_last = parts[1];
- svf_lsize = plens[1];
-
- free(parts[2]);
-
- if(status!=200)
- {
- error_ui(vid_buf, status, http_ret_text(status));
- if(result)
- free(result);
- return;
- }
- if(result && strncmp(result, "OK", 2))
- {
- error_ui(vid_buf, 0, result);
- free(result);
- return;
- }
-
- if(result[2])
- {
- strncpy(svf_id, result+3, 15);
- svf_id[15] = 0;
- }
-
- if(!svf_id[0])
- {
- error_ui(vid_buf, 0, "No ID supplied by server");
- free(result);
- return;
- }
-
- thumb_cache_inval(svf_id);
-
- svf_own = 1;
- if(result)
- free(result);
-}
-
-void execute_delete(pixel *vid_buf, char *id)
-{
- int status;
- char *result;
-
- char *names[] = {"ID", NULL};
- char *parts[1];
-
- parts[0] = id;
-
- result = http_multipart_post(
- "http://" SERVER "/Delete.api",
- names, parts, NULL,
- svf_user, svf_pass,
- &status, NULL);
-
- if(status!=200)
- {
- error_ui(vid_buf, status, http_ret_text(status));
- if(result)
- free(result);
- return;
- }
- if(result && strncmp(result, "OK", 2))
- {
- error_ui(vid_buf, 0, result);
- free(result);
- return;
- }
-
- if(result)
- free(result);
-}
-
-int execute_vote(pixel *vid_buf, char *id, char *action)
-{
- int status;
- char *result;
-
- char *names[] = {"ID", "Action", NULL};
- char *parts[2];
-
- parts[0] = id;
- parts[1] = action;
-
- result = http_multipart_post(
- "http://" SERVER "/Vote.api",
- names, parts, NULL,
- svf_user, svf_pass,
- &status, NULL);
-
- if(status!=200)
- {
- error_ui(vid_buf, status, http_ret_text(status));
- if(result)
- free(result);
- return 0;
- }
- if(result && strncmp(result, "OK", 2))
- {
- error_ui(vid_buf, 0, result);
- free(result);
- return 0;
- }
-
- if(result)
- free(result);
- return 1;
-}
-
-static char hex[] = "0123456789ABCDEF";
-
-void strcaturl(char *dst, char *src)
-{
- char *d;
- unsigned char *s;
-
- for(d=dst; *d; d++) ;
-
- for(s=(unsigned char *)src; *s; s++)
- {
- if((*s>='0' && *s<='9') ||
- (*s>='a' && *s<='z') ||
- (*s>='A' && *s<='Z'))
- *(d++) = *s;
- else
- {
- *(d++) = '%';
- *(d++) = hex[*s>>4];
- *(d++) = hex[*s&15];
- }
- }
- *d = 0;
-}
-
char *thumb_cache_id[THUMB_CACHE_SIZE];
void *thumb_cache_data[THUMB_CACHE_SIZE];
int thumb_cache_size[THUMB_CACHE_SIZE];
@@ -1399,309 +901,10 @@ int thumb_cache_find(char *id, void **thumb, int *size)
return 1;
}
-int search_results(char *str, int votes)
-{
- int i,j;
- char *p,*q,*r,*s,*vu,*vd,*pu;
-
- for(i=0; i<GRID_X*GRID_Y; i++)
- {
- if(search_ids[i])
- {
- free(search_ids[i]);
- search_ids[i] = NULL;
- }
- if(search_names[i])
- {
- free(search_names[i]);
- search_names[i] = NULL;
- }
- if(search_owners[i])
- {
- free(search_owners[i]);
- search_owners[i] = NULL;
- }
- if(search_thumbs[i])
- {
- free(search_thumbs[i]);
- search_thumbs[i] = NULL;
- search_thsizes[i] = 0;
- }
- }
- for(j=0; j<TAG_MAX; j++)
- if(tag_names[j])
- {
- free(tag_names[j]);
- tag_names[j] = NULL;
- }
-
- if(!str || !*str)
- return 0;
-
- i = 0;
- j = 0;
- s = NULL;
- do_open = 0;
- while(1)
- {
- if(!*str)
- break;
- p = strchr(str, '\n');
- if(!p)
- p = str + strlen(str);
- else
- *(p++) = 0;
- if(!strncmp(str, "OPEN ", 5))
- {
- do_open = 1;
- if(i>=GRID_X*GRID_Y)
- break;
- if(votes)
- {
- pu = strchr(str+5, ' ');
- if(!pu)
- return i;
- *(pu++) = 0;
- s = strchr(pu, ' ');
- if(!s)
- return i;
- *(s++) = 0;
- vu = strchr(s, ' ');
- if(!vu)
- return i;
- *(vu++) = 0;
- vd = strchr(vu, ' ');
- if(!vd)
- return i;
- *(vd++) = 0;
- q = strchr(vd, ' ');
- }
- else
- {
- pu = strchr(str+5, ' ');
- if(!pu)
- return i;
- *(pu++) = 0;
- vu = strchr(pu, ' ');
- if(!vu)
- return i;
- *(vu++) = 0;
- vd = strchr(vu, ' ');
- if(!vd)
- return i;
- *(vd++) = 0;
- q = strchr(vd, ' ');
- }
- if(!q)
- return i;
- *(q++) = 0;
- r = strchr(q, ' ');
- if(!r)
- return i;
- *(r++) = 0;
- search_ids[i] = mystrdup(str+5);
-
- search_publish[i] = atoi(pu);
- search_scoreup[i] = atoi(vu);
- search_scoredown[i] = atoi(vd);
-
- search_owners[i] = mystrdup(q);
- search_names[i] = mystrdup(r);
-
- if(s)
- search_votes[i] = atoi(s);
- thumb_cache_find(str, search_thumbs+i, search_thsizes+i);
- i++;
- }
- else if(!strncmp(str, "TAG ", 4))
- {
- if(j >= TAG_MAX)
- {
- str = p;
- continue;
- }
- q = strchr(str+4, ' ');
- if(!q)
- {
- str = p;
- continue;
- }
- *(q++) = 0;
- tag_names[j] = mystrdup(str+4);
- tag_votes[j] = atoi(q);
- j++;
- }
- else
- {
- if(i>=GRID_X*GRID_Y)
- break;
- if(votes)
- {
- pu = strchr(str, ' ');
- if(!pu)
- return i;
- *(pu++) = 0;
- s = strchr(pu, ' ');
- if(!s)
- return i;
- *(s++) = 0;
- vu = strchr(s, ' ');
- if(!vu)
- return i;
- *(vu++) = 0;
- vd = strchr(vu, ' ');
- if(!vd)
- return i;
- *(vd++) = 0;
- q = strchr(vd, ' ');
- }
- else
- {
- pu = strchr(str, ' ');
- if(!pu)
- return i;
- *(pu++) = 0;
- vu = strchr(pu, ' ');
- if(!vu)
- return i;
- *(vu++) = 0;
- vd = strchr(vu, ' ');
- if(!vd)
- return i;
- *(vd++) = 0;
- q = strchr(vd, ' ');
- }
- if(!q)
- return i;
- *(q++) = 0;
- r = strchr(q, ' ');
- if(!r)
- return i;
- *(r++) = 0;
- search_ids[i] = mystrdup(str);
-
- search_publish[i] = atoi(pu);
- search_scoreup[i] = atoi(vu);
- search_scoredown[i] = atoi(vd);
-
- search_owners[i] = mystrdup(q);
- search_names[i] = mystrdup(r);
-
- if(s)
- search_votes[i] = atoi(s);
- thumb_cache_find(str, search_thumbs+i, search_thsizes+i);
- i++;
- }
- str = p;
- }
- if(*str)
- i++;
- return i;
-}
-
-/***********************************************************
- * MESSAGE SIGNS *
- ***********************************************************/
-
-/***********************************************************
- * CONFIG FILE *
- ***********************************************************/
-
char http_proxy_string[256] = "";
unsigned char last_major=0, last_minor=0, update_flag=0;
-void render_cursor(pixel *vid, int x, int y, int t, int r)
-{
- int i,j,c;
- if(t<PT_NUM||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM)
- {
- if(r<=0)
- xor_pixel(x, y, vid);
- else
- for(j=0; j<=r; j++)
- for(i=0; i<=r; i++)
- if(i*i+j*j<=r*r && ((i+1)*(i+1)+j*j>r*r || i*i+(j+1)*(j+1)>r*r))
- {
- xor_pixel(x+i, y+j, vid);
- if(j) xor_pixel(x+i, y-j, vid);
- if(i) xor_pixel(x-i, y+j, vid);
- if(i&&j) xor_pixel(x-i, y-j, vid);
- }
- }
- else
- {
- int tc;
- c = (r/CELL) * CELL;
- x = (x/CELL) * CELL;
- y = (y/CELL) * CELL;
-
- tc = !((c%(CELL*2))==0);
-
- x -= c/2;
- y -= c/2;
-
- x += tc*(CELL/2);
- y += tc*(CELL/2);
-
- for(i=0; i<CELL+c; i++)
- {
- xor_pixel(x+i, y, vid);
- xor_pixel(x+i, y+CELL+c-1, vid);
- }
- for(i=1; i<CELL+c-1; i++)
- {
- xor_pixel(x, y+i, vid);
- xor_pixel(x+CELL+c-1, y+i, vid);
- }
- }
-}
-
-#ifdef WIN32
-#define x86_cpuid(func,af,bf,cf,df) \
- do {\
- __asm mov eax, func\
- __asm cpuid\
- __asm mov af, eax\
- __asm mov bf, ebx\
- __asm mov cf, ecx\
- __asm mov df, edx\
- } while(0)
-#else
-#define x86_cpuid(func,af,bf,cf,df) \
-__asm__ __volatile ("cpuid":\
- "=a" (af), "=b" (bf), "=c" (cf), "=d" (df) : "a" (func));
-#endif
-
-
-int cpu_check(void)
-{
-#ifdef MACOSX
- return 0;
-#else
-#ifdef X86
- unsigned af,bf,cf,df;
- x86_cpuid(0, af, bf, cf, df);
- if(bf==0x68747541 && cf==0x444D4163 && df==0x69746E65)
- amd = 1;
- x86_cpuid(1, af, bf, cf, df);
-#ifdef X86_SSE
- if(!(df&(1<<25)))
- return 1;
-#endif
-#ifdef X86_SSE2
- if(!(df&(1<<26)))
- return 1;
-#endif
-#ifdef X86_SSE3
- if(!(cf&1))
- return 1;
-#endif
-#endif
-#endif
- return 0;
-}
-
char *tag = "(c) 2008-9 Stanislaw Skowronek";
int itc = 0;
char itc_msg[64] = "[?]";
diff --git a/misc.c b/misc.c
index d45c910..e32ec7e 100644
--- a/misc.c
+++ b/misc.c
@@ -51,7 +51,7 @@ char *mystrdup(char *s)
char *x;
if(s)
{
- x = malloc(strlen(s)+1);
+ x = (char*)malloc(strlen(s)+1);
strcpy(x, s);
return x;
}
@@ -194,4 +194,76 @@ int load_string(FILE *f, char *str, int max)
fread(str, li, 1, f);
str[li] = 0;
return 0;
+}
+
+void strcaturl(char *dst, char *src)
+{
+ char *d;
+ unsigned char *s;
+
+ for(d=dst; *d; d++) ;
+
+ for(s=(unsigned char *)src; *s; s++)
+ {
+ if((*s>='0' && *s<='9') ||
+ (*s>='a' && *s<='z') ||
+ (*s>='A' && *s<='Z'))
+ *(d++) = *s;
+ else
+ {
+ *(d++) = '%';
+ *(d++) = hex[*s>>4];
+ *(d++) = hex[*s&15];
+ }
+ }
+ *d = 0;
+}
+
+void *file_load(char *fn, int *size)
+{
+ FILE *f = fopen(fn, "rb");
+ void *s;
+
+ if(!f)
+ return NULL;
+ fseek(f, 0, SEEK_END);
+ *size = ftell(f);
+ fseek(f, 0, SEEK_SET);
+ s = malloc(*size);
+ if(!s)
+ {
+ fclose(f);
+ return NULL;
+ }
+ fread(s, *size, 1, f);
+ fclose(f);
+ return s;
+}
+
+int cpu_check(void)
+{
+#ifdef MACOSX
+ return 0;
+#else
+#ifdef X86
+ unsigned af,bf,cf,df;
+ x86_cpuid(0, af, bf, cf, df);
+ if(bf==0x68747541 && cf==0x444D4163 && df==0x69746E65)
+ amd = 1;
+ x86_cpuid(1, af, bf, cf, df);
+#ifdef X86_SSE
+ if(!(df&(1<<25)))
+ return 1;
+#endif
+#ifdef X86_SSE2
+ if(!(df&(1<<26)))
+ return 1;
+#endif
+#ifdef X86_SSE3
+ if(!(cf&1))
+ return 1;
+#endif
+#endif
+#endif
+ return 0;
} \ No newline at end of file
diff --git a/misc.h b/misc.h
index dbc2b84..106d216 100644
--- a/misc.h
+++ b/misc.h
@@ -3,6 +3,23 @@
#include <stdio.h>
#include <stdlib.h>
+#ifdef WIN32
+#define x86_cpuid(func,af,bf,cf,df) \
+ do {\
+ __asm mov eax, func\
+ __asm cpuid\
+ __asm mov af, eax\
+ __asm mov bf, ebx\
+ __asm mov cf, ecx\
+ __asm mov df, edx\
+ } while(0)
+#else
+#define x86_cpuid(func,af,bf,cf,df) \
+__asm__ __volatile ("cpuid":\
+ "=a" (af), "=b" (bf), "=c" (cf), "=d" (df) : "a" (func));
+#endif
+
+static char hex[] = "0123456789ABCDEF";
//Signum function
#ifdef WIN32
extern _inline int isign(float i);
@@ -44,4 +61,10 @@ void save_string(FILE *f, char *str);
int load_string(FILE *f, char *str, int max);
+void strcaturl(char *dst, char *src);
+
+void *file_load(char *fn, int *size);
+
+int cpu_check(void);
+
#endif \ No newline at end of file
diff --git a/powder.c b/powder.c
index 9b489a1..706c962 100644
--- a/powder.c
+++ b/powder.c
@@ -454,7 +454,7 @@ int nearest_part(int ci, int t)
void update_particles_i(pixel *vid, int start, int inc)
{
- int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp, pavg;
+ int i, j, x, y, t, nx, ny, r, a, s, rt, fe, nt, lpv, nearp, pavg;
float mv, dx, dy, ix, iy, lx, ly, d, pp;
float pt = R_TEMP;
float c_heat = 0.0f;
@@ -574,14 +574,8 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else
{
- if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f)
- {
- parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL];
- parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL];
- } else {
- parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL];
- parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
- }
+ parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL];
+ parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
}
if(ptypes[t].diffusion)
@@ -1170,7 +1164,7 @@ void update_particles_i(pixel *vid, int start, int inc)
pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough
fe ++;
}
- if((r&0xFF)==PT_GUNP && 15>(rand()%1000))
+ /*if((r&0xFF)==PT_GUNP && 15>(rand()%1000))
parts[r>>8].type = PT_DUST;
if((r&0xFF)==PT_DYST && 15>(rand()%1000))
parts[r>>8].type = PT_YEST;
@@ -1187,16 +1181,14 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].type = PT_GOO;
if((r&0xFF)==PT_NITR && 15>(rand()%1000))
parts[r>>8].type = PT_DESL;
- if((r&0xFF)==PT_OIL && 5>(rand()%1000))
- parts[r>>8].type = PT_PLAS;
if((r&0xFF)==PT_PLNT && 5>(rand()%100))
parts[r>>8].type = PT_WOOD;
- if((r&0xFF)==PT_PLAS && 5>(rand()%1000))
- parts[r>>8].type = PT_OIL;
if((r&0xFF)==PT_DESL && 15>(rand()%1000))
parts[r>>8].type = PT_GAS;
if((r&0xFF)==PT_COAL && 5>(rand()%100))
- parts[r>>8].type = PT_WOOD;
+ parts[r>>8].type = PT_WOOD;*/
+ if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && 15>(rand()%1000))
+ parts[r>>8].type--;
}
}
else if(t==PT_PHOT)
diff --git a/powder.h b/powder.h
index 18ce896..34f623f 100644
--- a/powder.h
+++ b/powder.h
@@ -96,16 +96,15 @@
#define PT_STKM 55
#define PT_SWCH 56
#define PT_SMKE 57
-#define PT_PLAS 58
-#define PT_DESL 59
-#define PT_COAL 60
-#define PT_LO2 61
-#define PT_O2 62
-#define PT_INWR 63
-#define PT_YEST 64
-#define PT_DYST 65
-#define PT_THRM 66
-#define PT_NUM 67
+#define PT_DESL 58
+#define PT_COAL 59
+#define PT_LO2 60
+#define PT_O2 61
+#define PT_INWR 62
+#define PT_YEST 63
+#define PT_DYST 64
+#define PT_THRM 65
+#define PT_NUM 66
#define R_TEMP 22
#define MAX_TEMP 3500
@@ -233,11 +232,10 @@ static part_type ptypes[PT_NUM] =
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"},
{"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."},
{"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"},
- {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"},
+ {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"},
{"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"},
{"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"},
- {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.0f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."},
- {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0.01f, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"},
+ {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"},
{"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."},
{"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"},
{"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 5.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."},
@@ -254,7 +252,7 @@ static part_state pstates[PT_NUM] =
/* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f},
- /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
+ /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 60.0f, PT_NONE, 0.0f},
/* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f},
/* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LAVA */ {ST_LIQUID, PT_STNE, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
@@ -268,7 +266,7 @@ static part_state pstates[PT_NUM] =
/* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
- /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f},
+ /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f},
/* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f},
@@ -309,7 +307,6 @@ static part_state pstates[PT_NUM] =
/* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
- /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OIL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f},
/* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f},
/* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f},
@@ -317,7 +314,7 @@ static part_state pstates[PT_NUM] =
/* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 60.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
- /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
+ /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
};
static unsigned char can_move[PT_NUM][PT_NUM] =
{
@@ -329,73 +326,72 @@ static unsigned char can_move[PT_NUM][PT_NUM] =
/* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/
/* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/
/* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/
-/* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */
-/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0}, /* Dust */
-/* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0}, /* Watr */
-/* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */
-/* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Fire */
-/* STNE */ {0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0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,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0}, /* LO2 */
+/* O2 */ {0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0}, /* O2 */
+/* INWR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* INWR */
+/* YEST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* YEST */
+/* DYST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* DYST */
+/* BRMT */ {0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0}, /* Brml */
/* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/
/* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/
/* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/