From 9801ec52b231f17bfd425f843792a4ef973a7098 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Sun, 13 Oct 2013 14:45:24 -0400 Subject: [PATCH] Foreground: don't propagate OnCommand We load foreground changes at the beginning of the screen, but they shouldn't be issued an OnCommand until it's time for them to start. The Foreground layer, however, should get the OnCommand right away. So don't propagate it, since we already issue On manually to changes. --- src/Foreground.cpp | 11 +++++++++++ src/Foreground.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/Foreground.cpp b/src/Foreground.cpp index fdfed2a955..a917f41e76 100644 --- a/src/Foreground.cpp +++ b/src/Foreground.cpp @@ -120,6 +120,17 @@ void Foreground::Update( float fDeltaTime ) m_fLastMusicSeconds = GAMESTATE->m_Position.m_fMusicSeconds; } +void Foreground::HandleMessage( const Message &msg ) +{ + // We want foregrounds to behave as if their On command happens at the + // starting beat, not when the Foreground object receives an On command. + // So don't propagate that; we'll call it ourselves. + if (msg.GetName() == "On") + Actor::HandleMessage(msg); + else + ActorFrame::HandleMessage(msg); +} + /* * (c) 2004 Glenn Maynard * All rights reserved. diff --git a/src/Foreground.h b/src/Foreground.h index 51a0b225fb..e49ba1267a 100644 --- a/src/Foreground.h +++ b/src/Foreground.h @@ -13,6 +13,7 @@ public: void LoadFromSong( const Song *pSong ); virtual void Update( float fDeltaTime ); + virtual void HandleMessage( const Message &msg ); protected: struct LoadedBGA