Fix LIFE sampling and HUD

This commit is contained in:
jacksonmj
2011-07-25 20:04:41 +01:00
committed by Simon Robertshaw
parent 647e29a31a
commit cbe1e0b073

View File

@@ -2631,6 +2631,7 @@ int main(int argc, char *argv[])
if (y>0 && y<sdl_scale*YRES && x>0 && x<sdl_scale*XRES)
{
int cr; //cr is particle under mouse, for drawing HUD information
char nametext[50];
if (photons[y/sdl_scale][x/sdl_scale]) {
cr = photons[y/sdl_scale][x/sdl_scale];
} else {
@@ -2638,7 +2639,11 @@ int main(int argc, char *argv[])
}
if (!((cr>>8)>=NPART || !cr))
{
if (DEBUG_MODE)
if ((cr&0xFF)==PT_LIFE && parts[cr>>8].ctype>=0 && parts[cr>>8].ctype<NGOLALT)
{
sprintf(nametext, "%s (%s)", ptypes[cr&0xFF].name, gmenu[parts[cr>>8].ctype].name);
}
else if (DEBUG_MODE)
{
int tctype = parts[cr>>8].ctype;
if ((cr&0xFF)==PT_PIPE)
@@ -2648,13 +2653,23 @@ int main(int argc, char *argv[])
}
if (tctype>=PT_NUM || tctype<0 || (cr&0xFF)==PT_PHOT)
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(nametext, "%s (%s)", ptypes[cr&0xFF].name, ptypes[tctype].name);
}
else
{
strcpy(nametext, ptypes[cr&0xFF].name);
}
if (DEBUG_MODE)
{
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", nametext, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
sprintf(coordtext, "#%d, X:%d Y:%d", cr>>8, x/sdl_scale, y/sdl_scale);
} else {
}
else
{
#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);
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", nametext, 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);
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", nametext, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
#endif
}
if ((cr&0xFF)==PT_PHOT) wavelength_gfx = parts[cr>>8].ctype;
@@ -3211,6 +3226,8 @@ int main(int argc, char *argv[])
if (!((cr>>8)>=NPART || !cr))
{
c = sl = cr&0xFF;
if (c==PT_LIFE)
c = sl = (parts[cr>>8].ctype << 8) | c;
}
else
{