Primitive 0x0069 - Animate Object

There is a SimPe wizard for this instruction, although it is slightly flawed.

If you zero all the operands and then use the wizard to set your values without using Temp2 to set the animation speed, the code will NOT run. The primitive will throw an "Animation speed cannot be zero" error. To fix this, set the 3rd operand to be 0x20 - see the explanation for Op3 in 0x006A. The same is also true for primitives 0x006A and 0x006B.


See Also


SimPe Code

// Decompiled with JetBrains decompiler
// Type: pjse.BhavNameWizards.WizPrim0x0069
// Assembly: pjse.coder.plugin, Version=4.0.3349.37576, Culture=neutral, PublicKeyToken=null

using pjse.BhavOperandWizards;
using SimPe.PackedFiles.Wrapper;
using System;

namespace pjse.BhavNameWizards
{
  public class WizPrim0x0069 : BhavWizPrim
  {
    public WizPrim0x0069(Instruction i)
      : base(i)
    {
    }

    public override ABhavOperandWiz Wizard() => (ABhavOperandWiz) new BhavOperandWizAnimate(this.instruction, "bwp_Object");

    protected override string Operands(bool lng)
    {
      byte[] numArray = new byte[16];
      ((byte[]) this.instruction.Operands).CopyTo((Array) numArray, 0);
      ((byte[]) this.instruction.Reserved1).CopyTo((Array) numArray, 8);
      string str1 = "" + (lng ? Localization.GetString("Object") + ": " : "") + this.dataOwner(lng, numArray[6], numArray[7], numArray[8]) + ", " + (lng ? Localization.GetString("bwp_animation") + ": " : "") + (((int) numArray[2] & 4) != 0 ? "ObjectAnims:[" + this.dataOwner(lng, (byte) 9, numArray[0], numArray[1]) + "]" : this.readStr(GS.GlobalStr.ObjectAnims, BhavWiz.ToShort(numArray[0], numArray[1]), lng ? -1 : 60, lng ? Detail.Normal : Detail.ErrorNames));
      if (lng)
      {
        bool found = false;
        string str2 = str1 + ", " + Localization.GetString("bwp_eventTree") + ": " + this.bhavName((uint) BhavWiz.ToShort(numArray[4], numArray[5]), ref found);
        Scope scope = Scope.Global;
        if (numArray[9] == (byte) 0)
          scope = Scope.Private;
        else if (numArray[9] == (byte) 1)
          scope = Scope.SemiGlobal;
        str1 = str2 + " (" + Localization.GetString(scope.ToString()) + ")" + ", " + Localization.GetString("bwp_animSpeed") + ": " + (((int) numArray[2] & 2) != 0 ? this.dataOwner((byte) 8, (ushort) 2) : "---") + ", " + Localization.GetString("bwp_interruptible") + ": " + (((int) numArray[2] & 8) != 0).ToString() + ", " + Localization.GetString("bwp_startTag") + ": " + (((int) numArray[2] & 16) != 0 ? this.dataOwner((byte) 8, (ushort) 0) : "---") + ", " + Localization.GetString("bwp_loopCount") + ": " + (((int) numArray[2] & 32) != 0 ? this.dataOwner((byte) 8, (ushort) 1) : "---") + ", " + Localization.GetString("bwp_blendOut") + ": " + (((int) numArray[2] & 64) == 0).ToString() + ", " + Localization.GetString("bwp_blendIn") + ": " + (((int) numArray[2] & 128) == 0).ToString() + ", " + Localization.GetString("bwp_flipFlag") + ": " + (((int) numArray[10] & 1) != 0 ? this.dataOwner((byte) 8, (ushort) 3) : (((int) numArray[2] & 1) != 0).ToString()) + ", " + Localization.GetString("bwp_sync") + ": " + (((int) numArray[10] & 4) != 0).ToString() + ", " + Localization.GetString("bwp_alignBlend") + ": " + (((int) numArray[10] & 8) != 0).ToString() + ", " + Localization.GetString("bwp_notHurryable") + ": " + (((int) numArray[10] & 128) != 0).ToString();
      }
      return str1;
    }
  }
}