Variables/ko

From The Powder Toy
Jump to: navigation, search
Language: English  • 한국어 • polski • русский

이곳은 소스 코드에서의 유용한 변수와 변수의 사용법에 대한 목록입니다. - 아직 완벽히 번역되지 못하였습니다.


일반

변수명
pmap[y][x] 입자 맵.(pmap[y][x]&0xFF)은 (x, y) 좌표에 있는 물질의 타입을 나타냅니다. (pmap[y][x]>>8)은 (x, y)좌표에 있는 물질의 번호를 나타냅니다. 에너지 타입의 물질은 이곳에 저장되지 않으므로, photons 맵을 사용해야 합니다.
sim->photons[y][x] Photon 맵. 이것은 pmap과 같은 역할을 하지만, PHOT, NEUT, ELEC, PROT만이(에너지 타입의 모든 입자) 이곳에 저장됩니다.
sim->bmap[y][x] Block-map. Returns wall at [y][x]. Wall constants are defined in src/simulation/SimulationData.h
sim->emap[y][x] Electronics-map. Used for conductive walls. If it is 1, that means the wall at that location is conducting.
r usually preset to pmap[y][x]
parts[i] the particle that has index i
sim->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).
sim->vx[y/CELL][x/CELL] The air velocity in the x direction at x,y. Uses a 4x4 grid like walls. Is a float(0.0f for 0).
sim->vy[y/CELL][x/CELL] The air velocity in the y direction at x,y. Uses a 4x4 grid like walls. Is a float(0.0f for 0).
sim->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).
t Current particle type in some places. ex. PT_DUST

Particle

To get information from a particle, use parts[i].1, where i is the particle index. The index may also be stored as r>>8 instead of i. This is normally used in the update functions for particles. i is the index of the particle that is being updated, and r>>8 is the index of a particle surrounding it that it might react with or modify. To get the type of the particle from the variable r, use (r&0xFF).

Particle Information

Variable What it returns
parts[2].type Contains the particle's current type.
parts[2].ctype Contains the particle's previous type (for example LAVA/SPRK) or the type of particle it is cloning (CLNE/...) usually.
parts[2].life Contains the particle's life.
parts[2].temp Contains the particle's temperature. It's a float(0.0f for 0K, which is -273.15C). All temps are stored in Kelvins.
parts[2].tmp Contains a value which can be used for anything. Most particles don't use it.
parts[2].tmp2 Contains another value. Even less particles use this.
parts[2].dcolour Contains the particle's decoration color, 32bit ARGB
parts[2].x Contains the particle's x coordinate. It is not an integer, it's a float. To get the exact coordinate, add .5 to it before changing it to an int.
parts[2].y Contains the particle's y coordinate. It is not an integer, it's a float. To get the exact coordinate, add .5 to it before changing it to an int.
parts[2].vx Contains the particle's x velocity. It is a float.
parts[2].vy Contains the particle's y velocity. It is a float

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

2 - use either r>>8 or i. See above (Particle) for more info.