Primitive 0x0022 - UI Effect


Use

There is no SimPe wizard for this instruction, so the following table details the meaning of each of the operands.

OperandDescriptionOperand Values
0 UI Effect 0x00: Press Control
0x01: Disable Control
0x02: Enable Control
0x03: Play Effect On Control
0x04: Set Event Tree On Control
0x05: Reset State on ALL Controls
0x06: Disable ALL Controls
0x07: Reset Event Tree On ALL Controls
0x08: Set Event Tree On TNS Node
0x09: Set Control Visible
0x0A: Set Control Hidden
1 & 2 Window GUID (from STR# 0x0096), scope from Op5 bits 1 and 2 NOT for 0x08 (Set Event Tree On TNS Node)
3 & 4 Control GUID (from STR# 0x0096), scope from Op5 bits 3 and 4 NOT 0x05 thru 0x08 (ALLs or TNS)
5 - bit 1 Window GUID Scope Off: See bit 2
On: Global
5 - bit 2 Window GUID Scope Off: Private
On: Semi-global
5 - bit 3 Control GUID Scope Off: See bit 4
On: Global
5 - bit 4 Control GUID Scope Off: Private
On: Semi-global
5 - bit 5 thru 8 Unused
6 & 7 0: Stop effect
1: Start effect
ONLY for 0x03 (Play Effect On Control)
8 & 9 Event Tree (scope in Op10) ONLY for 0x04 (Set Event Tree On Control) AND for 0x08 (Set Event Tree On TNS Node)
10 Event Tree Scope 0: Private
1: Semi-global
2: Global
11 & 12 Qualifiers on the variable in operand 13
13 Variable of TNS ID ONLY for 0x08 (Set Event Tree On TNS Node)
14 thru 15 Unused

See Also


SimPe Code

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

using SimPe.PackedFiles.Wrapper;
using System;

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

    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 str = "" + BhavWiz.readStr(GS.BhavStr.UIEffectType, (ushort) numArray[0]);
      if (numArray[0] < (byte) 5 || numArray[0] > (byte) 8)
      {
        Scope scope = Scope.Private;
        if (((int) numArray[5] & 4) != 0)
          scope = Scope.Global;
        else if (((int) numArray[5] & 8) != 0)
          scope = Scope.SemiGlobal;
        str = str + " " + this.readStr(scope, GS.GlobalStr.UIEffect, BhavWiz.ToShort(numArray[3], numArray[4]), lng ? -1 : 60, lng ? Detail.Normal : Detail.ErrorNames);
      }
      if (lng)
      {
        if (numArray[0] != (byte) 8)
        {
          Scope scope = Scope.Private;
          if (((int) numArray[5] & 1) != 0)
            scope = Scope.Global;
          else if (((int) numArray[5] & 2) != 0)
            scope = Scope.SemiGlobal;
          str = str + ", " + Localization.GetString("bwp22_windowID") + ": " + this.readStr(scope, GS.GlobalStr.UIEffect, BhavWiz.ToShort(numArray[1], numArray[2]), -1, lng ? Detail.Normal : Detail.ErrorNames);
        }
        else
          str = str + ", " + Localization.GetString("bwp_TNSID") + ": " + this.dataOwner(numArray[13], numArray[11], numArray[12]);
        if (numArray[0] == (byte) 3)
          str = str + ", " + (BhavWiz.ToShort(numArray[6], numArray[7]) != (ushort) 0 ? Localization.GetString("bwp22_startingEffect") : Localization.GetString("bwp22_stoppingEffect"));
        if (numArray[0] == (byte) 4 || numArray[0] == (byte) 8)
        {
          Scope scope = Scope.Global;
          if (numArray[10] == (byte) 0)
            scope = Scope.Private;
          else if (numArray[10] == (byte) 1)
            scope = Scope.SemiGlobal;
          bool found = false;
          str = str + ", " + Localization.GetString("bwp_eventTree") + ": " + this.bhavName((uint) BhavWiz.ToShort(numArray[8], numArray[9]), ref found) + " (" + Localization.GetString(scope.ToString()) + ")";
        }
      }
      return str;
    }
  }
}