summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-22 05:13:01 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-22 05:13:01 (GMT)
commite5ebf1fb41ee6a55db4869a01638e92acd8ea1d1 (patch)
treee191a30702685d5baffb4a6e39ae343fd7612a9a /src
parentee4bb84395f2e8aaa9e9af7080f03d837b0a0344 (diff)
downloadpowder-e5ebf1fb41ee6a55db4869a01638e92acd8ea1d1.zip
powder-e5ebf1fb41ee6a55db4869a01638e92acd8ea1d1.tar.gz
updated with latest, and FWRK crash fix, INST looks for INSL, wifi lines only show in debug mode.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c20
-rw-r--r--src/main.c19
-rw-r--r--src/powder.c44
3 files changed, 61 insertions, 22 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 0af768b..e719a04 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1641,7 +1641,7 @@ void draw_parts(pixel *vid)
cg = sin(frequency*q + 2) * 127 + 128;
cb = sin(frequency*q + 4) * 127 + 128;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
- if(mousex==(nx) && mousey==(ny))
+ if(mousex==(nx) && mousey==(ny) && DEBUG_MODE)
{
int z;
for(z = 0; z<NPART; z++) {
@@ -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;
diff --git a/src/main.c b/src/main.c
index f3c0be1..976bfe7 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;
@@ -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;
}
@@ -1667,6 +1668,14 @@ 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", 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(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, 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)
@@ -2332,7 +2341,7 @@ int main(int argc, char *argv[])
}
#ifdef BETA
- sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS);
+ sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION);
#else
if(DEBUG_MODE)
sprintf(uitext, "Version %d.%d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION);
diff --git a/src/powder.c b/src/powder.c
index fca05a4..4b03e5b 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -78,7 +78,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr)
(r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR ||
(r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW ||
(r&0xFF)==PT_ISOZ || (r&0xFF)==PT_ISZS ||
- (r&0xFF)==PT_FILT ||
+ (r&0xFF)==PT_FILT || (r&0xFF)==PT_INVIS ||
((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5)))
return 2;
@@ -163,16 +163,20 @@ int try_move(int i, int x, int y, int nx, int ny)
create_gain_photon(i);
}
if(parts[i].type == PT_PHOT && (r&0xFF)==PT_FILT)
- {
+ {
int temp_bin = (int)((parts[r>>8].temp-273.0f)*0.025f);
if(temp_bin < 0) temp_bin = 0;
if(temp_bin > 25) temp_bin = 25;
parts[i].ctype = 0x1F << temp_bin;
- }
- if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) {
- if(rand() < RAND_MAX/10)
- create_cherenkov_photon(i);
- }
+ }
+ if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) {
+ if(rand() < RAND_MAX/10)
+ create_cherenkov_photon(i);
+ }
+ if(parts[i].type == PT_PHOT && (r&0xFF)==PT_INVIS) {
+ parts[i].type = PT_NEUT;
+ parts[i].ctype = 0;
+ }
if((parts[i].type==PT_BIZR||parts[i].type==PT_BIZRG) && (r&0xFF)==PT_FILT)
{
int temp_bin = (int)((parts[r>>8].temp-273.0f)*0.025f);
@@ -1015,7 +1019,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 +1270,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 +2010,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);
}
@@ -2785,7 +2794,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
create_part(-1, x , y-1 , PT_FWRK);
r = pmap[y-1][x];
- if(parts[r>>8].type==PT_FWRK)
+ if((r&0xFF)==PT_FWRK)
{
parts[r>>8].vy = rand()%8-22;
parts[r>>8].vx = rand()%20-rand()%20;
@@ -3045,7 +3054,7 @@ void update_particles_i(pixel *vid, int start, int inc)
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r)
continue;
- else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life%4==0)
+ else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life%4==0&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
{
flood_parts(x,y,PT_SPRK,PT_INST,-1);//add life
parts[r>>8].type==parts[r>>8].ctype;
@@ -3055,10 +3064,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 +3094,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 &&
@@ -5477,6 +5486,8 @@ 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];
@@ -5539,6 +5550,7 @@ void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert)
}
}
}
+#endif
}
void clear_area(int area_x, int area_y, int area_w, int area_h)