-
Notifications
You must be signed in to change notification settings - Fork 9
.RDT (Resident Evil 3)
The .RDT file format is used to stored the description of a room in Resident Evil 3. It should contain the camera position (to correctly display 3D objects), the background images and sprites used to draw the scene, description of when to change camera, position of enemies when entering room, and so on...
The structure is the same as the one for Resident Evil 2 .RDT. However there are some differences, listed below.
The header is 16 bytes.
typedef struct { unsigned long Amount; unsigned long unknown0[3]; } rdt_offset6_t;
Immediately following is an array of elements which contain attributes for each collision. Subtract 1 from Amount for the real total.
typedef struct { signed short int X1; signed short int Z1; signed short int X2; signed short int Z2; unsigned short unknown[4]; } rdt_offset6elt_t;
rdt_offset6elt_t Collision[Amount-1];
This is the initialization script for the room. It starts with an array of unsigned short, giving offset to each function of the script. Thus, the first offset listed / 2 gives you the number of functions in the script. Then follows the script, in bytecode-style.
Byte | Instruction | Length | Description |
---|---|---|---|
0x00 | Nop | 1 | |
0x01 | Return | 2 | Exit current function |
0x02 | Sleep 1 | 1 | Sleep for 1 game tick. |
0x03 | EVT_CHAIN | 2 | |
0x04 | EVT_EXEC | 4 |
Execute an instruction when a precise event occurs.
typedef struct { unsigned char opcode; /* 0x04 */ unsigned char event; unsigned short instruction; /* Most likely a function call, 0x19xx */ } script_evt_exec_t; |
0x05 | EVT_KILL | 2 |
typedef struct { unsigned char opcode; /* 0x05 */ unsigned char event; } script_evt_kill_t; |
0x06 | If | 4 |
typedef struct { unsigned char opcode; /* 0x06 */ unsigned char dummy; unsigned short block_length; } script_if_t;This structure is followed by one or several conditions for the if (condition) instruction. Any condition evaluated to false will end the if () block. |
0x07 | Else | 4 |
typedef struct { unsigned char opcode; /* 0x07 */ unsigned char dummy; unsigned short block_length; } script_else_t;Note: it's either If/Endif, or If/Else; there is no If/Else/Endif sequence. |
0x08 | EndIf | 2 | |
0x09 | Sleep | 1 | |
0x0a | Sleeping | 3 |
Sleep for N game ticks
typedef struct { unsigned char opcode; /* 0x0a */ unsigned char ticks; /* Number of game ticks to sleep */ unsigned char unknown; } script_sleep_t; |
0x0b | SleepW | 1 | |
0x0c | SleepingW | 1 | |
0x0d | For | 6 |
typedef struct { unsigned char opcode; /* 0x0d */ unsigned char dummy; unsigned short block_length; unsigned short count; /* Number of times to execute the loop */ } script_for_t; |
0x0e | ? | 5 | |
0x0f | EndFor | 2 |
Byte | Instruction | Length | Description |
---|---|---|---|
0x10 | While | 4 |
typedef struct { unsigned char opcode; /* 0x10 */ unsigned char dummy; unsigned short block_length; } script_while_t;This structure is followed by one or several conditions for the while (condition) instruction. Any condition evaluated to false will end the while () block. |
0x11 | EndWhile | 2 | |
0x12 | Do | 4 |
typedef struct { unsigned char opcode; /* 0x12 */ unsigned char dummy; unsigned short block_length; } script_do_t; |
0x13 | EndDo | 2 | This structure is followed by one or several conditions for the do { } while (condition) instruction. Any condition evaluated to false will end the while () block. |
0x14 | Switch | 4 |
typedef struct { unsigned char opcode; /* 0x14 */ unsigned char unknown0; unsigned char unknown1; unsigned char dummy; } script_switch_t; |
0x15 | Case | 2 |
typedef struct { unsigned char opcode; /* 0x15 */ unsigned char dummy; } script_case_t;This structure is followed by the condition to evaluate (See instruction 0x4c or 0x4e for example). |
0x16 | Default | 2 | |
0x17 | EndSwitch | 2 | |
0x18 | Goto | 6 | |
0x19 | Call | 2 |
typedef struct { unsigned char opcode; /* 0x19 */ unsigned char func_number; /* Function number of the script to call */ } script_call_t; |
0x1a | Return | 4 | |
0x1b | Break | 2 | |
0x1c | Breakpoint | 1 | |
0x1d | EVAL_CC | 4 | |
0x1e | Set | 4 |
typedef struct { unsigned char opcode; /* 0x1e */ unsigned char object; unsigned short value; } script_set1e_t; |
0x1f | Set | 4 |
Byte | Instruction | Length | Description |
---|---|---|---|
0x20 | CALC_OP | 6 |
Math operation on accumulator
typedef struct { unsigned char opcode; /* 0x20 */ unsigned char dummy; unsigned char op; /* 0x00: ADD, 0x01: SUB, 0x04: MODULO, 0x05: OR, 0x06: AND, 0x07: XOR */ unsigned char accum_id; short value; } script_calc_op_t; |
0x21 | ? | 4 | |
0x22 | EVT_CUT | 4 | |
0x23 | ? | 1 | |
0x24 | CHASER_EVT_CLR | 2 | |
0x25 | MAP_OPEN | 4 | |
0x26 | POINT_ADD | 6 | |
0x27 | DOOR_CK | 1 | |
0x28 | DIEDEMO_ON | 1 | |
0x29 | DIR_CK | 8 | |
0x2a | PARTS_SET | 6 | |
0x2b | VLOOP_SET | 2 | |
0x2c | OTA_BE_SET | 4 | |
0x2d | LINE_BEGIN | 4 | |
0x2e | LINE_MAIN | 6 | |
0x2f | LINE_END | 2 |
Byte | Instruction | Length | Description |
---|---|---|---|
0x30 | LIGHT_POS_SET | 6 | |
0x31 | LIGHT_KIDO_SET | 6 | |
0x32 | LIGHT_COLOR_SET | 6 | |
0x33 | AHEAD_ROOM_SET | 4 |
typedef struct { unsigned char opcode; /* 0x33 */ unsigned char dummy; unsigned short value; } script_ahead_room_set_t; |
0x34 | ESPR_CTR | 10 | |
0x35 | EVAL_BGM_TBL_CK | 6 | |
0x36 | ITEM_GET_CK | 3 | |
0x37 | OM_REV | 2 | |
0x38 | CHASER_LIFE_INIT | 2 | |
0x39 | PARTS_BOMB | 16 | |
0x3a | PARTS_DOWN | 16 | |
0x3b | CHASER_ITEM_SET | 3 | |
0x3c | WEAPON_CHG_OLD | 1 | |
0x3d | SEL_EVT_ON | 2 | |
0x3e | ITEM_LOST | 2 | |
0x3f | FLOOR_SET | 3 |
typedef struct { unsigned char opcode; /* 0x3f */ unsigned char id; /* Number of floor */ unsigned char value; /* 0x00: off, 0x01: on */ } script_floor_set_t; |
Byte | Instruction | Length | Description |
---|---|---|---|
0x40 | MEMB_SET | 4 | |
0x41 | MEMB_SET2 | 3 |
Save accumulator in variable
typedef struct { unsigned char opcode; /* 0x41 */ unsigned char num_variable; unsigned char accum_id; } script_calc_save_t; |
0x42 | MEMB_CPY | 3 |
Load variable value into an accumulator
typedef struct { unsigned char opcode; /* 0x42 */ unsigned char accum_id; unsigned char num_variable; } script_calc_load_t; |
0x43 | MEMB_CMP | 6 | |
0x44 | MEMB_CALC | 6 | |
0x45 | MEMB_CALC2 | 4 | |
0x46 | FADE_SET | 11 |
typedef struct { unsigned char opcode; /* 0x46 */ unsigned char unknown[10]; } script_fade_set_t; |
0x47 | WORK_SET | 3 |
typedef struct { unsigned char opcode; /* 0x47 */ unsigned char unknown; unsigned char object; } script_work_set_t; |
0x48 | SPD_SET | 4 | |
0x49 | ADD_SPD | 1 | |
0x4a | ADD_ASPD | 1 | |
0x4b | ADD_VSPD | 1 | |
0x4c | EVAL_CK | 4 |
Check flag
typedef struct { unsigned char opcode; /* 0x4c */ unsigned char flag; /* Flag to check */ unsigned char object; /* Object in which to check flag */ unsigned char value; /* 0x00: off, 0x01: on */ } script_condition_ck_t; |
0x4d | SET | 4 |
typedef struct { unsigned char opcode; /* 0x4d */ unsigned char flag; /* Flag */ unsigned char object; /* Object */ unsigned char value; /* 0x00: off, 0x01: on */ } script_set_t; |
0x4e | EVAL_CMP | 6 |
Evaluate a comparison.
typedef struct { unsigned char opcode; /* 0x4e */ unsigned char dummy; unsigned char variable; /* Variable to compare */ unsigned char func; /* Comparison function */ /* 0x00: EQ, 0x02: GE, 0x05: NE */ unsigned short value; /* Value to compare */ } script_condition_cmp_t; |
0x4f | RND | 1 |
Byte | Instruction | Length | Description |
---|---|---|---|
0x50 | CUT_CHG | 2 |
In a cutscene, change camera angle.
typedef struct { unsigned char opcode; /* 0x50 */ unsigned char camera; /* New camera angle to use */ } script_cut_chg_t; |
0x51 | CUT_OLD | 1 | |
0x52 | CUT_AUTO | 2 | |
0x53 | CUT_REPLACE | 3 | |
0x54 | CUT_BE_SET | 4 | |
0x55 | POS_SET | 8 |
typedef struct { unsigned char opcode; /* 0x55 */ unsigned char dummy; short x,y,z; /* Position */ } script_pos_set_t; |
0x56 | DIR_SET | 8 |
typedef struct { unsigned char opcode; /* 0x56 */ unsigned char dummy; short x,y,z; /* Direction */ } script_dir_set_t; |
0x57 | SET_VIB0 | 6 | |
0x58 | SET_VIB1 | 6 | |
0x59 | SET_VIB_FADE | 8 | |
0x5a | RBJ_SET | 2 | |
0x5b | MESSAGE_ON | 6 |
typedef struct { unsigned char opcode; /* 0x5b */ unsigned char id; /* Message id */ unsigned short unknown[2]; } script_message_on_t; |
0x5c | RAIN_SET | 2 | |
0x5d | MESSAGE_OFF | 1 | |
0x5e | SHAKE_ON | 3 | |
0x5f | WEAPON_CHG | 2 |
Byte | Instruction | Length | Description |
---|---|---|---|
0x60 | ? | 22 | |
0x61 | DOOR_SET | 32 | |
0x62 | DOOR_AOT_SET_4P | 40 | |
0x63 | AOT_SET | 20 |
Message ?
typedef struct { unsigned char opcode; /* 0x63 */ unsigned char event_type; unsigned char event_flag; unsigned char unknown0[3]; short x,y,w,h; short unknown1[3]; /* unknown1[1] can be result of calling a function */ } script_aot_set_t; |
0x64 | AOT_SET_4P | 28 | |
0x65 | AOT_RESET | 10 |
typedef struct { unsigned char opcode; /* 0x65 */ unsigned char event_type; unsigned char event_flag; unsigned char unknown[7]; } script_aot_reset_t; |
0x66 | AOT_ON | 2 | |
0x67 | ITEM_AOT_SET | 22 | |
0x68 | ITEM_AOT_SET_4P | 30 | |
0x69 | KAGE_SET | 14 | |
0x6a | SUPER_SET | 16 |
typedef struct { unsigned char opcode; /* 0x6a */ unsigned char unknown[15]; } script_super_set_t; |
0x6b | KEEP_ITEM_CK | 2 | |
0x6c | KEY_CK | 4 | |
0x6d | TRG_CK | 4 | |
0x6e | SCA_ID_SET | 4 | |
0x6f | OM_BOMB | 2 |
Byte | Instruction | Length | Description |
---|---|---|---|
0x70 | ESPR_ON | 16 |
typedef struct { unsigned char opcode; /* 0x70 */ unsigned char unknown0[5]; short unknown1[5]; } script_espr_on_t; |
0x71 | ESPR_ON2 | 18 | |
0x72 | ESPR3D_ON | 22 | |
0x73 | ESPR3D_ON2 | 24 |
typedef struct { unsigned char opcode; /* 0x73 */ unsigned char unknown[23]; } script_espr3d_on2_t; |
0x74 | ESPR_KILL | 5 | |
0x75 | ESPR_KILL2 | 2 |
typedef struct { unsigned char opcode; /* 0x75 */ unsigned char unknown; } script_espr_kill2_t; |
0x76 | ESPR_KILL_ALL | 3 | |
0x77 | SE_ON | 12 |
typedef struct { unsigned char opcode; /* 0x77 */ unsigned char sound_type; unsigned char unknown[10]; } script_se_on_t; |
0x78 | BGM_CTL | 6 |
typedef struct { unsigned char opcode; /* 0x78 */ unsigned char unknown[5]; } script_bgm_ctl_t; |
0x79 | XA_ON | 4 | |
0x7a | MOVIE_ON | 2 | |
0x7b | BGM_TBL_SET | 6 | |
0x7c | STATUS_ON | 1 | |
0x7d | EM_SET | 24 |
Entity model (enemy, other character)
typedef struct { unsigned char opcode; /* 0x7d */ unsigned char unknown0[11]; short x,y,z, dir; unsigned short unknown1[2]; } script_em_set_t; |
0x7e | MIZU_DIV | 2 | |
0x7f | OM_SET | 40 |
Object model (pickable item)
typedef struct { unsigned char opcode; /* 0x7f */ unsigned char unknown[39]; } script_om_set_t; |
Byte | Instruction | Length | Description |
---|---|---|---|
0x80 | PLC_MOTION | 4 | |
0x81 | PLC_DEST | 8 |
typedef struct { unsigned char opcode; /* 0x81 */ unsigned char dummy; unsigned char unknown0[2]; unsigned short unknown1[2]; } script_plc_dest_t; |
0x82 | PLC_NECK | 10 |
typedef struct { unsigned char opcode; /* 0x82 */ unsigned char unknown0; unsigned short unknown1[3]; unsigned char unknown2[2]; } script_plc_neck_t; |
0x83 | PLC_RET | 1 | |
0x84 | PLC_FLG | 4 | |
0x85 | PLC_GUN | 2 | |
0x86 | PLC_GUN_EFF | 1 | |
0x87 | PLC_STOP | 1 | |
0x88 | PLC_ROT | 4 | |
0x89 | PLC_CNT | 2 |
typedef struct { unsigned char opcode; /* 0x89 */ unsigned char unknown0; } script_plc_cnt_t; |
0x8a | SPLC_RET | 1 | |
0x8b | SPLC_SCE | 1 | |
0x8c | PLC_SCE | 1 | |
0x8d | SPL_WEAPON_CHG | 1 | |
0x8e | PLC_MOT_NUM | 4 | |
0x8f | EM_RESET | 2 |
This script is run regularly to update stuff in current room. It follows same structure as the one at offset 16.