Primitive 0x006E - Look At

This primitive directs a Sim to look at something.


Use

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

There are two node versions for this primitive, the following table is for node version 0. Differences between node version 0 and node version 1 are summarised after the table.


Node Version 0

OperandDescriptionOperand Values
0 - bit 1 Controls where Start/Stop Off: Start
On: Stop
0 - bit 2 Allow early exit Note: Off is true, on is false
0 - bit 3 Include spine
0 - bit 4 Controls where Turn Speed is taken from Off: Use value in Op4
On: Use value in Temp 1
0 - bit 5 Controls where Duration is taken from Off: No duration
On: Use value in Temp 0
0 - bit 6 Ignore room
0 - bit 7 Ignore frustrum
0 - bit 8 Controls where the Sim looks Off: Use value in Op1
On: Look at the camera
1 Variable defining the Target
2 & 3 Qualifiers on the variable in operand 1
4 Turn Speed If Op0 Bit4 is 0, otherwise Turn Speed is in Temp 1
5 thru 7 Unused
8 Slot Type
9 & 10 Event Tree
11 Scope 0x00: Private
0x01: Semi-global
0x02: Global
12 & 13 Unused
14 Slot Number
15 Unused

Node Version 1

Node version 1 defines both the turn towards speed and the turn away speed.

Turn Speed becomes Turn Towards Speed and is controlled by Op0 Bit4 and Op4 (if Op4 is used, value is doubled)

Turn Away Speed is controlled by Op15 Bit1 and Bit2, and Op5

OperandDescriptionOperand Values
0 - bit 4 Controls where Turn Speed is taken from Off: Use value in Op4
On: Use value in Temp 1
4 Turn Towards Speed If Op0 Bit4 is 0 this value is doubled, otherwise Turn Towards Speed is in Temp 1
5 Turn Away Speed If Op15 Bit1 and Bit2 are 0 this value is doubled, otherwise Turn Speed is in Temp 1 or Temp 2 (see Op15)
15 - bit 1 Controls where Turn Away Speed is taken from Off: Use value in Op5
On: Use value in Temp 2
15 - bit 2 Controls where Turn Away Speed is taken from Off: Use value in Op5
On: Use value in Temp 1

See Also


SimPe Code

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

using SimPe.PackedFiles.Wrapper;
using System;

namespace pjse.BhavNameWizards
{
  public class WizPrim0x006e : BhavWizPrim
  {
    public WizPrim0x006e(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 str1 = "" + (lng ? Localization.GetString("Target") + ": " : "") + (((int) numArray[0] & 128) == 0 ? this.dataOwner(lng, numArray[1], numArray[2], numArray[3]) : Localization.GetString("bwp6e_camera")) + ", " + BhavWiz.Slot(numArray[14], numArray[8]);
      if (((int) numArray[0] & 1) == 0)
      {
        if (lng)
        {
          bool found = false;
          string str2 = str1 + ", " + Localization.GetString("bwp_eventTree") + ": " + this.bhavName((uint) BhavWiz.ToShort(numArray[9], numArray[10]), ref found);
          Scope scope = Scope.Global;
          if (numArray[11] == (byte) 0)
            scope = Scope.Private;
          else if (numArray[11] == (byte) 1)
            scope = Scope.SemiGlobal;
          str1 = str2 + " (" + Localization.GetString(scope.ToString()) + ")" + ", " + Localization.GetString("bwp6e_earlyExit") + ": " + (((int) numArray[0] & 2) == 0).ToString() + ", " + Localization.GetString("bwp6e_includeSpine") + ": " + (((int) numArray[0] & 4) != 0).ToString() + ", " + Localization.GetString("bwp6e_duration") + ": " + (((int) numArray[0] & 16) != 0 ? this.dataOwner((byte) 8, (ushort) 0) : "---");
        }
      }
      else
        str1 = str1 + ": " + Localization.GetString("bwp6e_STOP");
      if (lng)
      {
        string str2;
        if (this.instruction.NodeVersion != (byte) 0)
        {
          string str3 = str1 + ", " + Localization.GetString("bwp6e_turnTowards") + ": " + (((int) numArray[0] & 8) != 0 ? this.dataOwner((byte) 8, (ushort) 1) : (2 * (int) numArray[4]).ToString() + " " + Localization.GetString("bwp6e_deg_s")) + ", " + Localization.GetString("bwp6e_turnAway") + ": ";
          str2 = (((int) numArray[15] & 2) == 0 ? (((int) numArray[15] & 1) == 0 ? str3 + (2 * (int) numArray[5]).ToString() + " " + Localization.GetString("bwp6e_deg_s") : str3 + this.dataOwner((byte) 8, (ushort) 2)) : str3 + this.dataOwner((byte) 8, (ushort) 1)) + ", " + Localization.GetString("bwp_notHurryable") + ": " + (((int) numArray[15] & 4) != 0).ToString();
        }
        else
          str2 = str1 + ", " + Localization.GetString("bwp6e_speed") + ": " + (((int) numArray[0] & 8) != 0 ? this.dataOwner((byte) 8, (ushort) 1) : numArray[4].ToString() + " " + Localization.GetString("bwp6e_deg_s"));
        str1 = str2 + ", " + Localization.GetString("bwp6e_ignoreRoom") + ": " + (((int) numArray[0] & 32) != 0).ToString() + ", " + Localization.GetString("bwp6e_ignoreFrustrum") + ": " + (((int) numArray[0] & 64) != 0).ToString();
      }
      return str1;
    }
  }
}