aboutsummaryrefslogtreecommitdiff
path: root/engines/tony
diff options
context:
space:
mode:
authorPaul Gilbert2012-05-13 00:24:53 +1000
committerPaul Gilbert2012-05-13 00:24:53 +1000
commitd615f0054058a8888a8dfa366adaae75c72c5ac9 (patch)
treeed7317e2a2d748e9364f8eba86a36e4fc2f0c7d4 /engines/tony
parent045f93f0fe761cb788e496d68ed5f9b2953692af (diff)
downloadscummvm-rg350-d615f0054058a8888a8dfa366adaae75c72c5ac9.tar.gz
scummvm-rg350-d615f0054058a8888a8dfa366adaae75c72c5ac9.tar.bz2
scummvm-rg350-d615f0054058a8888a8dfa366adaae75c72c5ac9.zip
TONY: Workaround for correctly hiding items when they are disabled.
I've traced through the code, and the order seems to specifically put the object into the 'destroy me' state by calling another process/thread, but then immediately replaces the values when it returns to the calling method. This workaround at least detects when an item is supposed to be destroyed, and ensures it remains in the 'destroy me' state.
Diffstat (limited to 'engines/tony')
-rw-r--r--engines/tony/loc.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp
index 37fe29f359..7a51386a1c 100644
--- a/engines/tony/loc.cpp
+++ b/engines/tony/loc.cpp
@@ -321,6 +321,13 @@ int RMPattern::Update(uint32 hEndPattern, byte &bFlag, RMSfx *sfx) {
RMPattern::RMPattern() {
m_slots = NULL;
+ m_speed = 0;
+ m_bLoop = 0;
+ m_nSlots = 0;
+ m_nCurSlot = 0;
+ m_nCurSprite = 0;
+ m_nStartTime = 0;
+ m_slots = NULL;
}
RMPattern::~RMPattern() {
@@ -706,9 +713,18 @@ bool RMItem::DoFrame(RMGfxTargetBuffer *bigBuf, bool bAddToList) {
return false;
// Facciamo un update del pattern, che ci ritorna anche il frame corrente
- if (m_nCurPattern != 0)
+ if (m_nCurPattern != 0) {
m_nCurSprite = m_patterns[m_nCurPattern].Update(m_hEndPattern, m_bCurFlag, m_sfx);
+ // WORKAROUND: Currently, m_nCurSprite = -1 is used to flag that an item should be removed.
+ // However, this seems to be done inside a process waiting on an event pulsed inside the pattern
+ // Update method. So the value of m_nCurSprite = -1 is being destroyed with the return value
+ // replacing it. It may be that the current coroutine PulseEvent implementation is wrong somehow.
+ // In any case, a special check here is done for items that have ended
+ if (m_nCurPattern == 0)
+ m_nCurSprite = -1;
+ }
+
// Se la funzione ha ritornato -1, vuol dire che il pattern e' finito
if (m_nCurSprite == -1) {
// Mettiamo il pattern 0, e usciamo. La classe si auto-deregistrera' della OT list
@@ -764,7 +780,7 @@ void RMItem::RemoveThis(CORO_PARAM, bool &result) {
void RMItem::SetStatus(int nStatus) {
- m_bIsActive = (nStatus>0);
+ m_bIsActive = (nStatus > 0);
}
void RMItem::SetPattern(int nPattern, bool bPlayP0) {