summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-10 19:05:06 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-10 19:05:06 (GMT)
commit95c4e49f53cc5da31a3bfef3e3ee957b824e08d6 (patch)
tree987fc5c09da1c9ffb81c823db3002893b768313a /src
parentd017764fbef66fffa058a79d0e3d569f75121a1e (diff)
downloadpowder-95c4e49f53cc5da31a3bfef3e3ee957b824e08d6.zip
powder-95c4e49f53cc5da31a3bfef3e3ee957b824e08d6.tar.gz
Lots of small changes/fixes mentioned in my mod post.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c19
-rw-r--r--src/main.c23
-rw-r--r--src/powder.c21
3 files changed, 52 insertions, 11 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 9b89f79..90a1438 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1402,7 +1402,7 @@ void draw_parts(pixel *vid)
isplayer = 1; //It's a secret. Tssss...
}
- if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT)//nothing display but show needed color changes
+ if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
{
if(t==PT_PHOT)
{
@@ -1587,12 +1587,23 @@ void draw_parts(pixel *vid)
}
else if(t==PT_WIFI)
{
- float frequency = 0.25;
+ float frequency = 0.0628;
int q = parts[i].tmp;
cr = sin(frequency*q + 0) * 127 + 128;
cg = sin(frequency*q + 2) * 127 + 128;
cb = sin(frequency*q + 4) * 127 + 128;
- blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ if(mousex==(nx) && mousey==(ny))
+ {
+ int z;
+ for(z = 0; z<NPART; z++) {
+ if(parts[z].type)
+ {
+ if(parts[z].type==PT_WIFI&&parts[z].tmp==parts[i].tmp)
+ xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
+ }
+ }
+ }
}
else if(t==PT_PIPE)
{
@@ -2859,7 +2870,7 @@ 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 WL_STREAM:
+ case WL_FAN:
for(j=0; j<CELL; j+=2)
for(i=(j>>1)&1; i<CELL; i+=2)
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
diff --git a/src/main.c b/src/main.c
index ccc87a2..fd153df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1461,6 +1461,19 @@ int main(int argc, char *argv[])
bsy = 0;
}
}
+ if(sdl_key=='d')
+ DEBUG_MODE = !DEBUG_MODE;
+ if(sdl_key=='i')
+ {
+ int nx, ny;
+ for(nx = 0;nx<XRES/CELL;nx++)
+ for(ny = 0;ny<YRES/CELL;ny++)
+ {
+ pv[ny][nx] = -pv[ny][nx];
+ vx[ny][nx] = -vx[ny][nx];
+ vy[ny][nx] = -vy[ny][nx];
+ }
+ }
if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
active_menu = 11;
if(sdl_key==SDLK_INSERT)
@@ -1614,7 +1627,10 @@ int main(int argc, char *argv[])
#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
- 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);
+ if(DEBUG_MODE)
+ 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
@@ -2247,7 +2263,10 @@ 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);
#else
- sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB);
+ if(DEBUG_MODE)
+ sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS);
+ else
+ sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB);
#endif
if(REPLACE_MODE)
strappend(uitext, " [REPLACE MODE]");
diff --git a/src/powder.c b/src/powder.c
index b6f8264..46880b9 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -505,7 +505,7 @@ inline int create_part(int p, int x, int y, int t)
parts[i].tmp = 50;
}
if(t==PT_DEUT)
- parts[i].life = 20;
+ parts[i].life = 10;
if(t==PT_BRAY)
parts[i].life = 30;
if(t==PT_PUMP)
@@ -1173,7 +1173,7 @@ void update_particles_i(pixel *vid, int start, int inc)
(bmap[y/CELL][x/CELL]==WL_DESTROYALL) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID && ptypes[t].falldown!=2) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWSOLID && ptypes[t].falldown!=1) ||
- (bmap[y/CELL][x/CELL]==WL_ALLOWGAS && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) ||
+ (bmap[y/CELL][x/CELL]==WL_ALLOWGAS && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE && parts[i].type!=PT_HFLM) ||
(bmap[y/CELL][x/CELL]==WL_DETECT && (t==PT_METL || t==PT_SPRK)) ||
(bmap[y/CELL][x/CELL]==WL_EWALL && !emap[y/CELL][x/CELL])) && (t!=PT_STKM)))
{
@@ -1972,6 +1972,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;
}
else if((r&0xFF)==PT_LAVA && 1>(rand()%250))
{
@@ -1989,8 +1990,12 @@ void update_particles_i(pixel *vid, int start, int inc)
int nny = rand()%3 -1;
if(x+nx+nnx>=0 && y+ny+nny>0 &&
x+nx+nnx<XRES && y+ny+nny<YRES && (nnx || nny))
+ {
+ if((pmap[y+ny+nny][x+nx+nnx]>>8)>=NPART||pmap[y+ny+nny][x+nx+nnx])
+ continue;
if(create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE))
parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp;
+ }
}
//if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
//t = parts[i].type = PT_WATR;
@@ -2940,8 +2945,8 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(t==PT_WIFI)
{
int temprange = 100;
- for( temp = 0; temp < 2500; temp += temprange)
- if(parts[i].temp-273.15>temp&&parts[i].temp-273.15<temp+temprange)
+ 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;
for(ny=-1; ny<2; ny++)
for(nx=-1; nx<2; nx++)
@@ -2957,9 +2962,15 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].ctype = PT_NSCN;
parts[r>>8].life = 4;
}
+ else if(parts[r>>8].type==PT_PSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
+ {
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].ctype = PT_PSCN;
+ parts[r>>8].life = 4;
+ }
else if(parts[r>>8].type==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3 && !wireless[parts[i].tmp][0])
{
- parts[r>>8].type = parts[r>>8].ctype;
+ //parts[r>>8].type = parts[r>>8].ctype;
wireless[parts[i].tmp][0] = 1;
wireless[parts[i].tmp][1] = 1;
ISWIRE = 1;