Skip to content

0x79 — sound_listener

Sound listener placement helper. It can set listener point by character, map object, camera, direct vector/quaternion, or call CSoundManager::SetListener.

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

At a glance

Opcode0x79 (121)
HandlerCRadiScript::Command_79
SignatureCRadiScript::Command_79(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run7.cpp
Address— debug build; click for all 3
Handler size0x234 (564 bytes)
Engine namesound_listener
FamilyPrimitives, textures, sound and movies
Command size4 + extra_words * 4 bytes

Handler behaviour

Sound listener placement helper. It can set listener point by character, map object, camera, direct vector/quaternion, or call CSoundManager::SetListener.

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

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

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

FieldRoleMeaning
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.
character_typeinputByte 2 of the character selector, where the handler treats it as a type selector rather than a variant.
manager_listenerinputWhether CSoundManager::SetListener is called (listener-control bit).
modeinputHandler path selector taken from the argument byte. The meaning is specific to each command.
positioninputListener position operand.
positive_distanceinputDistance-sign control bit from the argument byte.
raw_byte3inputByte 3 of the packed raw entry.
tailinputRemaining operand words for this line, kept in order.
target_sourceinputWhere target is read from.
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:

  • CRadiScript::GetAbstractionCharacterNumber(unsigned int&,unsigned int&,const SCR_DATA*)
  • CRadiSound::SetListenerPoint (multiple variants)
  • CRadiSound::SetListenerPointByCamera(float)
  • CRadiSound::SetListenerPointByCharaObject(unsigned int,unsigned int,const char*,float)
  • CRadiSound::SetListenerPointByMapObject(const char*,float)
  • CRadiSound::SetListenerPointDirect(CVector&,CQuaternion&,float)
  • CSoundManager::SetListener(CHierarchicalObject*,float,float)

Bit masks

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

0x0007 0xFFFF 0x00FF 0x0003 0x0040 0x0020