Skip to content

0x75 — play_sound_effect

Resolves sound-effect parameters and optionally character/SSF attachment data, then calls CRadiSound::PlaySe; also calls CRadiSound::GetSEBankFromChrNum and CSsfHandler::SearchName in traced branches.

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

At a glance

Opcode0x75 (117)
HandlerCRadiScript::Command_75
SignatureCRadiScript::Command_75(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run7.cpp
Address— debug build; click for all 3
Handler size0x520 (1312 bytes)
Engine nameplay_sound_effect
FamilyPrimitives, textures, sound and movies
Command size4 + extra_words * 4 bytes

Handler behaviour

Resolves sound-effect parameters and optionally character/SSF attachment data, then calls CRadiSound::PlaySe; also calls CRadiSound::GetSEBankFromChrNum and CSsfHandler::SearchName in traced branches.

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

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

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

FieldRoleMeaning
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.
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.
control_highinputUpper part of the matching packed value for control.
control_low_s16inputSigned low half of the control word, as the handler sign-extends it.
modeinputHandler path selector taken from the argument byte. The meaning is specific to each command.
paninputStereo position; 64 is centre and is what almost every line uses.
playse_arg5inputArgument 5 passed to the engine call for playse.
playse_stack0inputWord passed through to the PlaySe call unchanged; untraced beyond that.
se_flagsinputBoolean options for se, packed one per bit.
se_indexinputIndex selecting which se to act on.
sound_idinputIdentifier selecting which sound to use.
submodeinputSecondary path selector from the argument byte.
target_nameinputName operand for target.
volumeinputPlayback volume, 0-127. Shipped scripts overwhelmingly use 127.
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:

  • CCharacterManager::GetCharacterClass2(int,unsigned int,const CCharacter*,unsigned int)
  • CRadiScript::GetAbstractionCharacterNumber(unsigned int&,unsigned int&,const SCR_DATA*)
  • CRadiSound::GetSEBankFromChrNum(unsigned int,unsigned int) const
  • CRadiSound::PlaySe(int,unsigned int,unsigned int,CHierarchicalObject*,int,int,int,int)
  • CSsfHandler::SearchName(const char*) const

Bit masks

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

0xFFFF 0x0007 0x0003 0x001F 0x0001 0x00FF 0x007F 0x1FFF 0x000F