add queuemessage
This commit is contained in:
+13
-1
@@ -359,7 +359,10 @@ void Actor::UpdateTweening( float fDeltaTime )
|
||||
// Execute the command in this tween (if any).
|
||||
if( TS.sCommandName.size() )
|
||||
{
|
||||
this->PlayCommand( TS.sCommandName );
|
||||
if( TS.sCommandName.Left(1) == "!" )
|
||||
MESSAGEMAN->Broadcast( TS.sCommandName.substr(1) );
|
||||
else
|
||||
this->PlayCommand( TS.sCommandName );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1028,6 +1031,15 @@ void Actor::QueueCommand( const CString& sCommandName )
|
||||
DestTweenState().sCommandName = sCommandName;
|
||||
}
|
||||
|
||||
void Actor::QueueMessage( const CString& sMessageName )
|
||||
{
|
||||
// Hack: use "!" as a marker to broadcast a command, instead of playing a
|
||||
// command, so we don't have to add yet another element to every tween
|
||||
// state for this rarely-used command.
|
||||
BeginTweening( 0, TWEEN_LINEAR );
|
||||
DestTweenState().sCommandName = "!" + sMessageName;
|
||||
}
|
||||
|
||||
void Actor::AddCommand( const CString &sCmdName, apActorCommands apac )
|
||||
{
|
||||
m_mapNameToCommands[sCmdName] = apac;
|
||||
|
||||
@@ -196,6 +196,7 @@ public:
|
||||
void StopTweening();
|
||||
void Sleep( float time );
|
||||
void QueueCommand( const CString& sCommandName );
|
||||
void QueueMessage( const CString& sMessageName );
|
||||
virtual void FinishTweening();
|
||||
virtual void HurryTweening( float factor );
|
||||
// Let ActorFrame and BGAnimation override
|
||||
@@ -529,6 +530,7 @@ public:
|
||||
static int draworder( T* p, lua_State *L ) { p->SetDrawOrder(IArg(1)); return 0; }
|
||||
static int playcommand( T* p, lua_State *L ) { p->PlayCommand(SArg(1)); return 0; }
|
||||
static int queuecommand( T* p, lua_State *L ) { p->QueueCommand(SArg(1)); return 0; }
|
||||
static int queuemessage( T* p, lua_State *L ) { p->QueueMessage(SArg(1)); return 0; }
|
||||
|
||||
static void Register(lua_State *L) {
|
||||
ADD_METHOD( sleep )
|
||||
@@ -620,6 +622,7 @@ public:
|
||||
ADD_METHOD( draworder )
|
||||
ADD_METHOD( playcommand )
|
||||
ADD_METHOD( queuecommand )
|
||||
ADD_METHOD( queuemessage )
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,6 +41,7 @@ ActorCommands::ActorCommands( const CString &sCommands )
|
||||
sName == "cullmode" ||
|
||||
sName == "playcommand" ||
|
||||
sName == "queuecommand" ||
|
||||
sName == "queuemessage" ||
|
||||
sName == "settext";
|
||||
|
||||
for( unsigned i=1; i<cmd.m_vsArgs.size(); i++ )
|
||||
|
||||
Reference in New Issue
Block a user