Nibble is a noob, also fix for persistent mode bug

This commit is contained in:
Simon 2010-12-19 14:20:38 +00:00
parent 9c805f8643
commit 92d22ac590
5 changed files with 5293 additions and 5 deletions

View File

@ -131,6 +131,8 @@ void draw_image(pixel *vid, pixel *img, int x, int y, int w, int h, int a);
void dim_copy(pixel *dst, pixel *src); void dim_copy(pixel *dst, pixel *src);
void dim_copy_pers(pixel *dst, pixel *src);
void render_zoom(pixel *img); void render_zoom(pixel *img);
pixel *prerender_save(void *save, int size, int *width, int *height); pixel *prerender_save(void *save, int size, int *width, int *height);

View File

@ -212,7 +212,6 @@ struct particle
float pavg[2]; float pavg[2];
int flags; int flags;
int tmp; int tmp;
int (*update_func) (int);
}; };
typedef struct particle particle; typedef struct particle particle;
@ -240,6 +239,7 @@ struct part_type
unsigned char hconduct; unsigned char hconduct;
const char *descs; const char *descs;
const unsigned short properties; const unsigned short properties;
int (*update_func) (int);
}; };
typedef struct part_type part_type; typedef struct part_type part_type;

5267
powder.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2749,6 +2749,24 @@ void dim_copy(pixel *dst, pixel *src)
} }
} }
void dim_copy_pers(pixel *dst, pixel *src)
{
int i,r,g,b;
for(i=0; i<(XRES+BARSIZE)*YRES; i++)
{
r = PIXR(src[i]);
g = PIXG(src[i]);
b = PIXB(src[i]);
if(r>0)
r--;
if(g>0)
g--;
if(b>0)
b--;
dst[i] = PIXRGB(r,g,b);
}
}
void render_zoom(pixel *img) void render_zoom(pixel *img)
{ {
int x, y, i, j; int x, y, i, j;

View File

@ -1072,6 +1072,7 @@ int main(int argc, char *argv[])
int pastFPS = 0; int pastFPS = 0;
int past = 0; int past = 0;
pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
void *http_ver_check; void *http_ver_check;
char *ver_data=NULL, *tmp; char *ver_data=NULL, *tmp;
int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len; int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len;
@ -1217,8 +1218,8 @@ int main(int argc, char *argv[])
} }
else if(cmode==CM_PERS) else if(cmode==CM_PERS)
{ {
memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); memcpy(vid_buf, pers_bg, (XRES+BARSIZE)*YRES*PIXELSIZE);
memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); memset(vid_buf+((XRES+BARSIZE)*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-((XRES+BARSIZE)*YRES*PIXELSIZE));
} }
else else
{ {
@ -1243,11 +1244,11 @@ int main(int argc, char *argv[])
{ {
if(!fire_fc) if(!fire_fc)
{ {
dim_copy(fire_bg, vid_buf); dim_copy_pers(pers_bg, vid_buf);
} }
else else
{ {
memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); memcpy(pers_bg, vid_buf, (XRES+BARSIZE)*YRES*PIXELSIZE);
} }
fire_fc = (fire_fc+1) % 3; fire_fc = (fire_fc+1) % 3;
} }