summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-01-19 18:48:59 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-01-19 18:48:59 (GMT)
commitff01973658fc72b107c820e7f9f738e1a872b261 (patch)
tree54a348c092f3324a81f46f13f26c7fc88568a24c /src/main.c
parent5c65d69dacfb8fda234c71b78f55a849d246fcc2 (diff)
downloadpowder-ff01973658fc72b107c820e7f9f738e1a872b261.zip
powder-ff01973658fc72b107c820e7f9f738e1a872b261.tar.gz
made all the shifts and type checks use defines, so it can be changed easier, and put it back to normal with a shift of 8.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main.c b/src/main.c
index a4fe081..1e7a6c5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -496,7 +496,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);
- pmap[y][x] = (i<<12)|1;
+ pmap[y][x] = (i<<PS)|1;
}
else
fp[nf++] = i;
@@ -573,7 +573,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
if(pmap[y][x])
{
- k = pmap[y][x]>>12;
+ k = pmap[y][x]>>PS;
parts[k].type = j;
if(j == PT_PHOT)
parts[k].ctype = 0x3fffffff;
@@ -1747,28 +1747,28 @@ int main(int argc, char *argv[])
}else{
cr = pmap[y/sdl_scale][x/sdl_scale];
}
- if(!((cr>>12)>=NPART || !cr))
+ if(!((cr>>PS)>=NPART || !cr))
{
#ifdef BETA
if(DEBUG_MODE)
{
- int tctype = parts[cr>>12].ctype;
+ int tctype = parts[cr>>PS].ctype;
if(tctype>=PT_NUM)
tctype = 0;
- sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
- //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFFF].name, ptypes[parts[cr>>12].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
+ sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
+ //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, ptypes[parts[cr>>PS].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
} else
- sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
+ sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
#else
if(DEBUG_MODE)
{
- int tctype = parts[cr>>12].ctype;
+ int tctype = parts[cr>>PS].ctype;
if(tctype>=PT_NUM)
tctype = 0;
- sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d,tmp: %d", ptypes[cr&0xFFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life,parts[cr>>12].tmp);
- //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFFF].name, ptypes[parts[cr>>12].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
+ sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d,tmp: %d", ptypes[cr&TYPE].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life,parts[cr>>PS].tmp);
+ //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, ptypes[parts[cr>>PS].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
} else {
- sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f);
+ sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&TYPE].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f);
}
#endif
}
@@ -2235,9 +2235,9 @@ int main(int argc, char *argv[])
{
int cr;
cr = pmap[y][x];
- if(!((cr>>12)>=NPART || !cr))
+ if(!((cr>>PS)>=NPART || !cr))
{
- c = sl = cr&0xFFF;
+ c = sl = cr&TYPE;
}
else
{