C4Object: Don't do any drawing calcs when headless

There's no point in calculating render positions or audio source
locations when we're not rendering any audio or graphics. Skip it when
headless to save CPU cycles.
stable-5.4
Nicolas Hake 2013-10-18 18:46:46 +02:00
parent 759cf73704
commit 7ffa636540
1 changed files with 6 additions and 1 deletions

View File

@ -1892,6 +1892,7 @@ bool C4Object::SetPhase(int32_t iPhase)
void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, float offX, float offY)
{
#ifndef USE_CONSOLE
C4Facet ccgo;
// Status
@ -2173,11 +2174,12 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
// Restore visibility inside FoW
if (fOldClrModEnabled) pDraw->SetClrModMapEnabled(fOldClrModEnabled);
#endif
}
void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, float offX, float offY)
{
#ifndef USE_CONSOLE
// Status
if (!Status || !Def) return;
// visible?
@ -2284,10 +2286,12 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw
}
// end of color modulation
if (!eDrawMode) FinishedDrawing();
#endif
}
void C4Object::DrawLine(C4TargetFacet &cgo)
{
#ifndef USE_CONSOLE
// Audibility
SetAudibilityAt(cgo, Shape.VtxX[0],Shape.VtxY[0]);
SetAudibilityAt(cgo, Shape.VtxX[Shape.VtxNum-1],Shape.VtxY[Shape.VtxNum-1]);
@ -2308,6 +2312,7 @@ void C4Object::DrawLine(C4TargetFacet &cgo)
color0, color1);
// reset blit mode
FinishedDrawing();
#endif
}
void C4Object::CompileFunc(StdCompiler *pComp, C4ValueNumbers * numbers)