Difference between revisions of "Variables"

From The Powder Toy
Jump to: navigation, search
m
(Fix table formatting)
Line 4: Line 4:
  
 
^ General ^^
 
^ General ^^
^ Variable ^ What it returns ^
+
{|
| pmap[y][x] | Particle-map. Returns particle at [y][x] |
+
| Variable || What it returns
| bmap[y][x] | Block-map. Returns wall at [y][x]. |
+
|-
| emap[y][x] | Electronics-map. Used for conductive walls. |
+
| pmap[y][x] || Particle-map. Returns particle at [y][x]
| r | usually preset to pmap[y][x] |
+
|-
| pv[y/CELL][x/CELL] | The pressure at x,y. Pressure is on a 4x4 grid like walls. Is a float(0.0f for 0). |
+
| bmap[y][x] || Block-map. Returns wall at [y][x].
| hv[y/CELL][x/CELL] | The ambient heat at x,y. It is on a 4x4 grid like walls and pressure. Is a float(0.0f for 0). |
+
|-
| sl | Selected left. Means particle selected in menu by left mouse button. |
+
| emap[y][x] || Electronics-map. Used for conductive walls.
| sr | Selected right. Means particle selected in menu by right mouse button. |
+
|-
| t | Current particle type. ex. PT_DUST |
+
| r || usually preset to pmap[y][x]
 +
|-
 +
| pv[y/CELL][x/CELL] || The pressure at x,y. Pressure is on a 4x4 grid like walls. Is a float(0.0f for 0).
 +
|-
 +
| hv[y/CELL][x/CELL] || The ambient heat at x,y. It is on a 4x4 grid like walls and pressure. Is a float(0.0f for 0).
 +
|-
 +
| sl || Selected left. Means particle selected in menu by left mouse button.
 +
|-
 +
| sr || Selected right. Means particle selected in menu by right mouse button.
 +
|-
 +
| t || Current particle type. ex. PT_DUST
 +
|}
 +
 
 
^ Particle ^^
 
^ Particle ^^
^ Variable ^ What it returns ^
+
{|
| parts[i].<sup>1</sup> | Current Particle |
+
| Variable || What it returns
| parts[r>>8].<sup>1</sup> | A property of particle 'r'. Is usually around(based on for loops) the current one(i). |
+
|-
| (r&0xFF) | Same as (parts[r>>8].type) |
+
| parts[i].<sup>1</sup> || Current Particle  
 +
|-
 +
| parts[r>>8].<sup>1</sup> || A property of particle 'r'. Is usually around(based on for loops) the current one(i).
 +
|-
 +
| (r&0xFF) || Same as (parts[r>>8].type)  
 +
|-
 +
 
 
^ Particle Information ^^
 
^ Particle Information ^^
^ Variable ^ What it returns ^
+
{|
| parts[<sup>2</sup>].type | Contains the particles current type. |
+
| Variable || What it returns
| parts[<sup>2</sup>].ctype | Contains the particles previous type (for example LAVA) or the type of particle to clone with BCLN, PCLN or CLNE |
+
|-
| parts[<sup>2</sup>].life | Contains the particles life. |  
+
| parts[<sup>2</sup>].type || Contains the particles current type.  
| parts[<sup>2</sup>].temp | Contains the particles Temperature. Is a float(0.0f for 0). |
+
|-
| parts[<sup>2</sup>].tmp | Contains the particles temporary values which can be used for anything. |
+
| parts[<sup>2</sup>].ctype || Contains the particles previous type (for example LAVA) or the type of particle to clone with BCLN, PCLN or CLNE  
^^^
+
|-
 +
| parts[<sup>2</sup>].life || Contains the particles life.
 +
|-
 +
| parts[<sup>2</sup>].temp || Contains the particles Temperature. Is a float(0.0f for 0).
 +
|-
 +
| parts[<sup>2</sup>].tmp || Contains the particles temporary values which can be used for anything.  
 +
|-
 +
|}
  
|<sup>1</sup> - use either type, ctype, life, temp or tmp||
+
<sup>1</sup> - use either type, ctype, life, temp or tmp
  
|<sup>2</sup> - use either r>>8 or i||
+
<sup>2</sup> - use either r>>8 or i
  
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 13:53, 29 September 2011

This is a list of useful variables and usages of them inside the source.


^ General ^^

Variable What it returns
pmap[y][x] Particle-map. Returns particle at [y][x]
bmap[y][x] Block-map. Returns wall at [y][x].
emap[y][x] Electronics-map. Used for conductive walls.
r usually preset to pmap[y][x]
pv[y/CELL][x/CELL] The pressure at x,y. Pressure is on a 4x4 grid like walls. Is a float(0.0f for 0).
hv[y/CELL][x/CELL] The ambient heat at x,y. It is on a 4x4 grid like walls and pressure. Is a float(0.0f for 0).
sl Selected left. Means particle selected in menu by left mouse button.
sr Selected right. Means particle selected in menu by right mouse button.
t Current particle type. ex. PT_DUST

^ Particle ^^

^ Particle Information ^^
Variable What it returns
parts[i].1 Current Particle
parts[r>>8].1 A property of particle 'r'. Is usually around(based on for loops) the current one(i).
(r&0xFF) Same as (parts[r>>8].type)
Variable What it returns
parts[2].type Contains the particles current type.
parts[2].ctype Contains the particles previous type (for example LAVA) or the type of particle to clone with BCLN, PCLN or CLNE
parts[2].life Contains the particles life.
parts[2].temp Contains the particles Temperature. Is a float(0.0f for 0).
parts[2].tmp Contains the particles temporary values which can be used for anything.

1 - use either type, ctype, life, temp or tmp

2 - use either r>>8 or i