summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c42
-rw-r--r--src/main.c13
-rw-r--r--src/powder.c23
3 files changed, 51 insertions, 27 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 0af768b..3ea4c9c 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1451,13 +1451,13 @@ void draw_parts(pixel *vid)
}
else
{
- cr = PIXR(ptypes[t].pcolors);
- cg = PIXG(ptypes[t].pcolors);
- cb = PIXB(ptypes[t].pcolors);
- blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ cr = PIXR(ptypes[t].pcolors);
+ cg = PIXG(ptypes[t].pcolors);
+ cb = PIXB(ptypes[t].pcolors);
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
- }
- else if(cmode==CM_GRAD)
+ }
+ else if(cmode==CM_GRAD)//forgot to put else, broke nothing view
{
if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370)
{
@@ -2843,6 +2843,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)
{
int x, y, i, j;
@@ -2943,12 +2961,12 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
if(!(j%2) && !(i%2))
fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
break;
- case 4:
- for(j=0; j<CELL; j+=2)
- for(i=(j>>1)&1; i<CELL; i+=2)
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
- k++;
- break;
+ case 4:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
+ k++;
+ break;
case 6:
for(j=0; j<CELL; j+=2)
for(i=(j>>1)&1; i<CELL; i+=2)
diff --git a/src/main.c b/src/main.c
index f3c0be1..3e5bfb5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1097,6 +1097,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);
void *http_ver_check;
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;
@@ -1231,7 +1232,7 @@ int main(int argc, char *argv[])
if(!sys_pause||framerender)
{
- update_air();
+ update_air();
}
#ifdef OpenGL
ClearScreen();
@@ -1242,8 +1243,8 @@ int main(int argc, char *argv[])
}
else if(cmode==CM_PERS)
{
- memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE);
- memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE));
+ memcpy(vid_buf, pers_bg, (XRES+BARSIZE)*YRES*PIXELSIZE);
+ memset(vid_buf+((XRES+BARSIZE)*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-((XRES+BARSIZE)*YRES*PIXELSIZE));
}
else
{
@@ -1268,11 +1269,11 @@ int main(int argc, char *argv[])
{
if(!fire_fc)
{
- dim_copy(fire_bg, vid_buf);
+ dim_copy_pers(pers_bg, vid_buf);
}
else
{
- memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE);
+ memcpy(pers_bg, vid_buf, (XRES+BARSIZE)*YRES*PIXELSIZE);
}
fire_fc = (fire_fc+1) % 3;
}
@@ -1622,7 +1623,7 @@ int main(int argc, char *argv[])
bsx = 1180;
if(bsx<0)
bsx = 0;
- if(bsy>1180)
+ if(bsy>1180)
bsy = 1180;
if(bsy<0)
bsy = 0;
diff --git a/src/powder.c b/src/powder.c
index fca05a4..11e1b14 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -496,7 +496,7 @@ inline int create_part(int p, int x, int y, int t)
(pmap[y][x]&0xFF)!=PT_BRMT &&
(pmap[y][x]&0xFF)!=PT_NBLE &&
(pmap[y][x]&0xFF)!=PT_IRON &&
- (pmap[y][x]&0xFF)!=PT_INST &&
+ (pmap[y][x]&0xFF)!=PT_INST &&
(pmap[y][x]&0xFF)!=PT_INWR)
return -1;
if(parts[pmap[y][x]>>8].life!=0)
@@ -1015,7 +1015,7 @@ void update_particles_i(pixel *vid, int start, int inc)
int starti = (start*-1);
if(sys_pause&&!framerender)
return;
- if(ISGRAV==1)
+ if(ISGRAV==1)
{
ISGRAV = 0;
GRAV ++;
@@ -1266,11 +1266,16 @@ void update_particles_i(pixel *vid, int start, int inc)
for(i=start; i<(NPART-starti); i+=inc)
if(parts[i].type)
{
- //printf("parts[%d].type: %d\n", i, parts[i].type);
-
- lx = parts[i].x;
+ lx = parts[i].x;
ly = parts[i].y;
t = parts[i].type;
+ if (ptypes[t].update_func)
+ {
+ if (ptypes[t].update_func (i))
+ goto killed;
+ }
+ //printf("parts[%d].type: %d\n", i, parts[i].type);
+
if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_SPNG && t!=PT_DEUT)
{
@@ -2001,7 +2006,7 @@ void update_particles_i(pixel *vid, int start, int inc)
} else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
parts[r>>8].life = 1020;
//docontinue = 1;
- } else {
+ } else if(parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY) {
if(nyy!=0 || nxx!=0){
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
}
@@ -2129,7 +2134,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
t = parts[i].type = PT_PLNT;
parts[r>>8].type = PT_PLNT;
- parts[r>>8].life = 0;
+ parts[r>>8].life = 0;
}
else if((r&0xFF)==PT_LAVA && 1>(rand()%250))
{
@@ -3055,10 +3060,10 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(t==PT_PRTI)
{
int temprange = 100;
+ int count =0;
for( temp = 0; temp < MAX_TEMP; temp += temprange)
if(parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange)
parts[i].tmp = temp/100;
- int count =0;
for(ny=-1; ny<2; ny++)
for(nx=-1; nx<2; nx++)
if(x+nx>=0 && y+ny>0 &&
@@ -3085,10 +3090,10 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(t==PT_PRTO)
{
int temprange = 100;
+ int count = 0;
for( temp = 0; temp < MAX_TEMP; temp += temprange)
if(parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange)
parts[i].tmp = temp/100;
- int count = 0;
for(ny=1; ny>-2; ny--)
for(nx=1; nx>-2; nx--)
if(x+nx>=0 && y+ny>0 &&