summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-13 21:24:19 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-13 21:31:24 (GMT)
commit9707443b243bafd4c65fd8c92fa97d99260a2e3c (patch)
tree12b41b708a1315d09cda03873e2c7d5cb32862a3 /src
parenta23138fbbec43f31e265a908c935b700558e1467 (diff)
downloadpowder-9707443b243bafd4c65fd8c92fa97d99260a2e3c.zip
powder-9707443b243bafd4c65fd8c92fa97d99260a2e3c.tar.gz
Merge element state into ptypes.
All of the pstates array except .state was replaced by ptransitions.
Diffstat (limited to 'src')
-rw-r--r--src/elements/fog.c2
-rw-r--r--src/elements/pipe.c2
-rw-r--r--src/elements/prti.c2
-rw-r--r--src/elements/stkm.c24
-rw-r--r--src/elements/stkm2.c24
-rw-r--r--src/graphics.c12
-rw-r--r--src/powder.c2
7 files changed, 34 insertions, 34 deletions
diff --git a/src/elements/fog.c b/src/elements/fog.c
index 2273b91..17d4c73 100644
--- a/src/elements/fog.c
+++ b/src/elements/fog.c
@@ -9,7 +9,7 @@ int update_FOG(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
- if (pstates[r&0xFF].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!((r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
+ if (ptypes[r&0xFF].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!((r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
{
part_change_type(i,x,y,PT_RIME);
}
diff --git a/src/elements/pipe.c b/src/elements/pipe.c
index 93eec4e..4bd1799 100644
--- a/src/elements/pipe.c
+++ b/src/elements/pipe.c
@@ -100,7 +100,7 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
}
else if (!r)
continue;
- else if (parts[i].tmp == 0 && (ptypes[r&0xFF].falldown!= 0 || pstates[r&0xFF].state == ST_GAS))
+ else if (parts[i].tmp == 0 && (ptypes[r&0xFF].falldown!= 0 || ptypes[r&0xFF].state == ST_GAS))
{
parts[i].tmp = parts[r>>8].type;
parts[i].temp = parts[r>>8].temp;
diff --git a/src/elements/prti.c b/src/elements/prti.c
index 6cbed9f..4310f86 100644
--- a/src/elements/prti.c
+++ b/src/elements/prti.c
@@ -12,7 +12,7 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
count ++;
if ((r>>8)>=NPART || !r)
continue;
- if ((r&0xFF)==PT_SPRK || ((r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO && (ptypes[r&0xFF].falldown!= 0 || pstates[r&0xFF].state == ST_GAS)))
+ if ((r&0xFF)==PT_SPRK || ((r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO && (ptypes[r&0xFF].falldown!= 0 || ptypes[r&0xFF].state == ST_GAS)))
for ( nnx=0; nnx<80; nnx++)
if (!portal[parts[i].tmp][count-1][nnx])
{
diff --git a/src/elements/stkm.c b/src/elements/stkm.c
index de0caa3..9576ae3 100644
--- a/src/elements/stkm.c
+++ b/src/elements/stkm.c
@@ -85,9 +85,9 @@ int update_STKM(UPDATE_FUNC_ARGS) {
player[26] = 0;
//Go left
- if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
+ if (((int)(player[0])&0x01) == 0x01 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player[8]-1)][(int)(player[7])])
@@ -123,9 +123,9 @@ int update_STKM(UPDATE_FUNC_ARGS) {
}
//Go right
- if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
+ if (((int)(player[0])&0x02) == 0x02 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player[8]-1)][(int)(player[7])])
@@ -162,7 +162,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
}
//Jump
- if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS))
+ if (((int)(player[0])&0x04) == 0x04 && (ptypes[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || ptypes[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS))
{
if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])])
{
@@ -219,7 +219,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
r = pmap[ry][rx];
if (!((r>>8)>=NPART))
{
- if (pstates[r&0xFF].state == ST_SOLID)
+ if (ptypes[r&0xFF].state == ST_SOLID)
{
create_part(-1, rx, ry, PT_SPRK);
}
@@ -281,11 +281,11 @@ int update_STKM(UPDATE_FUNC_ARGS) {
for (rx = -3; rx <= 3; rx++)
{
r = pmap[(int)(player[16]-2)][(int)(player[15]+rx)];
- if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
+ if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player[15] -= rx;
r = pmap[(int)(player[8]-2)][(int)(player[7]+rx)];
- if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
+ if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player[7] -= rx;
}
@@ -297,7 +297,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
//For left leg
if (r && (r&0xFF)!=PT_STKM)
{
- if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
+ if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
{
if (parts[i].y<(player[8]-10))
parts[i].vy = 1*dt;
@@ -308,7 +308,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
}
else
{
- if (pstates[r&0xFF].state != ST_GAS)
+ if (ptypes[r&0xFF].state != ST_GAS)
{
player[8] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
@@ -322,7 +322,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
//For right leg
if (r && (r&0xFF)!=PT_STKM)
{
- if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
+ if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
{
if (parts[i].y<(player[16]-10))
parts[i].vy = 1*dt;
@@ -333,7 +333,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
}
else
{
- if (pstates[r&0xFF].state != ST_GAS)
+ if (ptypes[r&0xFF].state != ST_GAS)
{
player[16] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
diff --git a/src/elements/stkm2.c b/src/elements/stkm2.c
index 5d5da8a..805cb73 100644
--- a/src/elements/stkm2.c
+++ b/src/elements/stkm2.c
@@ -85,9 +85,9 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
player2[26] = 0;
//Go left
- if (((int)(player2[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
+ if (((int)(player2[0])&0x01) == 0x01 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
@@ -123,9 +123,9 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
}
//Go right
- if (((int)(player2[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
+ if (((int)(player2[0])&0x02) == 0x02 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
@@ -162,7 +162,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
}
//Jump
- if (((int)(player2[0])&0x04) == 0x04 && (pstates[pmap[(int)(player2[8]-0.5)][(int)(player2[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player2[16]-0.5)][(int)(player2[15])]&0xFF].state != ST_GAS))
+ if (((int)(player2[0])&0x04) == 0x04 && (ptypes[pmap[(int)(player2[8]-0.5)][(int)(player2[7])]&0xFF].state != ST_GAS || ptypes[pmap[(int)(player2[16]-0.5)][(int)(player2[15])]&0xFF].state != ST_GAS))
{
if (pmap[(int)(player2[8]-0.5)][(int)(player2[7])] || pmap[(int)(player2[16]-0.5)][(int)(player2[15])])
{
@@ -219,7 +219,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
r = pmap[ry][rx];
if (!((r>>8)>=NPART))
{
- if (pstates[r&0xFF].state == ST_SOLID)
+ if (ptypes[r&0xFF].state == ST_SOLID)
{
create_part(-1, rx, ry, PT_SPRK);
}
@@ -281,11 +281,11 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
for (rx = -3; rx <= 3; rx++)
{
r = pmap[(int)(player2[16]-2)][(int)(player2[15]+rx)];
- if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
+ if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player2[15] -= rx;
r = pmap[(int)(player2[8]-2)][(int)(player2[7]+rx)];
- if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
+ if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player2[7] -= rx;
}
@@ -297,7 +297,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
//For left leg
if (r && (r&0xFF)!=PT_STKM)
{
- if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
+ if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
{
if (parts[i].y<(player2[8]-10))
parts[i].vy = 1*dt;
@@ -308,7 +308,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
}
else
{
- if (pstates[r&0xFF].state != ST_GAS)
+ if (ptypes[r&0xFF].state != ST_GAS)
{
player2[8] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
@@ -322,7 +322,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
//For right leg
if (r && (r&0xFF)!=PT_STKM)
{
- if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
+ if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
{
if (parts[i].y<(player2[16]-10))
parts[i].vy = 1*dt;
@@ -333,7 +333,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
}
else
{
- if (pstates[r&0xFF].state != ST_GAS)
+ if (ptypes[r&0xFF].state != ST_GAS)
{
player2[16] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
diff --git a/src/graphics.c b/src/graphics.c
index 6c0123f..b541711 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1668,10 +1668,10 @@ void draw_parts(pixel *vid)
else if (t==PT_QRTZ || t==PT_PQRT)
{
int z = parts[i].tmp;
- if (parts[i].temp>(pstates[t].ltemp-800.0f))
+ if (parts[i].temp>(ptransitions[t].thv-800.0f))
{
- float frequency = 3.1415/(2*pstates[t].ltemp-(pstates[t].ltemp-800.0f));
- int q = (parts[i].temp>pstates[t].ltemp)?pstates[t].ltemp-(pstates[t].ltemp-800.0f):parts[i].temp-(pstates[t].ltemp-800.0f);
+ float frequency = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
+ int q = (parts[i].temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):parts[i].temp-(ptransitions[t].thv-800.0f);
cr = sin(frequency*q) * 226 + (z * 16 + PIXR(ptypes[t].pcolors));
cg = sin(frequency*q*4.55 +3.14) * 34 + (z * 16 + PIXR(ptypes[t].pcolors));
cb = sin(frequency*q*2.22 +3.14) * 64 + (z * 16 + PIXR(ptypes[t].pcolors));
@@ -2530,10 +2530,10 @@ void draw_parts(pixel *vid)
}
}
- else if (ptypes[t].properties&PROP_HOT_GLOW && parts[i].temp>(pstates[t].ltemp-800.0f))
+ else if (ptypes[t].properties&PROP_HOT_GLOW && parts[i].temp>(ptransitions[t].thv-800.0f))
{
- float frequency = 3.1415/(2*pstates[t].ltemp-(pstates[t].ltemp-800.0f));
- int q = (parts[i].temp>pstates[t].ltemp)?pstates[t].ltemp-(pstates[t].ltemp-800.0f):parts[i].temp-(pstates[t].ltemp-800.0f);
+ float frequency = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
+ int q = (parts[i].temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):parts[i].temp-(ptransitions[t].thv-800.0f);
cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors);
diff --git a/src/powder.c b/src/powder.c
index b969a31..76ec3e9 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1536,7 +1536,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if (s) { // particle type change occurred
if (t==PT_ICEI||t==PT_LAVA)
parts[i].ctype = parts[i].type;
- if (pstates[t].state==ST_GAS&&pstates[parts[i].type].state!=ST_GAS)
+ if (ptypes[t].state==ST_GAS&&ptypes[parts[i].type].state!=ST_GAS)
pv[y/CELL][x/CELL] += 0.50f;
parts[i].type = t;
if (t==PT_FIRE||t==PT_PLSM||t==PT_HFLM)