draw global particles on plane 900

Previously, global particles would be drawn even in front of Plane 1000+ (GUI) objects. Additionally, it was impossible to specify particles that were supposed to always be in front of all other particles (e.g. fog, clouds, emulated FoW, ...).
Now, you can attach particles to an object on plane 901+ and have them be in front of everything else.
liquid_container
David Dormagen 2016-02-09 20:39:11 +01:00
parent 99d5a7c8c9
commit 91391c64af
3 changed files with 14 additions and 7 deletions

View File

@ -133,7 +133,7 @@ Stand = {
<row id="Plane">
<col><code>Plane</code></col>
<col>int</col>
<col>The Object's minor Z-Position. Negative values are behind the landscape, positive values before it. Use 1-399 for stuff behind Clonks, 401-999 for stuff before Clonks, and 1000+ for GUI objects.</col>
<col>The Object's minor Z-Position. Negative values are behind the landscape, positive values before it. Use 1-399 for stuff behind Clonks, 401-999 for stuff before Clonks, and 1000+ for GUI objects. Global particles are on 900.</col>
</row>
<row id="SolidMaskPlane">
<col><code>SolidMaskPlane</code></col>

View File

@ -149,7 +149,7 @@
<row>
<col>Attach</col>
<col>bit mask</col>
<col>Defines the attachment of the particles to the calling object. Can be a combination of ATTACH_Front, ATTACH_Back, and ATTACH_MoveRelative. For example <code>ATTACH_Front | ATTACH_MoveRelative</code></col>
<col>Defines the attachment of the particles to the calling object. Can be a combination of ATTACH_Front, ATTACH_Back, and ATTACH_MoveRelative. For example <code>ATTACH_Front | ATTACH_MoveRelative. Non-attached particles are drawn on plane 900 (i.e. before most objects).</code></col>
</row>
</table>
</text>

View File

@ -275,16 +275,23 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawGame, bool fDrawOverlay)
::PXS.Draw(cgo);
C4ST_STOP(PXSStat)
// draw objects
C4ST_STARTNEW(ObjStat, "C4Viewport::Draw: Objects")
::Objects.Draw(cgo, Player, 1, 2147483647 /* INT32_MAX */);
// Draw objects which are behind the particle plane.
const int particlePlane = 900;
C4ST_STARTNEW(ObjStat, "C4Viewport::Draw: Objects (1)")
::Objects.Draw(cgo, Player, 1, particlePlane);
C4ST_STOP(ObjStat)
// draw global dynamic particles
C4ST_STARTNEW(PartStat, "C4Viewport::Draw: Dynamic Particles")
// Draw global dynamic particles on a specific Plane
// to enable scripters to put objects both behind and in front of particles.
C4ST_STARTNEW(PartStat, "C4Viewport::Draw: Dynamic Particles")
::Particles.DrawGlobalParticles(cgo);
C4ST_STOP(PartStat)
// Now the remaining objects in front of the particles (e.g. GUI elements)
C4ST_STARTNEW(Obj2Stat, "C4Viewport::Draw: Objects (2)")
::Objects.Draw(cgo, Player, particlePlane + 1, 2147483647 /* INT32_MAX */);
C4ST_STOP(Obj2Stat)
// Draw everything else without FoW
pDraw->SetFoW(NULL);
}