Wintermute Engine Forum

Wintermute Engine => Bug reports => Topic started by: HCDaniel on November 06, 2011, 03:16:05 PM

Title: Actor does not turn to "new" direction when talking to "old" direction skipped
Post by: HCDaniel on November 06, 2011, 03:16:05 PM
Hi,

I think I have found a bug in WME. I can reproduce this with the scene tutorial, step 8, by replacing the original code from desk.script in the following way:

on "LeftClick"
{
  // just walk to the desk
  // actor.GoTo(544, 638);
  actor.GoTo(397, 650);
  // actor.TurnTo(DI_UPRIGHT);
  actor.TurnTo(DI_UP);
}

Now the position of the actor is the same when the chair and the desk are being examined, and the direction the actor has to turn to is similar.

In that case, the actor does not turn from e.g. the chair to the desk (and vice versa) when one item is examined and while the actor is talking, the second item is examined (the actor will turn AFTER the text has been spoken). You have to be rather quick, but this probably depends on the length of the text to talk.

I took a look at the sources and maybe the problem boils down to the code in

void CAdActor::TurnTo(TDirection dir)

where the variable "m_TargetDir" is not set when "abs(delta) < 2" (which is probably not correct as there will be a mismatch between "m_AfterWalkDir" and "m_TargetDir"). But this is just a guess.

Can you reproduce this?
Title: Re: Actor does not turn to "new" direction when talking to "old" direction skipped
Post by: HCDaniel on November 19, 2011, 04:40:04 PM
I experimented a bit and found that changing the code in

void CAdActor::TurnTo(TDirection dir)

to this:

   // already there?
   if(abs(delta) < 2)
   {
      m_Dir = dir;
      m_TargetDir = dir;
      m_State = m_NextState;
      m_NextState = STATE_READY;
      m_TempSprite2 = NULL;
      return;
   }

solved the problem for me. Although I have no idea what "m_TempSprite2" actually does ;)

Any chance that this will be incorporated into the next WME release?