0x0A — change_game_mode
Calls CRadiScene::ChangeGameMode(int). If that succeeds it sets a run of config/event flags with CRadiApp::SetConfigEventFlag.
proven— handler traced, and exercised by at least one shipped script.
At a glance
| Opcode | 0x0A (10) |
|---|---|
| Handler | CRadiScript::Command_0a |
| Signature | CRadiScript::Command_0a(int,SCR_DATA*,unsigned int,unsigned int) |
| Translation unit | r_script_run0.cpp |
| Address | — debug build; click for all 3 |
| Handler size | 0xC4 (196 bytes) |
| Family | Script control, flags and values |
| Command size | 4 + extra_words * 4 bytes |
Documented forms
This opcode is documented under more than one name, one per branch of the handler. They are the same opcode and the same handler; which branch runs is chosen by the argument byte or a control word.
| Form | Engine name | What it does |
|---|---|---|
change_game_mode | — | Switches the game into another mode and sets a run of flags. |
change_game_mode_and_flags | — | Switches the game mode and then sets a run of config/event flags in the same line. No structured form yet, so it takes a raw payload. |
Handler behaviour
Calls CRadiScene::ChangeGameMode(int). If that succeeds it sets a run of config/event flags with CRadiApp::SetConfigEventFlag.
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 | 0x0A |
+----------------+----------------+----------------+----------------+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
3 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 |
|---|---|---|
arg | input | Raw 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. |
flags | input | Command header flag byte. Bit 0x80 is the keep-going bit: set (the hidden default), the next command runs in the same frame; clear (printed as yield=1), the script pauses until the next game update. Other bits are rare and stay as an explicit flags= byte. |
mode | input | Handler path selector taken from the argument byte. The meaning is specific to each command. |
Engine calls
Engine functions this handler was observed calling:
CRadiApp::SetConfigEventFlag(unsigned int,bool)CRadiScene::ChangeGameMode(int)
Bit masks
Masks the handler applies to its argument byte or operand words:
0x003F 0x0001