diff options
| author | Simon <simon@hardwired.org.uk> | 2011-01-27 20:14:20 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2011-01-27 20:14:20 (GMT) |
| commit | aedb16efb9601a6699201484064f13b61ba30b5c (patch) | |
| tree | 2eb884105c366a0f770b36eeddf58c7ab5fdccb5 | |
| parent | ce0708eccdf1bd86c35c28467a4b3ea2b0ce1de4 (diff) | |
| parent | 60d3f0047b21c6a1b34d07f0c0ac8c3cbc708289 (diff) | |
| download | powder-aedb16efb9601a6699201484064f13b61ba30b5c.zip powder-aedb16efb9601a6699201484064f13b61ba30b5c.tar.gz | |
Fixes from cracker
| -rw-r--r-- | includes/powder.h | 2 | ||||
| -rw-r--r-- | src/main.c | 22 | ||||
| -rw-r--r-- | src/powder.c | 8 |
3 files changed, 23 insertions, 9 deletions
diff --git a/includes/powder.h b/includes/powder.h index 843ac05..f30e879 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -423,7 +423,7 @@ static const part_type ptypes[PT_NUM] = {"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", TYPE_PART, NULL}, {"C-5", PIXPACK(0x2050E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", TYPE_SOLID | PROP_NEUTPENETRATE, NULL}, {"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 86, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Singularity", TYPE_PART, NULL}, - {"QRTZ", PIXPACK(0xAADDDD), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", TYPE_SOLID | PROP_CONDUCTS | PROP_HOT_GLOW, NULL}, + {"QRTZ", PIXPACK(0xAADDDD), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", TYPE_SOLID | PROP_HOT_GLOW, NULL}, {"PQRT", PIXPACK(0x88BBBB), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.27f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 3, "Broken quartz.", TYPE_PART| PROP_HOT_GLOW, NULL}, {"SEED", PIXPACK(0xFBEC7D), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B2/S", TYPE_SOLID|PROP_LIFE, NULL}, {"MAZE", PIXPACK(0xA8E4A0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3/S12345", TYPE_SOLID|PROP_LIFE, NULL}, @@ -487,6 +487,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0) memset(vx, 0, sizeof(vx)); memset(vy, 0, sizeof(vy)); memset(pv, 0, sizeof(pv)); + memset(photons, 0, sizeof(photons)); + memset(wireless, 0, sizeof(wireless)); + memset(gol2, 0, sizeof(gol2)); + memset(portal, 0, sizeof(portal)); } // make a catalog of free parts @@ -1535,6 +1539,16 @@ int main(int argc, char *argv[]) if(sdl_key=='=') { int nx, ny; + if(sdl_mod & (KMOD_CTRL)) + { + for(i=0;i<NPART;i++) + if(parts[i].type==PT_SPRK) + { + parts[i].type = parts[i].ctype; + parts[i].life = 0; + } + } + else for(nx = 0;nx<XRES/CELL;nx++) for(ny = 0;ny<YRES/CELL;ny++) { @@ -2076,6 +2090,10 @@ int main(int argc, char *argv[]) memset(bmap, 0, sizeof(bmap)); memset(emap, 0, sizeof(emap)); memset(parts, 0, sizeof(particle)*NPART); + memset(photons, 0, sizeof(photons)); + memset(wireless, 0, sizeof(wireless)); + memset(gol2, 0, sizeof(gol2)); + memset(portal, 0, sizeof(portal)); for(i=0; i<NPART-1; i++) parts[i].life = i+1; parts[NPART-1].life = -1; @@ -2132,10 +2150,6 @@ int main(int argc, char *argv[]) if(x>=19 && x<=35 && svf_last && svf_open && !bq){ //int tpval = sys_pause; parse_save(svf_last, svf_lsize, 1, 0, 0); - for(j= 0;j<99;j++){ //reset wifi on reload - wireless[j][0] = 0; - wireless[j][1] = 0; - } //sys_pause = tpval; } if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) diff --git a/src/powder.c b/src/powder.c index 2d9a6d0..27b48fa 100644 --- a/src/powder.c +++ b/src/powder.c @@ -583,8 +583,6 @@ inline int create_part(int p, int x, int y, int t) } } } - if(photons[y][x] && t==PT_PHOT) - return -1; if(pfree == -1) return -1; i = pfree; @@ -876,6 +874,7 @@ static void create_gain_photon(int pp) parts[i].vy = parts[pp].vy; parts[i].temp = parts[pmap[ny][nx] >> 8].temp; parts[i].tmp = 0; + photons[ny][nx] = PT_PHOT|(i<<8); temp_bin = (int)((parts[i].temp-273.0f)*0.25f); if(temp_bin < 0) temp_bin = 0; @@ -911,6 +910,7 @@ static void create_cherenkov_photon(int pp) parts[i].y = parts[pp].y; parts[i].temp = parts[pmap[ny][nx] >> 8].temp; parts[i].tmp = 0; + photons[ny][nx] = PT_PHOT|(i<<8); if(lr) { parts[i].vx = parts[pp].vx - 2.5f*parts[pp].vy; @@ -1112,7 +1112,7 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { - int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg, nnx, nny, q, golnum, goldelete, z, ctype, temp, trade, docontinue, nxx, nyy, nxi, nyi; + int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg, nnx, nny, q, golnum, goldelete, z, ctype, temp, trade, docontinue, nxx, nyy, nxi, nyi, neighbors; float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp, rr, rrr; float nn, ct1, ct2; float pt = R_TEMP; @@ -1308,7 +1308,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(ny=CELL;ny<YRES-CELL;ny++) { r = pmap[ny][nx]; - int neighbors = gol2[nx][ny][0]; + neighbors = gol2[nx][ny][0]; if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART) continue; for( golnum = 1;golnum<NGOL;golnum++) |
