forked from Mirrors/openclonk
ConstructionSite: Overloadable function for construction site preview
parent
9c3c6d1079
commit
3e26d4258a
|
@ -199,18 +199,7 @@ public func Set(id def, int dir, object stick)
|
|||
// Draw the building with a wired frame and large alpha unless site graphics is overloaded by definition
|
||||
if (!definition->~SetConstructionSiteOverlay(this, direction, stick_to))
|
||||
{
|
||||
SetGraphics(nil, nil, 0);
|
||||
SetGraphics(nil, def, 1, GFXOV_MODE_Base);
|
||||
SetClrModulation(RGBa(255, 255, 255, 128), 1);
|
||||
// If the structure is a mesh, use wire frame mode to show the site.
|
||||
// TODO: use def->IsMesh() once this becomes available.
|
||||
if (def->GetMeshMaterial())
|
||||
{
|
||||
SetClrModulation(RGBa(255, 255, 255, 50), 1);
|
||||
SetGraphics(nil, def, 2, GFXOV_MODE_Base, nil, GFX_BLIT_Wireframe);
|
||||
}
|
||||
SetObjDrawTransform((1 - dir * 2) * 1000, 0, 0, 0, 1000, -h * 500, 1);
|
||||
SetObjDrawTransform((1 - dir * 2) * 1000, 0, 0, 0, 1000, -h * 500, 2);
|
||||
SetConstructionSiteOverlay(def, direction, stick_to, w, h);
|
||||
}
|
||||
|
||||
SetName(Format(Translate("TxtConstruction"), def->GetName()));
|
||||
|
@ -220,6 +209,23 @@ public func Set(id def, int dir, object stick)
|
|||
}
|
||||
|
||||
|
||||
private func SetConstructionSiteOverlay(id def, int dir, object stick, int w, int h)
|
||||
{
|
||||
SetGraphics(nil, nil, 0);
|
||||
SetGraphics(nil, def, 1, GFXOV_MODE_Base);
|
||||
SetClrModulation(RGBa(255, 255, 255, 128), 1);
|
||||
// If the structure is a mesh, use wire frame mode to show the site.
|
||||
// TODO: use def->IsMesh() once this becomes available.
|
||||
if (def->GetMeshMaterial())
|
||||
{
|
||||
SetClrModulation(RGBa(255, 255, 255, 50), 1);
|
||||
SetGraphics(nil, def, 2, GFXOV_MODE_Base, nil, GFX_BLIT_Wireframe);
|
||||
}
|
||||
SetObjDrawTransform((1 - dir * 2) * 1000, 0, 0, 0, 1000, -h * 500, 1);
|
||||
SetObjDrawTransform((1 - dir * 2) * 1000, 0, 0, 0, 1000, -h * 500, 2);
|
||||
}
|
||||
|
||||
|
||||
private func UpdateStatus(object item)
|
||||
{
|
||||
// Ignore any activity during construction
|
||||
|
|
Loading…
Reference in New Issue