From 99be47c8bd5c2c66bfabada1fbc5f13393cac4ed Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 13 Feb 2011 21:43:19 +0000 Subject: [PATCH 01/36] Fix incorrect liquids movement --- src/powder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/powder.c b/src/powder.c index dc360549f..c302a82a7 100644 --- a/src/powder.c +++ b/src/powder.c @@ -253,6 +253,7 @@ int try_move(int i, int x, int y, int nx, int ny) if (parts[e].type == PT_PHOT) return 1; + if ((pmap[ny][nx]>>8)==e) pmap[ny][nx] = 0; parts[e].x += x-nx; parts[e].y += y-ny; pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type; From 8c531c5286088dacda03ed9a594e5aabe341285c Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 13 Feb 2011 21:59:45 +0000 Subject: [PATCH 02/36] FLAG_STAGNANT usage lost during rewrite --- src/powder.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/powder.c b/src/powder.c index c302a82a7..77dc305cf 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1780,6 +1780,9 @@ killed: } } + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if ((t==PT_PHOT||t==PT_NEUT)) { if (t == PT_PHOT) { rt = pmap[fin_y][fin_x] & 0xFF; @@ -2008,24 +2011,25 @@ killed: break; } } - else if (clear_x!=x&&clear_y!=y && try_move(i, x, y, clear_x, clear_y)) { + else if ((clear_x!=x||clear_y!=y) && try_move(i, x, y, clear_x, clear_y)) { // if interpolation was done and haven't yet moved, try moving to last clear position parts[i].x = clear_xf; parts[i].y = clear_yf; } + else + parts[i].flags |= FLAG_STAGNANT; parts[i].vx *= ptypes[t].collision; parts[i].vy *= ptypes[t].collision; - if (!s) - parts[i].flags |= FLAG_STAGNANT; } else { - if (clear_x!=x&&clear_y!=y && try_move(i, x, y, clear_x, clear_y)) { + if ((clear_x!=x||clear_y!=y) && try_move(i, x, y, clear_x, clear_y)) { // if interpolation was done, try moving to last clear position parts[i].x = clear_xf; parts[i].y = clear_yf; } - parts[i].flags |= FLAG_STAGNANT; + else + parts[i].flags |= FLAG_STAGNANT; parts[i].vx *= ptypes[t].collision; parts[i].vy *= ptypes[t].collision; } From d5fcee7a1ee8bdce2ea2930f803d5e4256b3b7e6 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Tue, 15 Feb 2011 22:07:24 +0000 Subject: [PATCH 03/36] Makefile - libregex for mingw32, and change icc spaces to tab --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3a61b1183..de180d74b 100644 --- a/Makefile +++ b/Makefile @@ -47,23 +47,23 @@ powder-64-sse2: $(SOURCES) mv $@ build powder-icc: $(SOURCES) - /opt/intel/Compiler/11.1/073/bin/intel64/icc -m64 -o$@ -Iincludes/ -O2 -march=core2 -msse3 -mfpmath=sse -lSDL -lbz2 -lm -xW $(SOURCES) -std=c99 -D_POSIX_C_SOURCE=200112L + /opt/intel/Compiler/11.1/073/bin/intel64/icc -m64 -o$@ -Iincludes/ -O2 -march=core2 -msse3 -mfpmath=sse -lSDL -lbz2 -lm -xW $(SOURCES) -std=c99 -D_POSIX_C_SOURCE=200112L powder-res.o: powder-res.rc powder.ico i586-mingw32msvc-windres powder-res.rc powder-res.o powder-sse3.exe: $(SOURCES) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ mv $@ build powder-sse2.exe: $(SOURCES) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ mv $@ build powder-sse.exe: $(SOURCES) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ mv $@ build From 7ef2363f90242f8b3b8eb13df1ce68ada8fe63ee Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Tue, 15 Feb 2011 22:20:15 +0000 Subject: [PATCH 04/36] Crash when element with invalid type is created Generally due to an invalid ctype for clone. --- src/powder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/powder.c b/src/powder.c index 77dc305cf..873935b29 100644 --- a/src/powder.c +++ b/src/powder.c @@ -454,7 +454,7 @@ _inline void part_change_type(int i, int x, int y, int t) inline void part_change_type(int i, int x, int y, int t) #endif { - if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART) + if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART || t<0 || t>=PT_NUM) return; parts[i].type = t; if (t==PT_PHOT)// || t==PT_NEUT) @@ -485,7 +485,7 @@ inline int create_n_parts(int n, int x, int y, float vx, float vy, int t) if (n>680) { n = 680; } - if (x<0 || y<0 || x>=XRES || y>=YRES) + if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM) return -1; for (c; c=XRES || y>=YRES) + if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM) return -1; if (t==SPC_HEAT||t==SPC_COOL) From 29a63795dd6d93c212a6dbc90d179df9c5ee960e Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 16 Feb 2011 20:56:43 +0000 Subject: [PATCH 05/36] Preventing creation of invalid types also prevented use of air/temp tools --- src/powder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/powder.c b/src/powder.c index 873935b29..5fe4ed8c6 100644 --- a/src/powder.c +++ b/src/powder.c @@ -523,7 +523,7 @@ inline int create_part(int p, int x, int y, int t) { int i; - if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM) + if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM)) return -1; if (t==SPC_HEAT||t==SPC_COOL) From 914cf28fa7b68d0d487e39f4a4a9747942f739ea Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 16 Feb 2011 21:19:21 +0000 Subject: [PATCH 06/36] create_box improvements Boxes now have sharp corners - they fill only the specified rectangle and not 1 pixel extra on all sides. --- src/powder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/powder.c b/src/powder.c index 5fe4ed8c6..78562b8fb 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2712,7 +2712,7 @@ void create_box(int x1, int y1, int x2, int y2, int c) } for (j=y1; j<=y2; j++) for (i=x1; i<=x2; i++) - create_parts(i, j, 1, 1, c); + create_parts(i, j, 0, 0, c); } int flood_parts(int x, int y, int c, int cm, int bm) From a2091ede7646388e9bfd9d679d90bdb70affd507 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 19 Feb 2011 15:34:04 +0000 Subject: [PATCH 07/36] Move reset code to own function Also clear persistent view when loading a save or clearing the screen. --- includes/defines.h | 1 + includes/graphics.h | 1 + src/graphics.c | 1 + src/main.c | 68 +++++++++++++++++++-------------------------- 4 files changed, 32 insertions(+), 39 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index 3b765aabc..acbf58eef 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -176,6 +176,7 @@ 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 clear_sim(void); void del_stamp(int d); void sdl_seticon(void); #endif diff --git a/includes/graphics.h b/includes/graphics.h index a5de71a25..4d4d438fb 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -46,6 +46,7 @@ extern unsigned char fire_b[YRES/CELL][XRES/CELL]; extern unsigned int fire_alpha[CELL*3][CELL*3]; extern pixel *fire_bg; +extern pixel *pers_bg; pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); diff --git a/src/graphics.c b/src/graphics.c index 78f1867fb..a3cbf8774 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -31,6 +31,7 @@ unsigned char fire_b[YRES/CELL][XRES/CELL]; unsigned int fire_alpha[CELL*3][CELL*3]; pixel *fire_bg; +pixel *pers_bg; pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) { diff --git a/src/main.c b/src/main.c index 16f309253..67dc088c9 100644 --- a/src/main.c +++ b/src/main.c @@ -553,19 +553,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0) gravityMode = 0; airMode = 0; } - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - memset(photons, 0, sizeof(photons)); - memset(wireless, 0, sizeof(wireless)); - memset(gol2, 0, sizeof(gol2)); - memset(portal, 0, sizeof(portal)); - death = death2 = ISSPAWN1 = ISSPAWN2 = 0; + clear_sim(); } // make a catalog of free parts @@ -897,13 +885,35 @@ corrupt: if (replace) { legacy_enable = 0; - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(bmap, 0, sizeof(bmap)); + clear_sim(); } return 1; } +void clear_sim(void) +{ + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(photons, 0, sizeof(photons)); + memset(wireless, 0, sizeof(wireless)); + memset(gol2, 0, sizeof(gol2)); + memset(portal, 0, sizeof(portal)); + death = death2 = ISSPAWN1 = ISSPAWN2 = 0; + memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); +} + // stamps library stamp stamps[STAMP_MAX];//[STAMP_X*STAMP_Y]; @@ -1188,7 +1198,7 @@ int main(int argc, char *argv[]) int pastFPS = 0; int past = 0; pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE); + pers_bg = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); void *http_ver_check; void *http_session_check = NULL; char *ver_data=NULL, *check_data=NULL, *tmp; @@ -1248,7 +1258,7 @@ int main(int argc, char *argv[]) parts[NPART-1].life = -1; pfree = 0; fire_bg=calloc(XRES*YRES, PIXELSIZE); - memset(signs, 0, sizeof(signs)); + clear_sim(); //fbi_img = render_packed_rgb(fbi, FBI_W, FBI_H, FBI_CMP); @@ -2255,19 +2265,7 @@ int main(int argc, char *argv[]) } if (x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - memset(photons, 0, sizeof(photons)); - memset(wireless, 0, sizeof(wireless)); - memset(gol2, 0, sizeof(gol2)); - memset(portal, 0, sizeof(portal)); + clear_sim(); for (i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) { From e640e2dd4200b1c3ca778626a5479d385170b213 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 19 Feb 2011 15:50:25 +0000 Subject: [PATCH 08/36] Always save last display mode --- src/interface.c | 1 + src/main.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface.c b/src/interface.c index d3057d8e0..e411ce8b1 100644 --- a/src/interface.c +++ b/src/interface.c @@ -1925,6 +1925,7 @@ void set_cmode(int cm) { strcpy(itc_msg, "Velocity Display"); } + save_presets(0); } char *download_ui(pixel *vid_buf, char *uri, int *len) diff --git a/src/main.c b/src/main.c index 67dc088c9..46f99b11e 100644 --- a/src/main.c +++ b/src/main.c @@ -2330,7 +2330,6 @@ int main(int argc, char *argv[]) set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT); } } - save_presets(0); } if (x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) sys_pause = !sys_pause; From 1ae599d63ec172af79f3b8d976a7d8b3ea88a3f5 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 20 Feb 2011 19:08:50 +0000 Subject: [PATCH 09/36] Fix console preventing window from closing --- src/interface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/interface.c b/src/interface.c index e411ce8b1..1f2f8fd2d 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3952,6 +3952,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show } } } + console_mode = 0; return NULL; } From b3278cf8883d93d8f16e537658b5536d374eb432 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 20 Feb 2011 01:29:30 +0000 Subject: [PATCH 10/36] Fix some compiler warnings --- includes/defines.h | 1 + src/elements/fwrk.c | 2 +- src/main.c | 27 +++++++++++++-------------- src/powder.c | 10 ++++++---- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index acbf58eef..8dd1975b1 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -179,4 +179,5 @@ int parse_save(void *save, int size, int replace, int x0, int y0); void clear_sim(void); void del_stamp(int d); void sdl_seticon(void); +int process_command(pixel *vid_buf, char *console, char *console_error); #endif diff --git a/src/elements/fwrk.c b/src/elements/fwrk.c index 06390c59d..5095cde5e 100644 --- a/src/elements/fwrk.c +++ b/src/elements/fwrk.c @@ -16,7 +16,7 @@ int update_FWRK(UPDATE_FUNC_ARGS) { } if (parts[i].life>=45) parts[i].life=0; - if ((parts[i].life<3&&parts[i].life>0)||parts[i].vy>6&&parts[i].life>0) + if ((parts[i].life<3&&parts[i].life>0)||(parts[i].vy>6&&parts[i].life>0)) { int q = (rand()%255+1); int w = (rand()%255+1); diff --git a/src/main.c b/src/main.c index 46f99b11e..946d87b34 100644 --- a/src/main.c +++ b/src/main.c @@ -1510,7 +1510,7 @@ int main(int argc, char *argv[]) free(load_data); } } - if (sdl_key=='s' && (sdl_mod & (KMOD_CTRL)) || (sdl_key=='s' && !isplayer2)) + if ((sdl_key=='s' && (sdl_mod & (KMOD_CTRL))) || (sdl_key=='s' && !isplayer2)) { if (it > 50) it = 50; @@ -1644,7 +1644,7 @@ int main(int argc, char *argv[]) bsy = 0; } } - if (sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)) || (sdl_key=='d' && !isplayer2)) + if ((sdl_key=='d'&&(sdl_mod & (KMOD_CTRL))) || (sdl_key=='d' && !isplayer2)) DEBUG_MODE = !DEBUG_MODE; if (sdl_key=='i') { @@ -1901,7 +1901,7 @@ int main(int argc, char *argv[]) console = console_ui(vid_buf,console_error); console = mystrdup(console); strcpy(console_error,""); - if(process_command(vid_buf,console,&console_error)==-1) + if(process_command(vid_buf,console,console_error)==-1) { free(console); break; @@ -2740,7 +2740,7 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { { return -1; } - else if(strcmp(console2, "file")==0 && console3) + else if(strcmp(console2, "file")==0) { FILE *f=fopen(console3, "r"); if(f) @@ -2753,8 +2753,7 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { ny = 0; j = 0; m = 0; - if(console4) - console_parse_coords(console4, &nx , &ny, console_error); + console_parse_coords(console4, &nx , &ny, console_error); memset(pch,0,sizeof(pch)); memset(fileread,0,sizeof(fileread)); fread(fileread,1,5000,f); @@ -2821,12 +2820,12 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { else sprintf(console_error, "%s does not exist", console3); } - else if(strcmp(console2, "sound")==0 && console3) + else if(strcmp(console2, "sound")==0) { if (sound_enable) play_sound(console3); else strcpy(console_error, "Audio device not available - cannot play sounds"); } - else if(strcmp(console2, "load")==0 && console3) + else if(strcmp(console2, "load")==0) { j = atoi(console3); if(j) @@ -2835,7 +2834,7 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { console_mode = 0; } } - else if(strcmp(console2, "if")==0 && console3) + else if(strcmp(console2, "if")==0) { if(strcmp(console3, "type")==0)//TODO: add more than just type, and be able to check greater/less than { @@ -2851,7 +2850,7 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { return 0; } } - else if (strcmp(console2, "create")==0 && console3 && console4) + else if (strcmp(console2, "create")==0) { if (console_parse_type(console3, &j, console_error) && console_parse_coords(console4, &nx, &ny, console_error)) @@ -2862,12 +2861,12 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { strcpy(console_error, "Could not create particle"); } } - else if ((strcmp(console2, "delete")==0 || strcmp(console2, "kill")==0) && console3) + else if (strcmp(console2, "delete")==0 || strcmp(console2, "kill")==0) { if (console_parse_partref(console3, &i, console_error)) kill_part(i); } - else if(strcmp(console2, "reset")==0 && console3) + else if(strcmp(console2, "reset")==0) { if(strcmp(console3, "pressure")==0) { @@ -2908,7 +2907,7 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { } } } - else if(strcmp(console2, "set")==0 && console3 && console4 && console5) + else if(strcmp(console2, "set")==0) { if(strcmp(console3, "life")==0) { @@ -3173,7 +3172,7 @@ int process_command(pixel *vid_buf,char *console,char *console_error) { } } else - sprintf(console_error, "Invalid Command", console2); + strcpy(console_error, "Invalid Command"); } return 1; } diff --git a/src/powder.c b/src/powder.c index 78562b8fb..914bb4e41 100644 --- a/src/powder.c +++ b/src/powder.c @@ -488,7 +488,7 @@ inline int create_n_parts(int n, int x, int y, float vx, float vy, int t) if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM) return -1; - for (c; c>8].type = PT_STKM; parts[pmap[y][x]>>8].vx = 0; @@ -799,7 +799,7 @@ inline int create_part(int p, int x, int y, int t) { if (isplayer2==0) { - if (pmap[y][x]&0xFF==PT_SPAWN2) + if ((pmap[y][x]&0xFF)==PT_SPAWN2) { parts[pmap[y][x]>>8].type = PT_STKM2; parts[pmap[y][x]>>8].vx = 0; @@ -1335,7 +1335,7 @@ void update_particles_i(pixel *vid, int start, int inc) { r = pmap[ny][nx]; neighbors = gol2[nx][ny][0]; - if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART) + if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !(r&0xFF)) || (r>>8)>=NPART) continue; for ( golnum = 1; golnum<=NGOL; golnum++) for ( goldelete = 0; goldelete<9; goldelete++) @@ -2925,10 +2925,12 @@ int create_parts(int x, int y, int rx, int ry, int c) for (j=-ry; j<=ry; j++) for (i=-rx; i<=rx; i++) if ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(rx,2))+(pow(j,2))/(pow(ry,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=ry*rx)) + { if (!REPLACE_MODE) create_part(-2, x+i, y+j, c); else if ((pmap[y+j][x+i]&0xFF)==SLALT&&SLALT!=0) create_part(-2, x+i, y+j, c); + } return 1; } From 317ddab6176b2727673e9b1fefbd05a8539d1f2b Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 20 Feb 2011 20:55:47 +0000 Subject: [PATCH 11/36] Reduce overlap of HUD text when in debug/beta mode Also reduce duplication of some HUD code --- src/main.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main.c b/src/main.c index 946d87b34..32a89dd5d 100644 --- a/src/main.c +++ b/src/main.c @@ -1945,35 +1945,29 @@ int main(int argc, char *argv[]) } if (!((cr>>8)>=NPART || !cr)) { -#ifdef BETA if (DEBUG_MODE) { int tctype = parts[cr>>8].ctype; if (tctype>=PT_NUM) tctype = 0; - sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life, cr>>8); - //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); - } else + sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); + sprintf(coordtext, "#%d, X:%d Y:%d", cr>>8, x/sdl_scale, y/sdl_scale); + } else { +#ifdef BETA sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); #else - if (DEBUG_MODE) - { - int tctype = parts[cr>>8].ctype; - if (tctype>=PT_NUM) - tctype = 0; - sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life ,cr>>8); - //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); - } else { sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); - } #endif + } } else { sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + if (DEBUG_MODE) + { + sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale); + } } - if (DEBUG_MODE) - sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale); } mx = x; my = y; From ac7eda80a545ba8c0cbab80236df88570e1d33ad Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 20 Feb 2011 22:38:19 +0000 Subject: [PATCH 12/36] Zoom key conflict with international keyboards Change zoom key to only use keysym.sym, like all the other keyboard controls. This may mean it is no longer the 'z' key on all systems, but will prevent it conflicting with the other keyboard controls. --- includes/interface.h | 2 -- src/interface.c | 7 ++----- src/main.c | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/includes/interface.h b/includes/interface.h index e1d7e6f22..a49f75f9e 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -154,8 +154,6 @@ extern char search_expr[256]; extern char *tag_names[TAG_MAX]; extern int tag_votes[TAG_MAX]; -extern int Z_keysym; - extern int zoom_en; extern int zoom_x, zoom_y; extern int zoom_wx, zoom_wy; diff --git a/src/interface.c b/src/interface.c index 1f2f8fd2d..12f13f6cd 100644 --- a/src/interface.c +++ b/src/interface.c @@ -60,8 +60,6 @@ char search_expr[256] = ""; char *tag_names[TAG_MAX]; int tag_votes[TAG_MAX]; -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; @@ -1763,10 +1761,9 @@ int sdl_poll(void) sdl_ascii=event.key.keysym.unicode; if (event.key.keysym.sym == SDLK_CAPSLOCK) sdl_caps = 1; - if (event.key.keysym.unicode=='z' || event.key.keysym.unicode=='Z') + if (event.key.keysym.sym=='z') { sdl_zoom_trig = 1; - Z_keysym = event.key.keysym.sym; } if ( event.key.keysym.sym == SDLK_PLUS) { @@ -1816,7 +1813,7 @@ int sdl_poll(void) case SDL_KEYUP: if (event.key.keysym.sym == SDLK_CAPSLOCK) sdl_caps = 0; - if (event.key.keysym.sym == Z_keysym) + if (event.key.keysym.sym == 'z') sdl_zoom_trig = 0; if (event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) { diff --git a/src/main.c b/src/main.c index 32a89dd5d..9fcebfbe9 100644 --- a/src/main.c +++ b/src/main.c @@ -2118,7 +2118,7 @@ int main(int argc, char *argv[]) if (!sdl_zoom_trig && zoom_en==1) zoom_en = 0; - if (sdl_key==Z_keysym && zoom_en==2) + if (sdl_key=='z' && zoom_en==2) zoom_en = 1; if (load_mode) From 7ecaa1636267108d4975ee336522bf7beb4e117e Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 23 Feb 2011 21:15:54 +0000 Subject: [PATCH 13/36] Fix lava freezing point --- src/powder.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/powder.c b/src/powder.c index 914bb4e41..2e5aef0bb 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1566,10 +1566,12 @@ void update_particles_i(pixel *vid, int start, int inc) } else if (t==PT_LAVA) { if (parts[i].ctype && parts[i].ctype=ptransitions[parts[i].ctype].thv) s = 0; - else if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0; + if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0; + else if (ptransitions[parts[i].ctype].tht==PT_LAVA) { + if (pt>=ptransitions[parts[i].ctype].thv) s = 0; + } else if (pt>=973.0f) s = 0; // freezing point for lava with any other (not listed in ptransitions as turning into lava) ctype - else { + if (s) { t = parts[i].ctype; parts[i].ctype = PT_NONE; if (t==PT_THRM) { From 71a6654c036dc4ebb96c67dddc23594f4699cbb2 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 24 Feb 2011 00:57:13 +0000 Subject: [PATCH 14/36] Fix particles displaced by liquids moving to overlapping positions --- src/powder.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/powder.c b/src/powder.c index 2e5aef0bb..bb773858e 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1988,7 +1988,9 @@ killed: if (try_move(i, x, y, j, clear_y)) { parts[i].x = clear_xf+(j-clear_x); + parts[i].y = clear_yf; nx = j; + ny = clear_y; s = 1; break; } @@ -2000,11 +2002,11 @@ killed: else r = -1; if (s) - for (j=clear_y+r; j>=0 && j=clear_y-rt && j=0 && j=ny-rt && j Date: Thu, 24 Feb 2011 19:24:37 +0000 Subject: [PATCH 15/36] Fix ETRD not conducting correctly to adjacent particles --- src/elements/sprk.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/elements/sprk.c b/src/elements/sprk.c index f107b9af6..89480ad6d 100644 --- a/src/elements/sprk.c +++ b/src/elements/sprk.c @@ -120,7 +120,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) { conduct_sprk = 0; if (ct==PT_NSCN && rt==PT_PSCN) conduct_sprk = 0; - if (ct==PT_ETRD && (parts[i].life!=5||!(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN))) + if (ct==PT_ETRD && !(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN)) conduct_sprk = 0; if (ct==PT_INST&&rt!=PT_NSCN) conduct_sprk = 0; if (ct==PT_SWCH && (rt==PT_PSCN||rt==PT_NSCN||rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) @@ -137,15 +137,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) { conduct_sprk = 0; if (conduct_sprk) { - if (ct==PT_ETRD) { - part_change_type(i,x,y,PT_ETRD); - parts[i].ctype = PT_NONE; - parts[i].life = 20; - part_change_type(r>>8,x+rx,y+ry,PT_SPRK); - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - else if (rt==PT_WATR||rt==PT_SLTW) { + if (rt==PT_WATR||rt==PT_SLTW) { if (parts[r>>8].life==0 && (parts[i].life<2 || ((r>>8)>8,x+rx,y+ry,PT_SPRK); @@ -167,6 +159,15 @@ int update_SPRK(UPDATE_FUNC_ARGS) { if (parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&(rt==PT_METL||rt==PT_BMTL||rt==PT_BRMT||rt==PT_PSCN||rt==PT_NSCN||rt==PT_ETRD||rt==PT_NBLE||rt==PT_IRON)) parts[r>>8].temp = parts[r>>8].temp+10.0f; } + else if (ct==PT_ETRD && parts[i].life==5) + { + part_change_type(i,x,y,ct); + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + part_change_type(r>>8,x+rx,y+ry,PT_SPRK); + } } } return 0; From 57630e561d025804be9acfeaca2b5aa816629d1b Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 26 Feb 2011 20:58:22 +0000 Subject: [PATCH 16/36] Fix some potential crashes, better handling of empty server responses --- src/interface.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/interface.c b/src/interface.c index 9b1b495cd..b13917dee 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2549,7 +2549,8 @@ int search_ui(pixel *vid_buf) memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); } is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); + if (results) + free(results); active = 0; } @@ -2824,6 +2825,10 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) data = http_async_req_stop(http, &status, &data_size); if (status == 200) { + if (!data||!data_size) { + error_ui(vid_buf, 0, "Save data is empty (may be corrupt)"); + break; + } pixel *full_save = prerender_save(data, data_size, &imgw, &imgh); if (full_save!=NULL) { save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2); @@ -2842,15 +2847,16 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) { http_last_use_2 = time(NULL); info_data = http_async_req_stop(http_2, &status_2, NULL); - if (status_2 == 200) + if (status_2 == 200 || !info_data) { info_ready = info_parse(info_data, info); - if (info_ready==-1) { - error_ui(vid_buf, 0, "Not found"); + if (info_ready<=0) { + error_ui(vid_buf, 0, "Save info not found"); break; } } - free(info_data); + if (info_data) + free(info_data); active_2 = 0; free(http_2); http_2 = NULL; @@ -3546,7 +3552,7 @@ int execute_tagop(pixel *vid_buf, char *op, char *tag) return 1; } - if (result[2]) + if (result && result[2]) { strncpy(svf_tags, result+3, 255); svf_id[15] = 0; @@ -3604,14 +3610,16 @@ void execute_save(pixel *vid_buf) free(result); return; } - if (result && strncmp(result, "OK", 2)) + if (!result || strncmp(result, "OK", 2)) { + if (!result) + result = mystrdup("Could not save - no reply from server"); error_ui(vid_buf, 0, result); free(result); return; } - if (result[2]) + if (result && result[2]) { strncpy(svf_id, result+3, 15); svf_id[15] = 0; From fbae5fb16adead5e8af8799da4cfff9e0064afd9 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 10 Mar 2011 23:34:22 +0000 Subject: [PATCH 17/36] Flashing BRAY fix We should just be thankful that negative life will not save correctly... --- src/graphics.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/graphics.c b/src/graphics.c index cea2ba72a..bbfb32f8f 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1893,10 +1893,16 @@ void draw_parts(pixel *vid) } if (cr>255) cr=255; + if (cr<0) + cr=0; if (cg>255) cg=255; + if (cg<0) + cg=0; if (cb>255) cb=255; + if (cb<0) + cb=0; blendpixel(vid, nx, ny, cr, cg, cb, 255); } else if (t==PT_WIFI) @@ -2143,6 +2149,7 @@ void draw_parts(pixel *vid) else if (t==PT_BRAY && parts[i].tmp==0) { int trans = parts[i].life * 7; + if (trans>255) trans = 255; if (parts[i].ctype) { cg = 0; cb = 0; @@ -2167,6 +2174,7 @@ void draw_parts(pixel *vid) else if (t==PT_BRAY && parts[i].tmp==1) { int trans = parts[i].life/4; + if (trans>255) trans = 255; if (parts[i].ctype) { cg = 0; cb = 0; @@ -2191,6 +2199,7 @@ void draw_parts(pixel *vid) else if (t==PT_BRAY && parts[i].tmp==2) { int trans = parts[i].life*100; + if (trans>255) trans = 255; blendpixel(vid, nx, ny, 255, 150, 50, trans); } else if (t==PT_PHOT) From 0a3b44ee146159575d49a0c14f379f27070dd841 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 12 Mar 2011 14:01:58 +0000 Subject: [PATCH 18/36] Update fancy mode to use the new GLOW graphics --- src/graphics.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/graphics.c b/src/graphics.c index bbfb32f8f..90e81b0af 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1573,31 +1573,27 @@ void draw_parts(pixel *vid) } else if (parts[i].type==PT_GLOW) { - fg = 0; - fb = 0; - fr = 0; - if (pv[ny/CELL][nx/CELL]>0) { - fg = 6 * pv[ny/CELL][nx/CELL]; - fb = 4 * pv[ny/CELL][nx/CELL]; - fr = 2 * pv[ny/CELL][nx/CELL]; - } - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); + fr = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f; + fg = restrict_flt(parts[i].ctype, 0, 128)/50.0f; + fb = restrict_flt(parts[i].tmp, 0, 128)/50.0f; + + cr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255); + cg = restrict_flt(64.0f+parts[i].ctype, 0, 255); + cb = restrict_flt(64.0f+parts[i].tmp, 0, 255); - /*x = nx/CELL; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb); + x = nx/CELL; y = ny/CELL; fg += fire_g[y][x]; - if(fg > 255) fg = 255; - fire_g[y][x] = fg; + if (fg > 255) fg = 255; + fire_g[y][x] = fg; fb += fire_b[y][x]; - if(fb > 255) fb = 255; - fire_b[y][x] = fb; + if (fb > 255) fb = 255; + fire_b[y][x] = fb; fr += fire_r[y][x]; - if(fr > 255) fr = 255; - fire_r[y][x] = fr;*/ + if (fr > 255) fr = 255; + fire_r[y][x] = fr; - cr = (int)restrict_flt(0x44 + fr*8, 0, 255); - cg = (int)restrict_flt(0x88 + fg*8, 0, 255); - cb = (int)restrict_flt(0x44 + fb*8, 0, 255); for (x=-1; x<=1; x++) { for (y=-1; y<=1; y++) From 24e053ca6265fdb385de1a51366eaae27f102a2e Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 12 Mar 2011 17:08:35 +0000 Subject: [PATCH 19/36] Limit length of save title and username at bottom of screen --- src/interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interface.c b/src/interface.c index b13917dee..53f706bf0 100644 --- a/src/interface.c +++ b/src/interface.c @@ -479,7 +479,7 @@ void draw_svf_ui(pixel *vid_buf) c = svf_login ? 255 : 128; drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); if (svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + drawtextmax(vid_buf, 58, YRES+(MENUSIZE-12), 125, svf_name, c, c, c, 255); else drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); @@ -505,7 +505,7 @@ void draw_svf_ui(pixel *vid_buf) drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); if (svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), XRES+BARSIZE-405, svf_tags, c, c, c, 255); else drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); @@ -516,7 +516,7 @@ void draw_svf_ui(pixel *vid_buf) drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); if (svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + drawtextmax(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), 66, svf_user, 255, 255, 255, 255); else drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); From 72a4490bb5c78c6a1c8cfd0f8aa2165b0315d24c Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 12 Mar 2011 17:39:13 +0000 Subject: [PATCH 20/36] Save ID is useful, so display it! --- src/interface.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/interface.c b/src/interface.c index 53f706bf0..72d710761 100644 --- a/src/interface.c +++ b/src/interface.c @@ -1203,8 +1203,9 @@ finish: int save_name_ui(pixel *vid_buf) { - int x0=(XRES-420)/2,y0=(YRES-68-YRES/4)/2,b=1,bq,mx,my,ths,nd=0; + int x0=(XRES-420)/2,y0=(YRES-68-YRES/4)/2,b=1,bq,mx,my,ths,idtxtwidth,nd=0; void *th; + char *save_id_text; ui_edit ed; ui_edit ed2; ui_checkbox cb; @@ -1240,6 +1241,10 @@ int save_name_ui(pixel *vid_buf) ed2.cursor = strlen(svf_description); ed2.multiline = 1; strcpy(ed2.str, svf_description); + + save_id_text = malloc(strlen("Current save id: ")+strlen(svf_id)+1); + sprintf(save_id_text,"Current save id: %s",svf_id); + idtxtwidth = textwidth(save_id_text); cb.x = x0+10; cb.y = y0+53+YRES/4; @@ -1275,6 +1280,12 @@ int save_name_ui(pixel *vid_buf) drawrect(vid_buf, x0, y0+74+YRES/4, 192, 16, 192, 192, 192, 255); draw_line(vid_buf, x0+192, y0, x0+192, y0+90+YRES/4, 150, 150, 150, XRES+BARSIZE); + + if (svf_id[0]) + { + fillrect(vid_buf, (XRES+BARSIZE-idtxtwidth)/2-5, YRES+(MENUSIZE-16), idtxtwidth+10, 14, 0, 0, 0, 255); + drawtext(vid_buf, (XRES+BARSIZE-idtxtwidth)/2, YRES+MENUSIZE-12, save_id_text, 255, 255, 255, 255); + } sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); @@ -1332,6 +1343,7 @@ int save_name_ui(pixel *vid_buf) } } free(th); + if (save_id_text) free(save_id_text); return 0; } @@ -2732,7 +2744,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) int nyd,nyu,ry,lv; float ryf; - char *uri, *uri_2, *o_uri; + char *uri, *uri_2, *o_uri, *save_id_text; void *data, *info_data; save_info *info = malloc(sizeof(save_info)); void *http = NULL, *http_2 = NULL; @@ -2750,6 +2762,9 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) drawrect(vid_buf, 50, 50, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 155); drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255); drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); + + save_id_text = malloc(strlen("Save id: ")+strlen(save_id)+1); + sprintf(save_id_text,"Save id: %s",save_id); ed.x = 57+(XRES/2)+1; ed.y = YRES+MENUSIZE-118; @@ -2939,6 +2954,10 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) drawrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); drawtext(vid_buf, XRES+BARSIZE-90, YRES+MENUSIZE-63, "Submit", 255, 255, 255, 255); } + + cix = textwidth(save_id_text); + fillrect(vid_buf, (XRES+BARSIZE-cix)/2-5, YRES+(MENUSIZE-16), cix+10, 14, 0, 0, 0, 255); + drawtext(vid_buf, (XRES+BARSIZE-cix)/2, YRES+MENUSIZE-12, save_id_text, 255, 255, 255, 255); //Open Button bc = openable?255:150; @@ -3125,6 +3144,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) if (!b) break; } + if (save_id_text) free(save_id_text); //Close open connections if (http) http_async_req_close(http); From db91bd37f03a1a195a6bfc97235b7d08026d1193 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Tue, 15 Mar 2011 15:28:32 +0000 Subject: [PATCH 21/36] Display photon wavelengths in HUD --- includes/graphics.h | 2 +- src/graphics.c | 30 ++++++++++++++++++++++++++++++ src/main.c | 11 ++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/includes/graphics.h b/includes/graphics.h index 4d4d438fb..b7bfdfa66 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -121,7 +121,7 @@ void xor_line(int x1, int y1, int x2, int y2, pixel *vid); void xor_rect(pixel *vid, int x, int y, int w, int h); void draw_parts(pixel *vid); - +void draw_wavelengths(pixel *vid, int x, int y, int h, int wl); void render_signs(pixel *vid_buf); void render_fire(pixel *dst); diff --git a/src/graphics.c b/src/graphics.c index 90e81b0af..ddb836898 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -2925,6 +2925,36 @@ void draw_parts(pixel *vid) } +void draw_wavelengths(pixel *vid, int x, int y, int h, int wl) +{ + fillrect(vid,x-1,y-1,30+1,h+1,64,64,64,255); // coords -1 size +1 to work around bug in fillrect - TODO: fix fillrect + int i,cr,cg,cb,j; + int tmp; + for (i=0;i<30;i++) + { + if ((wl>>i)&1) + { + // Need a spread of wavelengths to get a smooth spectrum, 5 bits seems to work reasonably well + if (i>2) tmp = 0x1F << (i-2); + else tmp = 0x1F >> (2-i); + cg = 0; + cb = 0; + cr = 0; + for (j=0; j<12; j++) { + cr += (tmp >> (j+18)) & 1; + cb += (tmp >> j) & 1; + } + for (j=0; j<14; j++) + cg += (tmp >> (j+9)) & 1; + tmp = 624/(cr+cg+cb+1); + cr *= tmp; + cg *= tmp; + cb *= tmp; + for (j=0;j255?255:cr,cg>255?255:cg,cb>255?255:cb,255); + } + } +} + void render_signs(pixel *vid_buf) { int i, j, x, y, w, h, dx, dy,mx,my,b=1,bq; diff --git a/src/main.c b/src/main.c index 82c942903..845277c75 100644 --- a/src/main.c +++ b/src/main.c @@ -1204,6 +1204,7 @@ int main(int argc, char *argv[]) #ifdef INTERNAL int vs = 0; #endif + int wavelength_gfx = 0; int x, y, b = 0, sl=1, sr=0, su=0, c, lb = 0, lx = 0, ly = 0, lm = 0;//, tx, ty; int da = 0, db = 0, it = 2047, mx, my, bsx = 2, bsy = 2; float nfvx, nfvy; @@ -1954,7 +1955,7 @@ int main(int argc, char *argv[]) if (DEBUG_MODE) { int tctype = parts[cr>>8].ctype; - if (tctype>=PT_NUM) + if (tctype>=PT_NUM || (cr&0xFF)==PT_PHOT) tctype = 0; sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); sprintf(coordtext, "#%d, X:%d Y:%d", cr>>8, x/sdl_scale, y/sdl_scale); @@ -1965,6 +1966,7 @@ int main(int argc, char *argv[]) sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); #endif } + if ((cr&0xFF)==PT_PHOT) wavelength_gfx = parts[cr>>8].ctype; } else { @@ -2692,6 +2694,8 @@ int main(int argc, char *argv[]) fillrect(vid_buf, XRES-20-textwidth(coordtext), 280, textwidth(coordtext)+8, 13, 0, 0, 0, 140); drawtext(vid_buf, XRES-16-textwidth(coordtext), 282, coordtext, 255, 255, 255, 200); } + if (wavelength_gfx) + draw_wavelengths(vid_buf,XRES-20-textwidth(heattext),265,2,wavelength_gfx); } else { @@ -2702,6 +2706,8 @@ int main(int argc, char *argv[]) fillrect(vid_buf, 12, 280, textwidth(coordtext)+8, 13, 0, 0, 0, 140); drawtext(vid_buf, 16, 282, coordtext, 255, 255, 255, 200); } + if (wavelength_gfx) + draw_wavelengths(vid_buf,12,265,2,wavelength_gfx); } } else @@ -2713,7 +2719,10 @@ int main(int argc, char *argv[]) fillrect(vid_buf, XRES-20-textwidth(coordtext), 26, textwidth(coordtext)+8, 11, 0, 0, 0, 140); drawtext(vid_buf, XRES-16-textwidth(coordtext), 27, coordtext, 255, 255, 255, 200); } + if (wavelength_gfx) + draw_wavelengths(vid_buf,XRES-20-textwidth(heattext),11,2,wavelength_gfx); } + wavelength_gfx = 0; fillrect(vid_buf, 12, 12, textwidth(uitext)+8, 15, 0, 0, 0, 140); drawtext(vid_buf, 16, 16, uitext, 32, 216, 255, 200); From 3b7cf2475743d6753c89e46c1ed762a7f487cc3c Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Tue, 15 Mar 2011 15:53:21 +0000 Subject: [PATCH 22/36] Display element contained by PIPE in debug mode --- src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.c b/src/main.c index 845277c75..b06693c06 100644 --- a/src/main.c +++ b/src/main.c @@ -1957,6 +1957,11 @@ int main(int argc, char *argv[]) int tctype = parts[cr>>8].ctype; if (tctype>=PT_NUM || (cr&0xFF)==PT_PHOT) tctype = 0; + if ((cr&0xFF)==PT_PIPE) + { + if (parts[cr>>8].tmp>8].tmp; + else tctype = 0; + } sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); sprintf(coordtext, "#%d, X:%d Y:%d", cr>>8, x/sdl_scale, y/sdl_scale); } else { From 02084109524239a2b57b5eb8d699bd6c1fbe1597 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 16 Mar 2011 11:39:31 +0000 Subject: [PATCH 23/36] flood_parts uninitialised variable --- src/powder.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/powder.c b/src/powder.c index dbbfe0ce7..a53dc0496 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2728,14 +2728,10 @@ void create_box(int x1, int y1, int x2, int y2, int c) int flood_parts(int x, int y, int c, int cm, int bm) { int x1, x2, dy = (c=UI_WALLSTART&&c<=UI_WALLSTART+UI_WALLCOUNT) - { - wall = c-100; - } if (cm==-1) { if (c==0) @@ -2751,7 +2747,7 @@ int flood_parts(int x, int y, int c, int cm, int bm) } if (bm==-1) { - if (wall==WL_ERASE) + if (c-UI_WALLSTART+UI_ACTUALSTART==WL_ERASE) { bm = bmap[y/CELL][x/CELL]; if (!bm) From a6dabf20722250c7f4cc254eb2cbf264149306e5 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 16 Mar 2011 18:20:17 +0000 Subject: [PATCH 24/36] Visual Studio --- src/graphics.c | 2 +- src/interface.c | 3 ++- src/main.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/graphics.c b/src/graphics.c index ddb836898..fb3d384f5 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -2927,9 +2927,9 @@ void draw_parts(pixel *vid) void draw_wavelengths(pixel *vid, int x, int y, int h, int wl) { - fillrect(vid,x-1,y-1,30+1,h+1,64,64,64,255); // coords -1 size +1 to work around bug in fillrect - TODO: fix fillrect int i,cr,cg,cb,j; int tmp; + fillrect(vid,x-1,y-1,30+1,h+1,64,64,64,255); // coords -1 size +1 to work around bug in fillrect - TODO: fix fillrect for (i=0;i<30;i++) { if ((wl>>i)&1) diff --git a/src/interface.c b/src/interface.c index 72d710761..45cc83996 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2840,11 +2840,12 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) data = http_async_req_stop(http, &status, &data_size); if (status == 200) { + pixel *full_save; if (!data||!data_size) { error_ui(vid_buf, 0, "Save data is empty (may be corrupt)"); break; } - pixel *full_save = prerender_save(data, data_size, &imgw, &imgh); + full_save = prerender_save(data, data_size, &imgw, &imgh); if (full_save!=NULL) { save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2); data_ready = 1; diff --git a/src/main.c b/src/main.c index b06693c06..f8ea58ff7 100644 --- a/src/main.c +++ b/src/main.c @@ -1195,7 +1195,6 @@ int main(int argc, char *argv[]) int pastFPS = 0; int past = 0; pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - pers_bg = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); void *http_ver_check; void *http_session_check = NULL; char *ver_data=NULL, *check_data=NULL, *tmp; @@ -1214,6 +1213,7 @@ int main(int argc, char *argv[]) int save_mode=0, save_x=0, save_y=0, save_w=0, save_h=0, copy_mode=0; SDL_AudioSpec fmt; int username_flash = 0, username_flash_t = 1; + pers_bg = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); GSPEED = 1; /* Set 16-bit stereo audio at 22Khz */ From 15deb1145b14a808adad6ab89639034db365ddca Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 16 Mar 2011 14:58:58 -0400 Subject: [PATCH 25/36] PRTO fix --- src/elements/prto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/elements/prto.c b/src/elements/prto.c index 8f743e702..fbbd5a13f 100644 --- a/src/elements/prto.c +++ b/src/elements/prto.c @@ -6,8 +6,8 @@ int update_PRTO(UPDATE_FUNC_ARGS) { parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1); if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1; else if (parts[i].tmp<0) parts[i].tmp = 0; - for (rx=-1; rx<2; rx++) - for (ry=-1; ry<2; ry++) + for (rx=1; rx>-2; rx--) + for (ry=1; ry>-2; ry--) if (x+rx>=0 && y+ry>0 && x+rx8) - randomness=8; + if (randomness>9) + randomness=9; if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)// TODO: make it look better { create_part(-1,x+1,y,portal[parts[i].tmp][randomness-1][nnx]); From 3b3a173dc95ca298c8472a3a2042f0e4e8198629 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 17 Mar 2011 21:42:07 +0000 Subject: [PATCH 26/36] Remove neutrons from pmap --- src/main.c | 3 ++- src/powder.c | 43 +++++++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/main.c b/src/main.c index f8ea58ff7..572ac19b4 100644 --- a/src/main.c +++ b/src/main.c @@ -339,7 +339,8 @@ void *build_save(int *size, int x0, int y0, int w, int h) y = (int)(parts[i].y+0.5f); if (x>=x0 && x=y0 && y> 8; if (r && e>8)==e) pmap[ny][nx] = (s&~(0xFF))|parts[s>>8].type; + parts[e].x = x; + parts[e].y = y; + pmap[y][x] = (e<<8)|parts[e].type; + parts[s>>8].x = nx; + parts[s>>8].y = ny; + return 1; + } + if ((pmap[ny][nx]>>8)==e) pmap[ny][nx] = 0; parts[e].x += x-nx; parts[e].y += y-ny; @@ -457,7 +471,7 @@ inline void part_change_type(int i, int x, int y, int t) if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART || t<0 || t>=PT_NUM) return; parts[i].type = t; - if (t==PT_PHOT)// || t==PT_NEUT) + if (t==PT_PHOT || t==PT_NEUT) { photons[y][x] = t|(i<<8); if ((pmap[y][x]>>8)==i) @@ -505,9 +519,9 @@ inline int create_n_parts(int n, int x, int y, float vx, float vy, int t) parts[i].ctype = 0; parts[i].temp += (n*17); parts[i].tmp = 0; - if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT && !pmap[y][x])// && t!=PT_NEUT) + if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT && t!=PT_NEUT && !pmap[y][x]) pmap[y][x] = t|(i<<8); - else if (t==PT_PHOT && !photons[y][x]) + else if ((t==PT_PHOT||t==PT_NEUT) && !photons[y][x]) photons[y][x] = t|(i<<8); pv[y/CELL][x/CELL] += 6.0f * CFDS; @@ -627,7 +641,7 @@ inline int create_part(int p, int x, int y, int t) } return -1; } - if (photons[y][x] && t==PT_PHOT) + if (photons[y][x] && (t==PT_PHOT||t==PT_NEUT)) return -1; if (pfree == -1) return -1; @@ -735,8 +749,6 @@ inline int create_part(int p, int x, int y, int t) parts[i].vx = 3.0f*cosf(a); parts[i].vy = 3.0f*sinf(a); } - if (t==PT_PHOT) - photons[y][x] = t|(i<<8); if (t==PT_STKM) { if (isplayer==0) @@ -855,7 +867,9 @@ inline int create_part(int p, int x, int y, int t) } if (t==PT_BIZR||t==PT_BIZRG) parts[i].ctype = 0x47FFFF; - if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP + if (t==PT_PHOT||t==PT_NEUT) + photons[y][x] = t|(i<<8); + if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT && t!=PT_NEUT) // is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP pmap[y][x] = t|(i<<8); return i; @@ -2051,13 +2065,13 @@ killed: if (ny!=y || nx!=x) { if ((pmap[y][x]>>8)==i) pmap[y][x] = 0; - else if (t==PT_PHOT&&(photons[y][x]>>8)==i) photons[y][x] = 0; + else if ((photons[y][x]>>8)==i) photons[y][x] = 0; if (nx=XRES-CELL || ny=YRES-CELL) { kill_part(i); continue; } - if (t==PT_PHOT) + if (t==PT_PHOT||t==PT_NEUT) photons[ny][nx] = t|(i<<8); else pmap[ny][nx] = t|(i<<8); @@ -2092,12 +2106,13 @@ void update_particles(pixel *vid) t = parts[i].type; x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); - if (x>=0 && y>=0 && x=0 && y>=0 && x Date: Thu, 17 Mar 2011 22:05:09 +0000 Subject: [PATCH 27/36] Fix incorrect pitch in sdl_seticon Was causing garbled icon on linux. 16 pixels * 4 bytes per pixel = 64, not 128. --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 572ac19b4..78f4414fe 100644 --- a/src/main.c +++ b/src/main.c @@ -210,7 +210,7 @@ void sdl_seticon(void) //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); #else - SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 64, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); #endif #endif From 495eda27a5f648c2583be812c48737399b66da58 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Fri, 18 Mar 2011 00:13:56 +0000 Subject: [PATCH 28/36] Update icon.h to match icon image files --- includes/icon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/icon.h b/includes/icon.h index 89b2c7f83..4eeff5ec3 100755 --- a/includes/icon.h +++ b/includes/icon.h @@ -18,5 +18,5 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ -static unsigned char app_icon[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x05,0x06,0x06,0xFF,0x09,0x09,0x0A,0xFF,0x2F,0x08,0x08,0xFF,0x56,0x06,0x07,0xFF,0x23,0x06,0x06,0xFF,0x85,0x02,0x06,0xFF,0xE5,0x02,0x07,0xFF,0xF2,0x1E,0x08,0xFF,0xED,0x0A,0x08,0xFF,0x60,0x07,0x08,0xFF,0x5F,0x08,0x08,0xFF,0x68,0x08,0x08,0xFF,0x18,0x07,0x08,0xFF,0x05,0x04,0x04,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xB6,0x00,0x00,0xFF,0xD3,0x00,0x00,0xFF,0xEE,0x00,0x00,0xFF,0xF9,0x00,0x00,0xFF,0x91,0x00,0x00,0xFF,0xDD,0x15,0x00,0xFF,0xFF,0x74,0x00,0xFF,0xFF,0xBF,0x00,0xFF,0xFC,0x37,0x00,0xFF,0xAE,0x00,0x00,0xFF,0xD7,0x00,0x00,0xFF,0xFA,0x00,0x00,0xFF,0xE5,0x01,0x00,0xFF,0xB3,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xF9,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xE9,0x00,0x00,0xFF,0xFA,0x90,0x02,0xFF,0xFF,0xFF,0x1A,0xFF,0xFF,0xFF,0x19,0xFF,0xFF,0xA4,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xF6,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xE8,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0xB7,0x2E,0xFF,0xFF,0xFF,0xA1,0xFF,0xFF,0xFF,0x8A,0xFF,0xFF,0xFA,0x3E,0xFF,0xFF,0x63,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xE3,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xE4,0x00,0x00,0xFF,0xFF,0x21,0x00,0xFF,0xFF,0x61,0x00,0xFF,0xFF,0x94,0x00,0xFF,0xFF,0x8C,0x00,0xFF,0xFF,0xE1,0x5C,0xFF,0xFF,0xFF,0xCD,0xFF,0xFF,0xFF,0xAE,0xFF,0xFF,0xFF,0x6F,0xFF,0xFF,0xF9,0x1D,0xFF,0xFF,0xC3,0x00,0xFF,0xFF,0x99,0x00,0xFF,0xFF,0x48,0x00,0xFF,0xDF,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xC5,0x00,0x00,0xFF,0xFF,0x64,0x00,0xFF,0xFF,0xEF,0x09,0xFF,0xFF,0xFF,0x46,0xFF,0xFF,0xFF,0x84,0xFF,0xFF,0xFF,0xD3,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xBC,0xFF,0xFF,0xFF,0x86,0xFF,0xFF,0xFF,0x69,0xFF,0xFF,0xFF,0x19,0xFF,0xFF,0x81,0x00,0xFF,0xD0,0x01,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xB1,0x00,0x00,0xFF,0xEC,0x14,0x00,0xFF,0xFF,0x90,0x13,0xFF,0xFF,0xF9,0x8E,0xFF,0xFF,0xFF,0xE6,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0xFF,0xFF,0xF2,0xC9,0xFF,0xFF,0xFA,0xBD,0xFF,0xFF,0xFF,0xA8,0xFF,0xFF,0xFC,0x9A,0xFF,0xFF,0xA4,0x2A,0xFF,0xFD,0x15,0x00,0xFF,0xEB,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x00,0x00,0x00,0xFF,0x47,0x14,0x14,0xFF,0x47,0x14,0x14,0xFF,0x00,0x00,0x00,0xFF,0x1F,0x30,0xD5,0xFF,0x1F,0x30,0xD5,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x79,0x79,0x79,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF }; +static unsigned char app_icon[] = {0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0xd3,0xd9,0xe0,0xff,0x68,0x79,0x91,0xff,0xd3,0xd9,0xe0,0xff,0x68,0x79,0x91,0xff,0xd3,0xd9,0xe0,0xff,0x68,0x79,0x91,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x56,0x03,0x08,0xff,0xdb,0x07,0x05,0xff,0xff,0xc4,0x10,0xff,0xff,0xfe,0x14,0xff,0xff,0xff,0x23,0xff,0xff,0xff,0x16,0xff,0xff,0x9a,0x0a,0xff,0xff,0x64,0x0c,0xff,0xff,0x44,0x0a,0xff,0xff,0x22,0x0b,0xff,0xc0,0x24,0x0d,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0xff,0x24,0x00,0xff,0xff,0x96,0x1c,0xff,0xff,0xff,0x89,0xff,0xff,0xff,0x30,0xff,0xff,0xfd,0x00,0xff,0xff,0xd6,0x03,0xff,0xff,0x63,0x01,0xff,0xff,0x9a,0x00,0xff,0xff,0xbe,0x0a,0xff,0xff,0x5e,0x00,0xff,0xc3,0x0c,0x0c,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0xff,0xe2,0x41,0xff,0xff,0xff,0xd8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe9,0xff,0xff,0xf3,0x43,0xff,0xff,0xe8,0x00,0xff,0xff,0xfb,0x15,0xff,0xff,0xff,0x62,0xff,0xff,0xff,0xc6,0xff,0xff,0xff,0x5b,0xff,0xc2,0x77,0x08,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0xff,0xff,0xcc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc6,0xff,0xff,0xff,0x99,0xff,0xff,0xff,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcf,0xff,0xc4,0xae,0x26,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0xff,0xda,0x87,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfd,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcd,0xff,0xc1,0x89,0x20,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0xff,0x68,0x09,0xff,0xff,0xf5,0x72,0xff,0xff,0xff,0xbf,0xff,0xff,0xff,0xe0,0xff,0xff,0xff,0xe5,0xff,0xff,0xfd,0xcf,0xff,0xff,0xf5,0xcd,0xff,0xff,0xff,0xd4,0xff,0xff,0xff,0xd0,0xff,0xff,0xf2,0x3d,0xff,0xc3,0x48,0x03,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x98,0x15,0x0f,0xff,0xaf,0x3d,0x09,0xff,0xad,0x4f,0x0d,0xff,0xae,0x6b,0x1b,0xff,0xb0,0x76,0x1e,0xff,0xa1,0x36,0x08,0xff,0x95,0x26,0x07,0xff,0xad,0x5b,0x16,0xff,0xbf,0x99,0x26,0xff,0xad,0x59,0x09,0xff,0x76,0x22,0x16,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff,0x8f,0x92,0x97,0xff}; static unsigned char app_icon_w32[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x44,0x47,0x49,0x00,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x86,0x88,0x8A,0xFF,0xD8,0xDE,0xE6,0xFF,0xD1,0xD7,0xDF,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x81,0x84,0x88,0xFF,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x83,0x85,0x89,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1E,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x14,0x00,0x00,0xFF,0xE1,0x01,0x00,0xFF,0xF4,0x03,0x00,0xFF,0x24,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x86,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x0F,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0xE7,0x0A,0x01,0xFF,0xFF,0x07,0x01,0xFF,0x41,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0x16,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x0B,0x00,0x00,0xFF,0x55,0x02,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x39,0x00,0x00,0xFF,0xF8,0x1B,0x02,0xFF,0xFF,0x2F,0x03,0xFF,0x52,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1C,0x00,0x00,0xFF,0x5C,0x01,0x00,0xFF,0x09,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0xAE,0x04,0x01,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x50,0x00,0x00,0xFF,0xFE,0x44,0x02,0xFF,0xFF,0x5C,0x03,0xFF,0x60,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x12,0x00,0x00,0xFF,0x9F,0x02,0x00,0xFF,0x49,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x73,0x04,0x00,0xFF,0xEC,0x09,0x01,0xFF,0x2B,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x13,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x4E,0x06,0x00,0xFF,0xFF,0xC1,0x08,0xFF,0xFD,0x9A,0x07,0xFF,0x49,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x01,0x00,0xFF,0xD5,0x03,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0xB7,0x0D,0x01,0xFF,0xFF,0x0F,0x02,0xFF,0xDE,0x00,0x00,0xFF,0xAB,0x00,0x00,0xFF,0xA5,0x01,0x00,0xFF,0x3D,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x35,0x03,0xFF,0xFF,0xF0,0x0E,0xFF,0xDF,0x4B,0x01,0xFF,0x14,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x55,0x00,0x00,0xFF,0xFF,0x05,0x01,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xE5,0x0F,0x01,0xFF,0xFF,0x0D,0x02,0xFF,0xFF,0x04,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xFF,0x01,0x00,0xFF,0x8F,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xD9,0x47,0x03,0xFF,0xFF,0x92,0x06,0xFF,0xAF,0x12,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x20,0x00,0x00,0xFF,0xE5,0x08,0x01,0xFF,0xD1,0x04,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x30,0x01,0x00,0xFF,0xF6,0x47,0x04,0xFF,0xFF,0x1F,0x02,0xFF,0xFF,0x03,0x01,0xFF,0xFF,0x06,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xC7,0x01,0x00,0xFF,0x1F,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x06,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x38,0x02,0x00,0xFF,0xFB,0x72,0x07,0xFF,0xFF,0x5A,0x03,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xA1,0x02,0x00,0xFF,0xFF,0x0C,0x03,0xFF,0x7B,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x06,0x00,0xFF,0xFF,0xBB,0x0C,0xFF,0xFF,0x56,0x04,0xFF,0xFF,0x00,0x01,0xFF,0xFF,0x10,0x03,0xFF,0xFF,0x02,0x01,0xFF,0xDE,0x01,0x00,0xFF,0x34,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x05,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x03,0x00,0xFF,0xFC,0x83,0x06,0xFF,0xFF,0x71,0x03,0xFF,0x83,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFB,0x18,0x03,0xFF,0xFF,0x0E,0x02,0xFF,0xB9,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x21,0x01,0x00,0xFF,0xE8,0xB9,0x0F,0xFF,0xFF,0x8F,0x0C,0xFF,0xFF,0x02,0x00,0xFF,0xFF,0x3C,0x04,0xFF,0xFF,0x16,0x02,0xFF,0xFD,0x00,0x00,0xFF,0x63,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x40,0x0B,0x00,0xFF,0xFE,0xAD,0x06,0xFF,0xFF,0xC9,0x06,0xFF,0xCC,0x45,0x02,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x49,0x03,0xFF,0xFF,0x7E,0x03,0xFF,0xFF,0x45,0x01,0xFF,0x67,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x09,0x00,0x00,0xFF,0xCC,0xA0,0x08,0xFF,0xFB,0xAA,0x0A,0xFF,0xC9,0x00,0x00,0xFF,0xFE,0x6B,0x03,0xFF,0xFF,0x79,0x02,0xFF,0xF9,0x0A,0x00,0xFF,0x4C,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3F,0x14,0x00,0xFF,0xFC,0xDF,0x10,0xFF,0xFF,0xFF,0x10,0xFF,0xFA,0xCD,0x14,0xFF,0x46,0x0C,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x7F,0x03,0xFF,0xFF,0xFF,0x06,0xFF,0xFF,0xE7,0x03,0xFF,0xD5,0x39,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x06,0x00,0xFF,0xEA,0xCF,0x17,0xFF,0xE2,0xA6,0x10,0xFF,0x32,0x00,0x00,0xFF,0xCB,0x80,0x06,0xFF,0xFF,0xF4,0x09,0xFF,0xD8,0x44,0x00,0xFF,0x10,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x44,0x21,0x00,0xFF,0xFD,0xE9,0x1C,0xFF,0xFF,0xD6,0x09,0xFF,0xFF,0xFF,0x28,0xFF,0xB4,0x75,0x04,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x8D,0x03,0xFF,0xFF,0xFF,0x41,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0x7E,0x01,0xFF,0x4C,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x49,0x30,0x04,0xFF,0xFF,0xFC,0x5A,0xFF,0xB0,0x7E,0x14,0xFF,0x00,0x00,0x00,0xFF,0x89,0x66,0x0F,0xFF,0xFF,0xFF,0x6B,0xFF,0xE6,0xA7,0x1E,0xFF,0x1E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x6F,0x5A,0x18,0xFF,0xFF,0xFE,0x70,0xFF,0xCD,0x6C,0x04,0xFF,0xE8,0xB5,0x27,0xFF,0xFE,0xF3,0x60,0xFF,0x6E,0x3D,0x08,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xDB,0x8A,0x26,0xFF,0xFF,0xFF,0xD5,0xFF,0xFF,0xFF,0xD8,0xFF,0xFF,0xCF,0x3A,0xFF,0x94,0x12,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x15,0x0A,0x01,0xFF,0xBF,0xAC,0x7E,0xFF,0xFF,0xFF,0xDE,0xFF,0x82,0x5F,0x20,0xFF,0x00,0x00,0x00,0xFF,0x67,0x5B,0x28,0xFF,0xFF,0xFF,0xF3,0xFF,0xFF,0xF1,0xAA,0xFF,0x5D,0x2E,0x07,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x18,0x0D,0x02,0xFF,0xD0,0xC0,0x90,0xFF,0xFF,0xFF,0xF4,0xFF,0x92,0x61,0x27,0xFF,0x72,0x3F,0x0F,0xFF,0xFF,0xFF,0xE2,0xFF,0xFA,0xE5,0xAE,0xFF,0x80,0x4B,0x19,0xFF,0x02,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xC9,0xA1,0x64,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xB2,0xFF,0xA1,0x33,0x03,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x96,0x7E,0x5E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7E,0x6A,0x41,0xFF,0x00,0x00,0x00,0xFF,0x7F,0x75,0x56,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA9,0x8D,0x54,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8C,0x69,0x4F,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x93,0x82,0x58,0xFF,0x16,0x05,0x00,0xFF,0xEB,0xDB,0xB8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF2,0xBD,0xFF,0x62,0x42,0x14,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xA3,0x7F,0x47,0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xDD,0xA4,0xFF,0x51,0x19,0x02,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0xD0,0xB6,0x88,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x6A,0x5A,0x39,0xFF,0x00,0x00,0x00,0xFF,0x85,0x7D,0x4E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xB4,0xA5,0x73,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0xB5,0x9B,0x6F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8B,0x78,0x4E,0xFF,0x00,0x00,0x00,0xFF,0xCC,0xAE,0x7E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8F,0x74,0x38,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x24,0x14,0x03,0xFF,0x8C,0x7E,0x44,0xFF,0xA2,0x8E,0x5D,0xFF,0x5B,0x37,0x17,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x71,0x46,0x1E,0xFF,0xCB,0xA4,0x71,0xFF,0xAC,0x93,0x66,0xFF,0x17,0x0E,0x04,0xFF,0x00,0x00,0x00,0xFF,0x30,0x23,0x0A,0xFF,0xBF,0xA4,0x60,0xFF,0xC4,0xAC,0x78,0xFF,0x43,0x34,0x1A,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x5C,0x3D,0x18,0xFF,0xC9,0xA9,0x6F,0xFF,0xB8,0x94,0x63,0xFF,0x2A,0x19,0x07,0xFF,0x00,0x00,0x00,0xFF,0x53,0x3B,0x16,0xFF,0xC7,0xB6,0x70,0xFF,0xBD,0xA2,0x66,0xFF,0x2C,0x1C,0x09,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x47,0x14,0x14,0xFF,0x47,0x14,0x14,0xFF,0x00,0x00,0x00,0xFF,0x1F,0x30,0xD6,0xFF,0x1F,0x30,0xD6,0xFF,0x00,0x00,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0x00,0x00,0x00,0xFF,0xC8,0x47,0x0E,0xFF,0xC8,0x47,0x0E,0xFF,0x00,0x00,0x00,0xFF,0x20,0xE6,0x0F,0xFF,0x20,0xE6,0x0F,0xFF,0x00,0x00,0x00,0xFF,0xEB,0xF5,0x22,0xFF,0xEB,0xF5,0x22,0xFF,0x00,0x00,0x00,0xFF,0x40,0x40,0x40,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0x79,0x79,0x79,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x44,0x46,0x48,0x00,0x7A,0x7D,0x81,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x83,0x86,0x8A,0xFF,0x86,0x89,0x8C,0xFF,0x89,0x8C,0x8F,0xFF,0x87,0x8A,0x8F,0xFF,0x85,0x87,0x8B,0xFF,0x82,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00 }; \ No newline at end of file From 1802c160c48c1e36609ddd4246ff5b4913a087cb Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Fri, 18 Mar 2011 00:26:12 +0000 Subject: [PATCH 29/36] Remove code to delete SPAWN when stickman produced Code doesn't actually do anything in official source, due to operator precedence and lack of brackets. --- src/powder.c | 64 +++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/src/powder.c b/src/powder.c index 61cf2ed67..5ce7575e0 100644 --- a/src/powder.c +++ b/src/powder.c @@ -753,29 +753,14 @@ inline int create_part(int p, int x, int y, int t) { if (isplayer==0) { - if ((pmap[y][x]&0xFF)==PT_SPAWN) - { - parts[pmap[y][x]>>8].type = PT_STKM; - parts[pmap[y][x]>>8].vx = 0; - parts[pmap[y][x]>>8].vy = 0; - parts[pmap[y][x]>>8].life = 100; - parts[pmap[y][x]>>8].ctype = 0; - parts[pmap[y][x]>>8].temp = ptypes[t].heat; - - } - else - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - - + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; player[3] = x-1; //Setting legs positions player[4] = y+6; @@ -803,7 +788,6 @@ inline int create_part(int p, int x, int y, int t) { return -1; } - //kill_part(playerspawn); create_part(-1,x,y,PT_SPAWN); ISSPAWN1 = 1; } @@ -811,29 +795,14 @@ inline int create_part(int p, int x, int y, int t) { if (isplayer2==0) { - if ((pmap[y][x]&0xFF)==PT_SPAWN2) - { - parts[pmap[y][x]>>8].type = PT_STKM2; - parts[pmap[y][x]>>8].vx = 0; - parts[pmap[y][x]>>8].vy = 0; - parts[pmap[y][x]>>8].life = 100; - parts[pmap[y][x]>>8].ctype = 0; - parts[pmap[y][x]>>8].temp = ptypes[t].heat; - - } - else - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM2; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - - + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM2; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; player2[3] = x-1; //Setting legs positions player2[4] = y+6; @@ -861,7 +830,6 @@ inline int create_part(int p, int x, int y, int t) { return -1; } - //kill_part(player2spawn); create_part(-1,x,y,PT_SPAWN2); ISSPAWN2 = 1; } From 6ef9f0300ed36c7583db996c8ce0f5ea87a96f11 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Mon, 7 Mar 2011 00:32:04 -0500 Subject: [PATCH 30/36] check bounds for wind, causes some funny glitches though. --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 78f4414fe..f16ba1c9d 100644 --- a/src/main.c +++ b/src/main.c @@ -2417,7 +2417,7 @@ int main(int argc, char *argv[]) { for (j=-bsy; j<=bsy; j++) for (i=-bsx; i<=bsx; i++) - if ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(bsx,2))+(pow(j,2))/(pow(bsy,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx)) + if (x+i>0 && y+j>0 && x+i Date: Fri, 18 Mar 2011 11:56:32 +0000 Subject: [PATCH 31/36] Add some arguments to save build/parse functions To make clipboard manipulation easier. --- includes/defines.h | 4 ++-- src/interface.c | 4 ++-- src/main.c | 16 +++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index 898edaf9b..8fb8fc85a 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -174,8 +174,8 @@ 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 *build_save(int *size, int x0, int y0, int w, int h, unsigned char bmap[YRES/CELL][XRES/CELL], float fvx[YRES/CELL][XRES/CELL], float fvy[YRES/CELL][XRES/CELL], sign signs[MAXSIGNS], void* partsptr); +int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char bmap[YRES/CELL][XRES/CELL], float fvx[YRES/CELL][XRES/CELL], float fvy[YRES/CELL][XRES/CELL], sign signs[MAXSIGNS], void* partsptr, unsigned pmap[YRES][XRES]); void clear_sim(void); void del_stamp(int d); void sdl_seticon(void); diff --git a/src/interface.c b/src/interface.c index 45cc83996..8ba00a54f 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3076,7 +3076,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) if (queue_open) { if (info_ready && data_ready) { // Do Open! - status = parse_save(data, data_size, 1, 0, 0); + status = parse_save(data, data_size, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap); if (!status) { //if(svf_last) //free(svf_last); @@ -3598,7 +3598,7 @@ void execute_save(pixel *vid_buf) plens[0] = strlen(svf_name); parts[1] = svf_description; plens[1] = strlen(svf_description); - parts[2] = build_save(plens+2, 0, 0, XRES, YRES); + parts[2] = build_save(plens+2, 0, 0, XRES, YRES, bmap, fvx, fvy, signs, parts); parts[3] = build_thumb(plens+3, 1); parts[4] = (svf_publish==1)?"Public":"Private"; plens[4] = strlen((svf_publish==1)?"Public":"Private"); diff --git a/src/main.c b/src/main.c index f16ba1c9d..41b5e4a59 100644 --- a/src/main.c +++ b/src/main.c @@ -296,11 +296,12 @@ void *build_thumb(int *size, int bzip2) return d; } -void *build_save(int *size, int x0, int y0, int w, int h) +void *build_save(int *size, int x0, int y0, int w, int h, unsigned char bmap[YRES/CELL][XRES/CELL], float fvx[YRES/CELL][XRES/CELL], float fvy[YRES/CELL][XRES/CELL], sign signs[MAXSIGNS], void* partsptr) { unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*11+MAXSIGNS*262), *c; int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; + particle *parts = partsptr; // normalize coordinates x0 = bx0*CELL; @@ -466,12 +467,13 @@ void *build_save(int *size, int x0, int y0, int w, int h) return c; } -int parse_save(void *save, int size, int replace, int x0, int y0) +int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char bmap[YRES/CELL][XRES/CELL], float fvx[YRES/CELL][XRES/CELL], float fvy[YRES/CELL][XRES/CELL], sign signs[MAXSIGNS], void* partsptr, unsigned pmap[YRES][XRES]) { unsigned char *d,*c=save; int q,i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; int fp[NPART], nf=0, new_format = 0, ttv = 0; + particle *parts = partsptr; //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error @@ -996,7 +998,7 @@ void stamp_save(int x, int y, int w, int h) FILE *f; int n; char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h); + void *s=build_save(&n, x, y, w, h, bmap, fvx, fvy, signs, parts); #ifdef WIN32 _mkdir("stamps"); @@ -2146,7 +2148,7 @@ int main(int argc, char *argv[]) if (load_y<0) load_y=0; if (bq==1 && !b) { - parse_save(load_data, load_size, 0, load_x, load_y); + parse_save(load_data, load_size, 0, load_x, load_y, bmap, fvx, fvy, signs, parts, pmap); free(load_data); free(load_img); load_mode = 0; @@ -2188,14 +2190,14 @@ int main(int argc, char *argv[]) { if (copy_mode==1) { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL, bmap, fvx, fvy, signs, parts); clipboard_ready = 1; save_mode = 0; copy_mode = 0; } else if (copy_mode==2) { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL, bmap, fvx, fvy, signs, parts); clipboard_ready = 1; save_mode = 0; copy_mode = 0; @@ -2327,7 +2329,7 @@ int main(int argc, char *argv[]) } if (x>=19 && x<=35 && svf_last && svf_open && !bq) { //int tpval = sys_pause; - parse_save(svf_last, svf_lsize, 1, 0, 0); + parse_save(svf_last, svf_lsize, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap); //sys_pause = tpval; } if (x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) From d924a5554a8fa0ead5d17f69e10d46e14a64b5dc Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Fri, 18 Mar 2011 12:46:06 +0000 Subject: [PATCH 32/36] Matrices and vectors, to make coding next commit more pleasant --- includes/misc.h | 23 +++++++++++++++++ src/misc.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/includes/misc.h b/includes/misc.h index 4094b3931..a929f8c62 100644 --- a/includes/misc.h +++ b/includes/misc.h @@ -71,4 +71,27 @@ void *file_load(char *fn, int *size); int cpu_check(void); +// a b +// c d +struct matrix2d {float a,b,c,d;}; +typedef struct matrix2d matrix2d; + +// column vector +struct vector2d {float x,y;}; +typedef struct vector2d vector2d; + +matrix2d m2d_multiply_m2d(matrix2d m1, matrix2d m2); +vector2d m2d_multiply_v2d(matrix2d m, vector2d v); +matrix2d m2d_multiply_float(matrix2d m, float s); +vector2d v2d_multiply_float(vector2d v, float s); + +vector2d v2d_add(vector2d v1, vector2d v2); +vector2d v2d_sub(vector2d v1, vector2d v2); + +matrix2d m2d_new(float me0, float me1, float me2, float me3); +vector2d v2d_new(float x, float y); + +extern vector2d v2d_zero; +extern matrix2d m2d_identity; + #endif diff --git a/src/misc.c b/src/misc.c index c98c5a3c0..eb54dfb0e 100644 --- a/src/misc.c +++ b/src/misc.c @@ -306,3 +306,68 @@ int cpu_check(void) #endif return 0; } + +matrix2d m2d_multiply_m2d(matrix2d m1, matrix2d m2) +{ + matrix2d result = { + m1.a*m2.a+m1.b*m2.c, m1.a*m2.b+m1.b*m2.d, + m1.c*m2.a+m1.d*m2.c, m1.c*m2.b+m1.d*m2.d + }; + return result; +} +vector2d m2d_multiply_v2d(matrix2d m, vector2d v) +{ + vector2d result = { + m.a*v.x+m.b*v.y, + m.c*v.x+m.d*v.y + }; + return result; +} +matrix2d m2d_multiply_float(matrix2d m, float s) +{ + matrix2d result = { + m.a*s, m.b*s, + m.c*s, m.d*s, + }; + return result; +} + +vector2d v2d_multiply_float(vector2d v, float s) +{ + vector2d result = { + v.x*s, + v.y*s + }; + return result; +} + +vector2d v2d_add(vector2d v1, vector2d v2) +{ + vector2d result = { + v1.x+v2.x, + v1.y+v2.y + }; + return result; +} +vector2d v2d_sub(vector2d v1, vector2d v2) +{ + vector2d result = { + v1.x-v2.x, + v1.y-v2.y + }; + return result; +} + +matrix2d m2d_new(float me0, float me1, float me2, float me3) +{ + matrix2d result = {me0,me1,me2,me3}; + return result; +} +vector2d v2d_new(float x, float y) +{ + vector2d result = {x, y}; + return result; +} + +vector2d v2d_zero = {0,0}; +matrix2d m2d_identity = {1,0,0,1}; From d46a3bdcb083075a4737125f1c71899e6489ecfa Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Fri, 18 Mar 2011 19:33:38 +0000 Subject: [PATCH 33/36] Better rotation and inversion, also does single pixel translation --- includes/powder.h | 2 + src/main.c | 42 ++++++++++++++---- src/powder.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+), 9 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 581c8da4a..d7e4daa0e 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -5,6 +5,7 @@ #include "graphics.h" #include "defines.h" #include "interface.h" +#include "misc.h" #define CM_COUNT 11 #define CM_CRACK 10 @@ -863,5 +864,6 @@ int flood_parts(int x, int y, int c, int cm, int bm); int create_parts(int x, int y, int rx, int ry, int c); void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c); +void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate); #endif diff --git a/src/main.c b/src/main.c index 41b5e4a59..5f5e7a4ac 100644 --- a/src/main.c +++ b/src/main.c @@ -1797,17 +1797,41 @@ int main(int argc, char *argv[]) } } } - if (sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT))) + if (load_mode==1) { - save_mode = 1; - copy_mode = 4;//invert + matrix2d transform = m2d_identity; + vector2d translate = v2d_zero; + void *ndata; + int doTransform = 0; + if (sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT))) + { + transform = m2d_new(-1,0,0,1); //horizontal invert + doTransform = 1; + } + else if (sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + transform = m2d_new(0,-1,1,0); //rotate anticlockwise 90 degrees + doTransform = 1; + } + else if (sdl_mod & (KMOD_CTRL)) + { + doTransform = 1; + if (sdl_key==SDLK_LEFT) translate = v2d_new(-1,0); + else if (sdl_key==SDLK_RIGHT) translate = v2d_new(1,0); + else if (sdl_key==SDLK_UP) translate = v2d_new(0,-1); + else if (sdl_key==SDLK_DOWN) translate = v2d_new(0,1); + else doTransform = 0; + } + if (doTransform) + { + ndata = transform_save(load_data, &load_size, transform, translate); + if (ndata!=load_data) free(load_data); + free(load_img); + load_data = ndata; + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + } } - else if (sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 3;//rotate - } - else if (sdl_key=='r') + if (sdl_key=='r'&&!(sdl_mod & (KMOD_CTRL|KMOD_SHIFT))) GENERATION = 0; if (sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) { diff --git a/src/powder.c b/src/powder.c index 5ce7575e0..fc73276f4 100644 --- a/src/powder.c +++ b/src/powder.c @@ -3040,3 +3040,109 @@ void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c) } } } + +void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate) +{ + void *ndata; + unsigned char bmapo[YRES/CELL][XRES/CELL], bmapn[YRES/CELL][XRES/CELL]; + particle *partst; + sign signst[MAXSIGNS]; + unsigned pmapt[YRES][XRES]; + float fvxo[YRES/CELL][XRES/CELL], fvyo[YRES/CELL][XRES/CELL]; + float fvxn[YRES/CELL][XRES/CELL], fvyn[YRES/CELL][XRES/CELL]; + int i, x, y, nx, ny, w, h, nw, nh; + vector2d pos, tmp, ctl, cbr; + vector2d cornerso[4]; + unsigned char *odatac = odata; + memset(bmapo, 0, sizeof(bmapo)); + memset(bmapn, 0, sizeof(bmapn)); + memset(signst, 0, sizeof(signst)); + memset(pmapt, 0, sizeof(pmapt)); + memset(fvxo, 0, sizeof(fvxo)); + memset(fvxn, 0, sizeof(fvxn)); + memset(fvyo, 0, sizeof(fvyo)); + memset(fvyn, 0, sizeof(fvyn)); + partst = calloc(sizeof(particle), NPART); + if (parse_save(odata, *size, 0, 0, 0, bmapo, fvxo, fvyo, signst, partst, pmapt)) + { + free(partst); + return odata; + } + w = odatac[6]*CELL; + h = odatac[7]*CELL; + // undo any translation caused by rotation + cornerso[0] = v2d_new(0,0); + cornerso[1] = v2d_new(w-1,0); + cornerso[2] = v2d_new(0,h-1); + cornerso[3] = v2d_new(w-1,h-1); + for (i=0;i<4;i++) + { + tmp = m2d_multiply_v2d(transform,cornerso[i]); + if (i==0) ctl = cbr = tmp; // top left, bottom right corner + if (tmp.xcbr.x) cbr.x = tmp.x; + if (tmp.y>cbr.y) cbr.y = tmp.y; + } + // casting as int doesn't quite do what we want with negative numbers, so use floor() + tmp = v2d_new(floor(ctl.x+0.5f),floor(ctl.y+0.5f)); + translate = v2d_sub(translate,tmp); + nw = floor(cbr.x+0.5f)-floor(ctl.x+0.5f)+1; + nh = floor(cbr.y+0.5f)-floor(ctl.y+0.5f)+1; + if (nw>XRES) nw = XRES; + if (nh>YRES) nh = YRES; + // rotate and translate signs, parts, walls + for (i=0; i=nw || ny<0 || ny>=nh) + { + signst[i].text[0] = 0; + continue; + } + signst[i].x = nx; + signst[i].y = ny; + } + for (i=0; i=nw || ny<0 || ny>=nh) + { + partst[i].type = PT_NONE; + continue; + } + partst[i].x = nx; + partst[i].y = ny; + } + for (y=0;y=nw || ny<0 || ny>=nh) + continue; + if (bmapo[y][x]) + { + bmapn[ny][nx] = bmapo[y][x]; + if (bmapo[y][x]==WL_FAN) + { + fvxn[ny][nx] = fvxo[y][x]; + fvyn[ny][nx] = fvyo[y][x]; + } + } + } + ndata = build_save(size,0,0,nw,nh,bmapn,fvxn,fvyn,signst,partst); + free(partst); + return ndata; +} + From f316b1fdb927f2ca1c20a5ae58611d6c2cf6d442 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Fri, 18 Mar 2011 20:02:21 +0000 Subject: [PATCH 34/36] Remove redundant rotate/invert code and correct rotation direction --- src/main.c | 27 ++--------------- src/powder.c | 84 ---------------------------------------------------- 2 files changed, 2 insertions(+), 109 deletions(-) diff --git a/src/main.c b/src/main.c index 5f5e7a4ac..7f49d9b0a 100644 --- a/src/main.c +++ b/src/main.c @@ -1810,7 +1810,7 @@ int main(int argc, char *argv[]) } else if (sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) { - transform = m2d_new(0,-1,1,0); //rotate anticlockwise 90 degrees + transform = m2d_new(0,1,-1,0); //rotate anticlockwise 90 degrees doTransform = 1; } else if (sdl_mod & (KMOD_CTRL)) @@ -2227,22 +2227,6 @@ int main(int argc, char *argv[]) copy_mode = 0; clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); } - else if (copy_mode==3)//rotation - { - if (save_h>save_w) - save_w = save_h; - rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,0);//just do squares for now - save_mode = 0; - copy_mode = 0; - } - else if (copy_mode==4)//invertion - { - if (save_h>save_w) - save_w = save_h; - rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,1);//just do squares for now - save_mode = 0; - copy_mode = 0; - } else { stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); @@ -2564,14 +2548,7 @@ int main(int argc, char *argv[]) if (save_mode) { - if (copy_mode==3||copy_mode==4)//special drawing for rotate, can remove once it can do rectangles - { - if (save_h>save_w) - save_w = save_h; - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL); - } - else - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); da = 51; db = 269; } diff --git a/src/powder.c b/src/powder.c index fc73276f4..7e26422d3 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2590,90 +2590,6 @@ void update_particles(pixel *vid) } -void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert) -{ - //TODO: MSCC doesn't like arrays who's size is determined at runtime. -#if !(defined(WIN32) && !defined(__GNUC__)) - int cx = 0; - int cy = 0; - unsigned tpmap[area_h][area_w]; - unsigned rtpmap[area_w][area_h]; - unsigned char tbmap[area_h/CELL][area_w/CELL]; - unsigned char rtbmap[area_w/CELL][area_h/CELL]; - float tfvy[area_h/CELL][area_w/CELL]; - float tfvx[area_h/CELL][area_w/CELL]; - for (cy=0; cy>8)<=NPART&&rtpmap[cy][cx]) - { - parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>8].x = area_x +cx; - parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>8].y = area_y +cy; - } - bmap[(area_y+cy)/CELL][(area_x+cx)/CELL] = rtbmap[cy/CELL][cx/CELL]; - fvy[(area_y+cy)/CELL][(area_x+cx)/CELL] = tfvy[cy/CELL][cx/CELL]; - fvx[(area_y+cy)/CELL][(area_x+cx)/CELL] = tfvx[cy/CELL][cx/CELL]; - } - } - } -#endif -} - void clear_area(int area_x, int area_y, int area_w, int area_h) { int cx = 0; From 993fb876c92289a65a24de2264924d074ab3a944 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 19 Mar 2011 12:00:53 +0000 Subject: [PATCH 35/36] Fix stickmen photons and neutrons --- src/elements/stkm.c | 25 ++++++++++++++----------- src/elements/stkm2.c | 25 ++++++++++++++----------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/elements/stkm.c b/src/elements/stkm.c index 6d6b4ab55..fc6dc55e3 100644 --- a/src/elements/stkm.c +++ b/src/elements/stkm.c @@ -184,9 +184,11 @@ int update_STKM(UPDATE_FUNC_ARGS) { if (x+rx>=0 && y+ry>0 && x+rx>8)>=NPART) + r = photons[y+ry][x+rx]; if (!r || (r>>8)>=NPART) continue; - if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) // TODO: photons are not in the pmap. This line may not work as intended. + if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) { player[2] = r&0xFF; //Current element } @@ -225,26 +227,27 @@ int update_STKM(UPDATE_FUNC_ARGS) { } else { + int np = -1; if (player[2] == SPC_AIR) create_parts(rx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR); else - create_part(-1, rx, ry, player[2]); - - r = pmap[ry][rx]; - if ( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - if (((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + np = create_part(-1, rx, ry, player[2]); + if ( (np < NPART) && np>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR) + parts[np].vx = parts[np].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if ((np < NPART) && np>=0 && player[2] == PT_PHOT) { int random = abs(rand()%3-1)*3; if (random==0) { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; + kill_part(np); } else { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + parts[np].vy = 0; + if (((int)player[1])&(0x01|0x02)) + parts[np].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + else + parts[np].vx = random; } } diff --git a/src/elements/stkm2.c b/src/elements/stkm2.c index 319e388b3..79dbbdfbc 100644 --- a/src/elements/stkm2.c +++ b/src/elements/stkm2.c @@ -184,9 +184,11 @@ int update_STKM2(UPDATE_FUNC_ARGS) { if (x+rx>=0 && y+ry>0 && x+rx>8)>=NPART) + r = photons[y+ry][x+rx]; if (!r || (r>>8)>=NPART) continue; - if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) // TODO: photons are not in the pmap. This line may not work as intended. + if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) { player2[2] = r&0xFF; //Current element } @@ -225,26 +227,27 @@ int update_STKM2(UPDATE_FUNC_ARGS) { } else { + int np = -1; if (player2[2] == SPC_AIR) create_parts(rx + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR); else - create_part(-1, rx, ry, player2[2]); - - r = pmap[ry][rx]; - if ( ((r>>8) < NPART) && (r>>8)>=0 && player2[2] != PT_PHOT && player2[2] != SPC_AIR) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player2[1])&0x02) == 0x02) - 5*(((int)(player2[1])&0x01) == 0x01); - if (((r>>8) < NPART) && (r>>8)>=0 && player2[2] == PT_PHOT) + np = create_part(-1, rx, ry, player2[2]); + if ((np < NPART) && np>=0 && player2[2] != PT_PHOT && player2[2] != SPC_AIR) + parts[np].vx = parts[np].vx + 5*((((int)player2[1])&0x02) == 0x02) - 5*(((int)(player2[1])&0x01) == 0x01); + if ((np < NPART) && np>=0 && player2[2] == PT_PHOT) { int random = abs(rand()%3-1)*3; if (random==0) { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; + kill_part(np); } else { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player2[1])&0x02) == 0x02) - (((int)(player2[1])&0x01) == 0x01))*random; + parts[np].vy = 0; + if (((int)player2[1])&(0x01|0x02)) + parts[np].vx = (((((int)player2[1])&0x02) == 0x02) - (((int)(player2[1])&0x01) == 0x01))*random; + else + parts[np].vx = random; } } From df27f8420d8bbbf645be6962706a48728859618f Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Mon, 21 Mar 2011 16:26:58 +0000 Subject: [PATCH 36/36] Fix crash when trying to move to invalid co-ordinates --- src/powder.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/powder.c b/src/powder.c index 7e26422d3..b77a52d81 100644 --- a/src/powder.c +++ b/src/powder.c @@ -136,6 +136,8 @@ int try_move(int i, int x, int y, int nx, int ny) if (x==nx && y==ny) return 1; + if (nx<0 || ny<0 || nx>=XRES || ny>=YRES) + return 1; e = eval_move(parts[i].type, nx, ny, &r);