some photon fixes, and better resets on reload/clear
This commit is contained in:
parent
1b35811bd4
commit
b25a6ecd59
12
src/main.c
12
src/main.c
@ -487,6 +487,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
|||||||
memset(vx, 0, sizeof(vx));
|
memset(vx, 0, sizeof(vx));
|
||||||
memset(vy, 0, sizeof(vy));
|
memset(vy, 0, sizeof(vy));
|
||||||
memset(pv, 0, sizeof(pv));
|
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
|
// make a catalog of free parts
|
||||||
@ -2076,6 +2080,10 @@ int main(int argc, char *argv[])
|
|||||||
memset(bmap, 0, sizeof(bmap));
|
memset(bmap, 0, sizeof(bmap));
|
||||||
memset(emap, 0, sizeof(emap));
|
memset(emap, 0, sizeof(emap));
|
||||||
memset(parts, 0, sizeof(particle)*NPART);
|
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++)
|
for(i=0; i<NPART-1; i++)
|
||||||
parts[i].life = i+1;
|
parts[i].life = i+1;
|
||||||
parts[NPART-1].life = -1;
|
parts[NPART-1].life = -1;
|
||||||
@ -2132,10 +2140,6 @@ int main(int argc, char *argv[])
|
|||||||
if(x>=19 && x<=35 && svf_last && svf_open && !bq){
|
if(x>=19 && x<=35 && svf_last && svf_open && !bq){
|
||||||
//int tpval = sys_pause;
|
//int tpval = sys_pause;
|
||||||
parse_save(svf_last, svf_lsize, 1, 0, 0);
|
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;
|
//sys_pause = tpval;
|
||||||
}
|
}
|
||||||
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
|
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
|
||||||
|
@ -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)
|
if(pfree == -1)
|
||||||
return -1;
|
return -1;
|
||||||
i = pfree;
|
i = pfree;
|
||||||
@ -876,6 +874,7 @@ static void create_gain_photon(int pp)
|
|||||||
parts[i].vy = parts[pp].vy;
|
parts[i].vy = parts[pp].vy;
|
||||||
parts[i].temp = parts[pmap[ny][nx] >> 8].temp;
|
parts[i].temp = parts[pmap[ny][nx] >> 8].temp;
|
||||||
parts[i].tmp = 0;
|
parts[i].tmp = 0;
|
||||||
|
photons[ny][nx] = PT_PHOT|(i<<8);
|
||||||
|
|
||||||
temp_bin = (int)((parts[i].temp-273.0f)*0.25f);
|
temp_bin = (int)((parts[i].temp-273.0f)*0.25f);
|
||||||
if(temp_bin < 0) temp_bin = 0;
|
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].y = parts[pp].y;
|
||||||
parts[i].temp = parts[pmap[ny][nx] >> 8].temp;
|
parts[i].temp = parts[pmap[ny][nx] >> 8].temp;
|
||||||
parts[i].tmp = 0;
|
parts[i].tmp = 0;
|
||||||
|
photons[ny][nx] = PT_PHOT|(i<<8);
|
||||||
|
|
||||||
if(lr) {
|
if(lr) {
|
||||||
parts[i].vx = parts[pp].vx - 2.5f*parts[pp].vy;
|
parts[i].vx = parts[pp].vx - 2.5f*parts[pp].vy;
|
||||||
|
Loading…
Reference in New Issue
Block a user