Skip to content

0x2D — character_rotate_option

Resolves a character and then configures character rotation, character option targets, capture data, posture, speed limits, and head angle through CCharacterRotate, CCharacterOption, CCharacterCapture, and quaternion helper calls.

proven— handler traced, and exercised by at least one shipped script.

At a glance

Opcode0x2D (45)
HandlerCRadiScript::Command_2d
SignatureCRadiScript::Command_2d(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run2.cpp
Address— debug build; click for all 3
Handler size0xD34 (3380 bytes)
Engine namecharacter_rotate_option
FamilyCharacters
Command size4 + extra_words * 4 bytes

Handler behaviour

Resolves a character and then configures character rotation, character option targets, capture data, posture, speed limits, and head angle through CCharacterRotate, CCharacterOption, CCharacterCapture, and quaternion helper calls.

Encoding

The command header is one 32-bit word, as described in §3 Instruction encoding:

 31            24 23            16 15             8 7              0
+----------------+----------------+----------------+----------------+
|  flags         |  argument byte |  extra words   |  0x2D          |
+----------------+----------------+----------------+----------------+

Bits 8–15 give the number of 32-bit operand words that follow. Bits 16–23 are handed to the handler as a bitfield; on character commands bit 0 normally says whether a character selector word is present. Bit 31 is the keep-going bit.

Operand fields

17 documented fields. input fields are read from the command's operand words; derived fields are computed from other fields rather than stored separately.

FieldRoleMeaning
actioninputWhich action this command performs, read from its mode or control bits. Each name is one branch of the handler, so changing it changes what the line does.
argderivedRaw handler argument byte from the command header. It is printed only when it differs from the value the named fields already imply, so seeing it means the command uses an unusual argument encoding.
bit13derivedNot yet traced. The handler consumes it but its meaning was never established, so it is preserved verbatim rather than given an invented name.
characterinputThe packed 32-bit character selector word. Its low half is the character id and byte 2 is a secondary class/variant input; see character_number and character_variant.
duration_textinputHuman-readable rendering of the command's duration word. Edit the underlying duration_word when it is listed as an input.
head_angle_addinputExtra head angle added on top of the body rotation, as x:..,y:...
initial_vecinputThree-component vector (x, y, z) for initial.
modederivedHandler path selector taken from the argument byte. The meaning is specific to each command.
position_offsetderivedOffset applied to position.
postprocess_modeinputMode selector for postprocess; the handler branches on it.
speed_valuesinputRotation speed operands, in the order the handler consumes them.
standinputStand-position operand, resolved through GetAbstractionStandPosNumber.
target_char_from_streamderivedWhether the target character comes from the stream rather than the current context.
target_character_pairinputPacked target character word for the target-character rotate actions.
target_posture_vecinputThree-component vector (x, y, z) for target posture.
target_vectorinputDirection the character turns toward.
yieldderivedPause the script here for one game frame; the next command runs on the following update. Lines without it keep running immediately.

Engine calls

Engine functions this handler was observed calling:

  • CCharacterCapture::Initialize()
  • CCharacterManager::GetCharacterClass2(int,unsigned int,const CCharacter*,unsigned int)
  • CCharacterManager::GetCharacterOptionClass(const CCharacter*)
  • CCharacterManager::GetCharacterRotateClass(const CCharacter*)
  • CCharacterManager::SetCharacterAttribute(CCharacter*,unsigned int,int)
  • CCharacterOption::SetPosture
  • CCharacterOption::SetSpeed
  • CCharacterOption::SetTarget
  • CCharacterRotate (multiple methods)
  • CCharacterRotate::SetTargetCharacter
  • CCharacterRotate::SetTargetCharacterDiffer(unsigned int,unsigned int,const CQuaternion*,unsigned int,float)
  • CCharacterRotate::SetTargetMapObject(const char*,const CVector*,const CQuaternion*,unsigned int,float)
  • CCharacterRotate::SetTargetPosture(const CVector&,const CQuaternion*,unsigned int,float)
  • CCharacterRotate::SetTargetVector(const CVector&,const CQuaternion*,unsigned int,float)
  • CQuaternion::Euler(const CVector&)
  • CRadiScript::GetAbstractionCharacterNumber(unsigned int&,unsigned int&,const SCR_DATA*)
  • CRadiScript::GetAbstractionStandPosNumber(unsigned int&,CVector&,CVector&,const SCR_DATA*)
  • CRadiScript::GetCharacterID(unsigned int&,unsigned int&,unsigned int*,SCR_DATA*,unsigned int)

Bit masks

Masks the handler applies to its argument byte or operand words:

0x0001 0x0003 0x0400 0x0200 0x1000 0x0800 0x0002 0xFFFF 0x000F 0x01C0