Oops. Actor::LoadFromNode wasn't virtual, but we were treating it as if
it was (BitmapText::LoadFromNode, etc. called it). This worked because REGISTER_ACTOR_CLASS called it before the object was downcasted to an Actor. We then re-called Actor::LoadFromNode from ActorUtil::LoadFromActorFile; this worked because all it did was re-run Actor init (causing double calls to Init) and not the whole actor. (first half fix: make Actor::LoadFromNode virtual and add comment)
This commit is contained in:
@@ -31,7 +31,7 @@ public:
|
|||||||
virtual Actor *Copy() const;
|
virtual Actor *Copy() const;
|
||||||
void UnsubcribeAndClearCommands();
|
void UnsubcribeAndClearCommands();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
virtual void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||||
|
|
||||||
static void SetBGMTime( float fTime, float fBeat );
|
static void SetBGMTime( float fTime, float fBeat );
|
||||||
static void SetBGMLight( int iLightNumber, float fCabinetLights );
|
static void SetBGMLight( int iLightNumber, float fCabinetLights );
|
||||||
|
|||||||
@@ -197,7 +197,20 @@ Actor* ActorUtil::LoadFromActorFile( const CString& sDir, const XNode* pNode )
|
|||||||
pReturn = ActorUtil::MakeActor( sNewPath );
|
pReturn = ActorUtil::MakeActor( sNewPath );
|
||||||
if( pReturn == NULL )
|
if( pReturn == NULL )
|
||||||
goto all_done;
|
goto all_done;
|
||||||
pReturn->LoadFromNode( sDir, pNode );
|
|
||||||
|
/*
|
||||||
|
* Hack: take attributes from the file loading the new actor,
|
||||||
|
* and load them on top of the new file. This way, you can do
|
||||||
|
* eg:
|
||||||
|
*
|
||||||
|
* file1.xml: <Layer File="file2" OnCommand="x,10" />
|
||||||
|
* file2.xml: <Layer File="image" OffCommand="y,10" />
|
||||||
|
*
|
||||||
|
* Be sure to only run the low-level load, to pull in commands;
|
||||||
|
* don't reload the high-level actor, and don't rerun Init (which
|
||||||
|
* has already been run).
|
||||||
|
*/
|
||||||
|
pReturn->Actor::LoadFromNode( sDir, pNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
all_done:
|
all_done:
|
||||||
|
|||||||
Reference in New Issue
Block a user