Skip to content

0x23 — character_animation

Resolves a character with GetCharacterID/GetCharacterClass2, then switches or sets character animation through CMotionSwitchData::SwitchMotionEzLasting, CMotionSwitchData::SwitchMotionDirect, or CCharacterAnim::SetSubAnimation.

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

At a glance

Opcode0x23 (35)
HandlerCRadiScript::Command_23
SignatureCRadiScript::Command_23(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run2.cpp
Address— debug build; click for all 3
Handler size0x38C (908 bytes)
Engine namecharacter_animation
FamilyCharacters
Command size4 + extra_words * 4 bytes

Handler behaviour

Resolves a character with GetCharacterID/GetCharacterClass2, then switches or sets character animation through CMotionSwitchData::SwitchMotionEzLasting, CMotionSwitchData::SwitchMotionDirect, or CCharacterAnim::SetSubAnimation.

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   |  0x23          |
+----------------+----------------+----------------+----------------+

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

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

FieldRoleMeaning
anim_float_ainputOptional animation float, present when speed0 is set.
anim_float_binputOptional animation float, present when speed1 is set.
anim_float_cinputOptional animation float, present when speed2 is set.
animationinputPacked animation word; its low half is animation_id and its high bits are kept in anim_high.
animation_groupinputAnimation group word passed to the motion-switch call.
animation_variantinputVariant selector within the chosen animation.
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.
extra_animationinputExtra animation word, present when has_extra_animation is set.
play_speedinputPlayback-speed value for the animation switch.
sub_anim_modeinputMode selector for sub anim; the handler branches on it.
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:

  • CCharacterAnim::SetSubAnimation(const CHR_SUBANIMDAT*)
  • CCharacterManager::GetCharacterClass2(int,unsigned int,const CCharacter*,unsigned int)
  • CMotionSwitchData::SwitchMotionDirect(const CHR_ANIMDAT*)
  • CMotionSwitchData::SwitchMotionEzLasting(unsigned char,float,unsigned char)
  • CRadiScript::GetAbstractionAnimationNumber(unsigned int&,unsigned int&,const SCR_DATA*)
  • CRadiScript::GetCharacterID(unsigned int&,unsigned int&,unsigned int*,SCR_DATA*,unsigned int)
  • memcpy
  • memset
  • strncpy

Bit masks

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

0x0002 0x00FF 0x0004 0x0008 0xFFFF 0x0001 0x0010 0x0020