From 35b1059e053bc1909b4248e020bafcf3c5a3f61c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 21 Sep 2005 17:45:34 +0000 Subject: [PATCH] fix x/y set in InitCommand sometimes overridden --- stepmania/src/ActorUtil.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index 65b606e550..91d4838de9 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -292,7 +292,15 @@ void ActorUtil::SetXY( Actor& actor, const CString &sType ) if( !actor.HasCommand("On") ) // this actor hasn't loaded commands yet LoadAllCommands( actor, sType ); - actor.SetXY( THEME->GetMetricF(sType,actor.GetName()+"X"), THEME->GetMetricF(sType,actor.GetName()+"Y") ); + /* + * Hack: This is run after InitCommand, and InitCommand might set X/Y. If + * these are both 0, leave the actor where it is. If InitCommand doesn't, + * then 0,0 is the default, anyway. + */ + float fX = THEME->GetMetricF(sType,actor.GetName()+"X"); + float fY = THEME->GetMetricF(sType,actor.GetName()+"Y"); + if( fX != 0 || fY != 0 ) + actor.SetXY( fX, fY ); } void ActorUtil::LoadCommand( Actor& actor, const CString &sType, const CString &sCommandName )