Skip to content

0x11 — scene_save_env

Scene environment save/restore helper. It creates CRadiSceneSaveEnv as needed and pushes or pops radi time enable, map animation, camera halt, ambient, light, character halt/disp, map disp, camera system, and window status.

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

At a glance

Opcode0x11 (17)
HandlerCRadiScript::Command_11
SignatureCRadiScript::Command_11(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run0.cpp
Address— debug build; click for all 3
Handler size0x32C (812 bytes)
Engine namescene_save_env
FamilyScript control, flags and values
Command size4 + extra_words * 4 bytes

Handler behaviour

Scene environment save/restore helper. It creates CRadiSceneSaveEnv as needed and pushes or pops radi time enable, map animation, camera halt, ambient, light, character halt/disp, map disp, camera system, and window status.

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

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
camera_halt_modederivedMode selector for camera halt; the handler branches on it.
character_dispderivedWhether character display state is in the saved set; unpacked from mask.
character_halt_arg0derivedArgument 0 passed to the engine call for character halt.
character_halt_arg1derivedArgument 1 passed to the engine call for character halt.
controlinputBitmask word choosing which optional payload words follow, in the order the handler tests them. Changing it changes how many words the command carries.
light_arg0derivedArgument 0 passed to the engine call for light.
light_arg1derivedArgument 1 passed to the engine call for light.
map_animation_modederivedMode selector for map animation; the handler branches on it.
map_dispderivedWhether map display state is in the saved set; unpacked from mask.
maskinputBitmask selecting which parts of the command apply.
mask_bitsderivedNames of the bits set in the matching packed value.
popderived0 pushes (saves) the selected scene state, 1 pops (restores) it.
radi_time_enablederivedWhether radi time is enabled.
window_status_modederivedMode selector for window status; 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:

  • CRadiSceneSaveEnv::CRadiSceneSaveEnv()
  • CRadiSceneSaveEnv::Pop*
  • CRadiSceneSaveEnv::PopCameraSystem(bool)
  • CRadiSceneSaveEnv::PopWindowStatus(bool)
  • CRadiSceneSaveEnv::Push*
  • CRadiSceneSaveEnv::PushAmbient()
  • CRadiSceneSaveEnv::PushCameraHalt(unsigned char,unsigned char)
  • CRadiSceneSaveEnv::PushCameraSystem()
  • CRadiSceneSaveEnv::PushCharacterDisp(unsigned int)
  • CRadiSceneSaveEnv::PushCharacterHalt(unsigned char,unsigned char)
  • CRadiSceneSaveEnv::PushLightGF(unsigned int,unsigned int)
  • CRadiSceneSaveEnv::PushMapAnimation(unsigned char,unsigned char)
  • CRadiSceneSaveEnv::PushMapDisp(unsigned int)
  • CRadiSceneSaveEnv::PushRadiTimeEnable(unsigned int)
  • CRadiSceneSaveEnv::PushWindowStatus(bool,bool)
  • operator new(unsigned int,int,const char*)

Bit masks

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

0x0003 0x00FF 0x0001 0x0002 0x0004 0x0008 0x0010 0x0020 0x0040 0x0080