Table of Contents
RDT
Script is contained in the second (index 1)
section of the RDT file.
The section starts with the following header,
struct RdtScriptHeader {
u32 doorMeshes;
u32 objMeshes;
u32 _unused0;
u32 _unused1;
u32 objMotionTable;
u32 _unused2;
u32 _unused3;
u32 _unused4;
u32 playerPages[4];
u32 aipcPages[4];
};
where:
doorMeshes
is a section-relative offset to a byte array,
where each byte is a stage door mesh index. First byte is a mesh ID for
door ID 0, second byte is a mesh ID for door ID 1, and so on.
objMeshes
is the same thing as doorMeshes
, except it points to
a byte array for stage object mesh indices, not doors. This mesh list
is used for referencing specific objects in the script and triggers.
objMotionTable
is a section-relative offset to a table
of offsets to animation data that can be applied to a stage
object from the script (opcode 0x0093
).
playerPages
is an array of section-relative offsets to script pages that are
executed by the client player.
aipcPages
is an array of section-relative offsets to script pages that are
executed by AIPC.
PROBABLY IMPORTANT NOTE: In a lot of places in code, the original game expects
that the stage door mesh byte array and the stage object byte array are continuous
in memory, and use the doorMeshes
offset to access the stage object mesh list as
if it was a static structure:
struct RdtDoorObjMeshes {
u8 doors[32];
u8 objs[32];
};
(for more information about the overall RDT structure, see "RDT Format".)
EVB
At the top of the EVB file,
struct EvbHeader {
u32 playerPages[4];
u32 aipcPages[4];
// ...
};
where
playerPages
is an array of file-relative offsets to script pages that are
executed by the client player.
aipcPages
is an array of file-relative offsets to script pages that are
executed by AIPC.
(for more information about EVB, see "EVB Format")
Page
Each script page is a collection of opcodes. When the file with the script
is loaded, the game will set its start execution address to the very
first opcode of the first page. The script then can modify the start
address during gameplay in various ways.
Opcode
Each opcode is a collection of one or more 32-bit values.
The first value contains both the opcode ID and an encoded
size of the whole opcode:
31 24 0
+------+-------------------+
| size | opcode ID |
+------+-------------------+
First 24 bits of the value are the opcode ID, and the last remaining
8 bits are the encoded size.
Total size of a single opcode is 4 * 2^n
bytes, where n is the encoded size.
Example
Opcode starting with 0x02001234
(bytes 34 12 00 02
) has
the opcode ID of 0x1234
and the total size of 16 bytes.
Here's a small match table for total opcode sizes:
Last 8 bits |
Total size |
00 |
4 bytes |
01 |
8 bytes |
02 |
16 bytes |
03 |
32 bytes |
04 |
64 bytes |
Available Opcodes
[0x0001] Set Start Address
[0x0002] Jump To Start Address
[0x0003] Jump To Relative Address
[0x0004] Sleep
[0x0005] If RANDOM
[0x0007] Next Page
[0x0008] If UNMASKED GLOBAL FLAG
[0x000A] Finish, Go to Start.
[0x000B] Set Flag
[0x000C] Set Flag Mask
[0x000D] Finish, Go to Next Page.
[0x0010] Enable Camera Set
[0x0011] Disable Camera Set
[0x0012] Enable All Camera Sets
[0x0013] Enforce Camera Set
[0x0014] If CAMERA SET FORCED
[0x0015] Disable Enforced Camera Set
[0x0016] Unknown Camera Task
[0x0017] If CURRENT CAMERA SET
[0x0018] Unknown Camera Task
[0x0020] Set Lighting Package
[0x0023] Enable Light
[0x0024] Disable Light
[0x0025] Enable All Lights
[0x0030] Activate Item
[0x0031] Deactivate Item
[0x0032] Activate Item Model Only
[0x0033] Activate Item Pickup Trigger Only
[0x0034] If TABLE ITEM PICKED UP
[0x0035] Delete Owned Item Type
[0x0036] If OWNED ITEM TYPE COUNT
[0x0037] Set Item Flicker
[0x0038] Give Item Type To Player
[0x0039] Give Item Type To Character Type
[0x003A] Give Item Type To NPC
[0x003B] Equip Item Type To Player
[0x003C] Equip Item Type To Character Type
[0x003D] Equip Item Type To NPC
[0x003E] Set Item Pickup Player ID Condition
[0x003F] Set Item Pickup Character Type Condition
[0x0040] Lock Door Local
[0x0041] Unlock Door Local
[0x0042] Lock Door Global
[0x0043] Unlock Door Global
[0x0044] Mark Text File As Read
[0x0045] Set Timer
[0x0046] Start Handshake
[0x0047] If HANDSHAKE APPROVED
[0x0048] If HANDSHAKE DECLINED
[0x0049] If TEXT FILE WAS READ
[0x004A] Set Flag When Opening a Door.
[0x004B] Set Flag When Going Through a Portal.
[0x004C] Give Map
[0x004D] If HAS MAP
[0x004E] Set Door Occupation Flag
[0x0050] Set Door Key Item Type
[0x0051] Set Portal Unknown Value
[0x0052] Set Global Event Trigger
[0x0053] Disable Global Event Trigger
[0x0054] Set Global Door Key Item
[0x0055] Set Text Trigger
[0x0056] Disable Text Trigger
[0x0057] Set Text With Camera Trigger
[0x0058] Set Local Event Trigger
[0x0059] Disable Local Event Trigger
[0x005A] Set Room State/Variant
[0x005B] Enable Portal Trigger
[0x005C] Disable Portal Trigger
[0x005D] Enable Door Trigger
[0x005E] Disable Door Trigger
[0x005F] Set Door Locked Message
[0x0060] Finish Scenario
[0x0061] Game Over
[0x0062] Queue Demo
[0x0063] Set Player Controls
[0x0064] Set All Players' Model Quality
[0x0065] Set Unknown Event Value
[0x0067] Reset Player Spawn
[0x0068] Set Character Type Spawn Point
[0x0069] Teleport Player
[0x006A] Reset All Player Spawns
[0x006B] Set Unknown Game Variable
[0x006C] Teleport Player With Interaction
[0x0070] Play BGM
[0x0071] Stop BGM
[0x0072] Set Sound Trigger
[0x0073] Play Sound
[0x0074] Start Anchored Sound
[0x0075] Fade Out BGM
[0x0076] Fade In BGM
[0x007E] Enable Walk Sound Area
[0x007F] Disable Walk Sound Area
[0x0080] Unknown NPC Opcode
[0x0081] Unknown NPC Opcode
[0x0082] Unknown NPC Opcode
[0x0083] Unknown NPC Opcode
[0x0084] Unknown NPC Opcode
[0x0085] Unknown NPC Opcode
[0x0086] Unknown NPC Opcode
[0x0087] Unknown NPC Opcode
[0x0088] Unknown NPC Opcode
[0x0089] Unknown NPC Opcode
[0x008A] Unknown NPC Opcode
[0x008B] Unknown NPC Opcode
[0x008C] Unknown NPC Opcode
[0x008D] Unknown NPC Opcode
[0x008E] Unknown NPC Opcode
[0x0090] Fade Stage Color
[0x0091] Set Stage Color
[0x0093] Animate Stage Object
[0x0094] Start Scenario Specific Animation Task
[0x0095] Set Breakable Object
[0x00A0] Enable Stage Effect
[0x00A1] Disable Stage Effect
[0x00A2] Enable All Stage Effects
[0x00A3] Disable All Stage Effects
[0x00A4] Enable Effect Flag
[0x00A5] Disable Effect Flag
[0x00A6] r001 Specific Effect
[0x00A7] r001 Specific Effect
[0x00A8] Start Player Water Effects
[0x00A9] Spawn Unknown Effect
[0x00B0] Show Stage Object
[0x00B1] Hide Stage Object
[0x00B2] Show Stage Door
[0x00B3] Hide Stage Door
[0x00B4] Move Stage Object
[0x00B5] Set Door To Always Opened
[0x00B7] If DOOR IS DISABLED
[0x00B8] If DOOR IS LOCKED
[0x00C0] Enable Pushable Object
[0x00C1] Disable Pushable Object
[0x00C2] If PUSHABLE ON MARKER
[0x00C3] If PUSHABLE NOT ON MARKER
[0x00C4] Set Pushable Position
[0x00C5] Disallow Pushing Pushable
[0x00C6] Allow Pushing Pushable
[0x00C7] Set Unknown Pushable Flag
[0x00C8] Disallow Climbing Pushable
[0x00C9] Allow Climbing Pushable
[0x00D0] Start Scenario Script Task
[0x00D1] Start Common Script Task
[0x00E3] If UNMASKED LOCAL FLAG
[0x00E4] Else
[0x00E5] End If
[0x00E6] If GLOBAL MASK FLAG
[0x00E7] Set Flag When All Players Inside Trigger
[0x00E8] Set Player Timer
[0x00E9] If PLAYER TIMER
[0x00EA] If CHARACTER TYPE EXISTS
[0x00EB] If PLAYER INTERACTING WITH ENEMY
[0x00EC] If (MASKED) GLOBAL FLAG
[0x00ED] If (MASKED) LOCAL FLAG
[0x00EE] If DIFFICULTY
[0x00EF] If LOCAL MASK FLAG
[0x00F0] Enable Wall Group Collision
[0x00F1] Disable Wall Group Collision
[0x00F2] Set Object Health
[0x00F3] Set Door Lockpick Match
[0x00F4] Enable Door Unbreakable Flag
[0x00F5] Disalbe Door Unbreakable Flag
[0x00F6] Set Stage Object Lockpick Match
[0x00F7] Set Unknown Stage Model Value
[0x00F8] Set Global Door Lockpick Match
[0x0100] Start Player Interaction
[0x0101] Enable Matching Triggers
[0x0103] Set Player Model Quality
[0x0104] Enable Specific Trigger
[0x0105] Disable Specific Trigger
[0x0106] Set Player Warp Orientation
[0x0107] Set Item Event Message
[0x0109] Start Player Interaction With Parameter
[0x010A] Set Unknown Game Flag
[0x010B] Block Virus Freeze
[0x0110] Set Variable
[0x0111] Add To Variable
[0x0112] Subtract From Variable
[0x0113] If VARIABLE
[0x0114] Clear All Variables
[0x0115] Clear Players' Total Kill Count
[0x0116] Copy Players' Total Kill Count To Variable
[0x0117] Reset Item Type Usage Count
[0x0118] Set Item Type To Track Usage Of
[0x0120] Enable Adlib Flag
[0x0121] Disable Adlib Flag
[0x0122] Set Adlib Program
[0x0123] If ADLIB FLAG
[0x0130] Set Text Trigger With Personal Message
[0x0131] Set Text File Trigger
[0x0132] Show Message
[0x0133] Draw Timer (unused)
[0x0134] Set Text Sequence Trigger
[0x0135] Set SP Item Text Trigger
[0x0136] Set Single Use Text Trigger
[0x0140] Set Room Motion Bank
[0x0150] If PLAYER IS IN ROOM
[0x0151] If ALL PLAYERS ARE IN ROOM
[0x0152] If ALL PLAYERS ARE ACTIVE
[0x0153] If PLAYER COUNT
[0x0155] If PLAYER CHARACTER TYPE
[0x0156] If PLAYER CONFIG
[0x0157] Enable Marker Trigger
[0x0158] If TRUE
[0x0159] If CLIENT PLAYER IS A ZOMBIE
[0x015A] If NPC IS IN ROOM
[0x0160] Unknown Enemy Opcode
[0x0163] Unknown Enemy Opcode
[0x0164] Unknown Enemy Opcode
[0x0165] Unknown Enemy Opcode
[0x0166] Unknown Enemy Opcode
[0x0167] Unknown Enemy Opcode
[0x0168] Unknown Enemy Opcode
[0x016A] Unknown Enemy Opcode
[0x0170] Set Owned Item Type Amount
[0x0171] Set Item Flicker Hold
[0x0172] Set Local Flag If Player Has Item Type
[0x0173] Add Item Type To Cindy's Herbcase
[0x0174] Activate Item Pickup Delayed
[0x0178] If ITEM TYPE IS IN ROOM
[0x0179] Delete Item Type From Player's Inventory
[0x0180] If MULTIPLAYER
Last updated on 2024-10-18.