diff options
| author | Philip <philip@philip-linuxlaptop.(none)> | 2010-11-21 06:08:33 (GMT) |
|---|---|---|
| committer | Philip <philip@philip-linuxlaptop.(none)> | 2010-11-21 06:08:33 (GMT) |
| commit | 3d2292890b2d091ba4e7b2e7c1b24dbc7be4ac2c (patch) | |
| tree | 14075cd9d067b92575b6c44121c98d71b06b8ddb /src | |
| parent | a38dddaf5a2106ffb3d112584f657a6c3d97c4fb (diff) | |
| download | powder-3d2292890b2d091ba4e7b2e7c1b24dbc7be4ac2c.zip powder-3d2292890b2d091ba4e7b2e7c1b24dbc7be4ac2c.tar.gz | |
Fixed ehole, made wall code use defines, wall specific deletion.
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphics.c | 2 | ||||
| -rw-r--r-- | src/main.c | 39 | ||||
| -rw-r--r-- | src/powder.c | 55 |
3 files changed, 69 insertions, 27 deletions
diff --git a/src/graphics.c b/src/graphics.c index b7808d9..8c873d1 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -2875,7 +2875,7 @@ void render_cursor(pixel *vid, int x, int y, int t, float rx, float ry) else { int tc; - c = (rx/CELL) * CELL; + c = ((int)rx/CELL) * CELL; x = (x/CELL) * CELL; y = (y/CELL) * CELL; @@ -481,7 +481,36 @@ int parse_save(void *save, int size, int replace, int x0, int y0) for(x=bx0; x<bx0+bw; x++) { if(d[p]) + { bmap[y][x] = d[p]; + if(bmap[y][x]==1) + bmap[y][x]=WL_WALL; + if(bmap[y][x]==2) + bmap[y][x]=WL_DESTROYALL; + if(bmap[y][x]==3) + bmap[y][x]=WL_ALLOWLIQUID; + if(bmap[y][x]==4) + bmap[y][x]=WL_FAN; + if(bmap[y][x]==5) + bmap[y][x]=WL_STREAM; + if(bmap[y][x]==6) + bmap[y][x]=WL_DETECT; + if(bmap[y][x]==7) + bmap[y][x]=WL_EWALL; + if(bmap[y][x]==8) + bmap[y][x]=WL_WALLELEC; + if(bmap[y][x]==9) + bmap[y][x]=WL_ALLOWAIR; + if(bmap[y][x]==10) + bmap[y][x]=WL_ALLOWSOLID; + if(bmap[y][x]==11) + bmap[y][x]=WL_ALLOWALLELEC; + if(bmap[y][x]==12) + bmap[y][x]=WL_EHOLE; + if(bmap[y][x]==13) + bmap[y][x]=WL_ALLOWGAS; + } + p++; } for(y=by0; y<by0+bh; y++) @@ -1878,10 +1907,10 @@ int main(int argc, char *argv[]) { nfvx = (x-lx)*0.005f; nfvy = (y-ly)*0.005f; - flood_parts(lx, ly, 255, -1, 4); + flood_parts(lx, ly, WL_FANHELPER, -1, WL_FAN); for(j=0; j<YRES/CELL; j++) for(i=0; i<XRES/CELL; i++) - if(bmap[j][i] == 255) + if(bmap[j][i] == WL_FANHELPER) { fvx[j][i] = nfvx; fvy[j][i] = nfvy; @@ -2131,11 +2160,11 @@ int main(int argc, char *argv[]) { #ifdef BETA if(REPLACE_MODE) - sprintf(uitext, "Cracker's Version %d FPS:%d REPLACE MODE", SAVE_VERSION,FPS); + sprintf(uitext, "Cracker's Version %d Parts:%d REPLACE MODE", SAVE_VERSION,NUM_PARTS); else if(sdl_mod&(KMOD_CAPS)) - sprintf(uitext, "Cracker's Version %d FPS:%d CAPS LOCK ON", SAVE_VERSION, FPS); + sprintf(uitext, "Cracker's Version %d Parts:%d CAPS LOCK ON", SAVE_VERSION, NUM_PARTS); else - sprintf(uitext, "Cracker's Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); + sprintf(uitext, "Cracker's Version %d Parts:%d", SAVE_VERSION, NUM_PARTS); //printf("%s\n", uitext); #else sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); diff --git a/src/powder.c b/src/powder.c index 7645b5a..773d4fd 100644 --- a/src/powder.c +++ b/src/powder.c @@ -88,6 +88,8 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) return 0; if((pt==PT_NEUT ||pt==PT_PHOT) && bmap[ny/CELL][nx/CELL]==WL_EWALL && !emap[ny/CELL][nx/CELL]) return 0; + if(bmap[ny/CELL][nx/CELL]==WL_EHOLE && !emap[ny/CELL][nx/CELL]) + return 2; if(bmap[ny/CELL][nx/CELL]==WL_ALLOWAIR) return 0; @@ -1422,7 +1424,7 @@ void update_particles_i(pixel *vid, int start, int inc) nx = x/CELL; ny = y/CELL; - if(bmap[ny][nx]==6 && emap[ny][nx]<WL_WALLELEC) + if(bmap[ny][nx]==WL_DETECT && emap[ny][nx]<8) set_emap(nx, ny); fe = 0; @@ -3663,6 +3665,7 @@ void update_particles(pixel *vid) isplayer = 0; //Needed for player spawning memset(pmap, 0, sizeof(pmap)); r = rand()%2; + NUM_PARTS = 0; for(j=0; j<NPART; j++) { i = r ? (NPART-1-j) : j; @@ -3675,6 +3678,7 @@ void update_particles(pixel *vid) if(t!=PT_NEUT || (pmap[y][x]&0xFF)!=PT_GLAS) pmap[y][x] = t|(i<<8); } + NUM_PARTS ++; } else { @@ -4250,7 +4254,7 @@ int flood_parts(int x, int y, int c, int cm, int bm) bm = 0; } - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm ||( (sdl_mod & (KMOD_CAPS)) && cm!=SLALT)) + if(((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm )||( (sdl_mod & (KMOD_CAPS)) && cm!=SLALT)) return 1; // go left as far as possible @@ -4295,37 +4299,26 @@ int create_parts(int x, int y, float rx, float ry, int c) int wall = c - 100; for(int r=UI_ACTUALSTART;r<=UI_ACTUALSTART+UI_WALLCOUNT;r++) { - if(wall==WL_STREAM) - { - i = x / CELL; - j = y / CELL; - for(v=-1; v<2; v++) - for(u=-1; u<2; u++) - if(i+u>=0 && i+u<XRES/CELL && - j+v>=0 && j+v<YRES/CELL && - bmap[j+v][i+u] == WL_STREAM) - return 1; - bmap[j][i] = WL_STREAM; - return 1; - } - else if(wall==r) + if(wall==r) { + if(c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM) + break; b = wall; dw = 1; } } - if(c == 255) + if(c == WL_FANHELPER) { - b = 255; + b = WL_FANHELPER; dw = 1; } if(dw==1) { - rx = rx/CELL; + rx = (int)rx/CELL; x = x/CELL; y = y/CELL; - x -= rx/2; - y -= rx/2; + x -= (int)rx/2; + y -= (int)rx/2; for (ox=x; ox<=x+rx; ox++) { for (oy=y; oy<=y+rx; oy++) @@ -4334,11 +4327,31 @@ int create_parts(int x, int y, float rx, float ry, int c) { i = ox; j = oy; + if(((sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))|| sdl_mod & (KMOD_CAPS) )) + { + if(bmap[j][i]==SLALT-100) + b = 0; + else + continue; + } if(b==WL_FAN) { fvx[j][i] = 0.0f; fvy[j][i] = 0.0f; } + if(b==WL_STREAM) + { + i = x + rx/2; + j = y + rx/2; + for(v=-1; v<2; v++) + for(u=-1; u<2; u++) + if(i+u>=0 && i+u<XRES/CELL && + j+v>=0 && j+v<YRES/CELL && + bmap[j+v][i+u] == WL_STREAM) + return 1; + bmap[j][i] = WL_STREAM; + continue; + } bmap[j][i] = b; } } |
