0x16 — battle_acquisition_setup
Battle/acquisition setup command. It initializes a global command buffer, writes battle-result/drop fields, and calls CBtlAcquisition::AddDroppedItem.
proven— handler traced, and exercised by at least one shipped script.
At a glance
| Opcode | 0x16 (22) |
|---|---|
| Handler | CRadiScript::Command_16 |
| Signature | CRadiScript::Command_16(int,SCR_DATA*,unsigned int,unsigned int) |
| Translation unit | r_script_run0.cpp |
| Address | — debug build; click for all 3 |
| Handler size | 0x348 (840 bytes) |
| Engine name | battle_acquisition_setup |
| Family | Script control, flags and values |
| Command size | 4 + extra_words * 4 bytes |
Handler behaviour
Battle/acquisition setup command. It initializes a global command buffer, writes battle-result/drop fields, and calls CBtlAcquisition::AddDroppedItem.
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 | 0x16 |
+----------------+----------------+----------------+----------------+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.
| Field | Role | Meaning |
|---|---|---|
battle_bgm | input | Music the battle plays. |
battle_event_file | input | Event file the battle loads. Command_16 writes it to app+0x84C, where CGame's battle path passes it to CRadiScript::LoadScriptFile; a non-zero value also makes CBackGround::SettingMap skip the map's own init script. |
battle_event_script | input | Script number inside battle_event_file to run. Written to app+0x84E and passed to CRadiScript::SetScriptNumber as the script selector, which stashes it in the new slot while the file is still loading. Together the two name one script the way the files do: file 500 script 3 is 500_03. |
battle_map | input | Map the battle loads. |
battle_script | input | Event script the battle runs, loaded as id | 0x8000. |
finish_check1 | input | Battle-end condition preset checked by CBtlFinishCheck. |
finish_check2 | input | Second battle-end condition preset. |
finish_check3 | input | Third battle-end condition preset. |
finish_param1 | input | Operand for finish_check1; its meaning depends on the preset. |
finish_param2 | input | Operand for finish_check2. |
finish_param3 | input | Operand for finish_check3. |
option_bit0 | input | Single bit of option. |
option_bit1 | input | Single bit of option. |
unused_2824 | input | Written to the global at 0x3B2824 and never read: a scan of every module finds exactly one access to that address, this handler's store. Preserved verbatim. |
unused_2826 | input | Written to the global at 0x3B2826 and never read: a scan of every module finds exactly one access to that address, this handler's store. Preserved verbatim. |
Engine calls
Engine functions this handler was observed calling:
CBtlAcquisition::AddDroppedItem(unsigned short,int,unsigned short)CCharaPutManager::GetLifeFlagCCharacterManager::GetCharacterSubManager(int)memset
Bit masks
Masks the handler applies to its argument byte or operand words:
0x00FF 0x0001 0x0002 0x7FFF 0x8000