RDT (Resident Evil 1997)
(→Offset 8, Script events ?) |
(→Offset 8, Script events ?) |
||
Line 275: | Line 275: | ||
=== Offset 7 (*.SCD) - Execution script for room === | === Offset 7 (*.SCD) - Execution script for room === | ||
− | |||
− | |||
− | |||
− | |||
=== Offset 8, Script events ? === | === Offset 8, Script events ? === |
Revision as of 15:12, 25 August 2023
This content was first retrieved from the Internet Archive's Wayback Machine for the date 2017-11-25 from the following URL: https://web.archive.org/web/20171125230810/http://rewiki.regengedanken.de/wiki/.RDT_(Resident_Evil)
The .RDT file format is used to stored the description of a room in Resident Evil on Playstation or PC. 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...
Structure
The values are stored in Little-Endian order.
The file is always named roomSXX0.rdt
(or roomSXX1.rdt
). S
is the game status/stage. XX
is the location number.
Header
A RDT file starts with this header, to store count for different objects.
typedef struct { char unknown0; char num_cameras; /* Number of cameras of the room */ char num_sound_banks; /* Number of sound banks, stored at offset 18 ? */ char unknown1[3]; unsigned short unknown2[3]; /* An array of 3 elements of unknown structure */ rdt_header_part_t unknown3[3]; } rdt_header_t; <pre> typedef struct { long unknown_pos_x; /* Unknown 3D position */ long unknown_pos_y; long unknown_pos_z; unsigned long unknown0[2]; } rdt_header_part_t;
Object list
Following the header, we have an array of 19 absolute offsets to various objects in the file.
Offset | Purpose |
---|---|
0 | Camera switches (*.RVD) |
1 | Collision Boundaries for 3D Models (*.SCA) |
2 | TMD/TIM; points to 2 offsets which are: offset to a TMD file, and offset to a TIM file (used for item models) |
3 | TMD/TIM; points to 2 offsets which are: offset to a TMD file, and offset to a TIM file (used for obstacles & moveable objects) |
4 | Block data (*.BLK) |
5 | Footstep sound zones (*.FLR) |
6 | Initialization Script(s) (*.SCD) |
7 | Execution Script 0 (*.SCD) |
8 | Execution Script 1 (*.SCD) |
9 | Skeleton animation (*.EMR) |
10 | Skeleton animation steps (*.EDD) |
11 | Message text(s) (*.MSG) |
12 | RAW image (*.RAW), points to several RAW images used for example by Offset 2 for item images |
13 | Effect animation index (*.ESP) |
14 | Effect animation data (*.EFF); points to a list of relative offsets to read the EFF/ESP data (read backwards!) |
15 | Effect animation sprite image(s) (*.TIM); points to the last of those images used for effects |
16 | Sound attribute table (*.SND); points to a table which is 192 bytes in size |
17 | offset to a VAB header file (*.VH) |
18 | offset to VAB sound file (*.VB) |
Camera positions (*.RID)
At absolute offset 0x94 in a file, you'll find an array of 'num_cameras' items with this structure:
typedef struct { long masks_offset; /* Offset to image mask definition */ long tim_masks_offset; /* Offset to TIM file that contains image masks, if not zero */ long camera_from_x; /* Position of the camera */ long camera_from_y; long camera_from_z; long camera_to_x; /* Where the camera is looking to */ long camera_to_y; long camera_to_z; long unknown1[3]; } rdt_camera_t;
Camera masks (*.PRI)
The masks_offset is an offset to an extra structure, which has following header:
typedef struct { unsigned short count_offsets; /* Number of global offsets, or 0xffff for none */ unsigned short unknown; } rdt_masks_t;
Then you have 'rdt_mask_offset_t' items, which have a 8-byte length. Summing all 'count' fields should equal the 'count_masks' of the rdt_masks_t structure.
typedef struct { unsigned short count; /* Number of masks, with which to use this structure */ unsigned short unknown; unsigned short dst_x; /* Destination position on background image/screen, to be added */ unsigned short dst_y; } rdt_mask_offset_t;
And then you have 'rdt_[rect|square]_mask_t' items, which have either 12-byte (rectangular mask) or 8-byte length (square mask). The length is 12 if byte 7 (rdt_square_mask_t.size field) is zero, and 8 otherwise. The 'depth' value is the Z distance of the mask from the camera (low value=near, high value=far).
typedef struct { unsigned char src_x; /* Source position in horr/usa/objspr/ospSSRRC.pak image file */ unsigned char src_y; unsigned char dst_x; /* Destination position on background image/screen */ unsigned char dst_y; unsigned short depth; /* Distance/16 from camera */ unsigned char unknown; unsigned char size; /* Width and height of mask */ } rdt_square_mask_t;
typedef struct { unsigned char src_x; /* Source position in horr/usa/objspr/ospSSRRC.pak image file */ unsigned char src_y; unsigned char dst_x; /* Destination position on background image/screen */ unsigned char dst_y; unsigned short depth; /* Distance/16 from camera */ unsigned short zero; unsigned short width, height; /* Dimensions of mask */ } rdt_rect_mask_t;
Offset 0 (*.RVD) - Camera zones/switches
At offset 0, you'll find the list of camera switches for the current room. The list end with the first 4 bytes are 0xffffffff (i.e for cam0 and cam1 values).
typedef struct { unsigned short to; /* Camera number to switch to */ unsigned short from; /* Camera number to switch from */ short x1,y1; /* Zone the player must enter to switch camera */ short x2,y2; short x3,y3; short x4,y4; } rdt_camera_switch_t; If the 'to' value = 9, then it is a zone, defining the area in which the switches will work and 3D objects will be visible while this camera is used, else it is a camera switch. === Offset 1 (*.SCA) - Collision Boundaries for 3D Models === At offset 1, you'll find the boundary collision data for the current room. The first 24 bytes are the header which is using the following structure: <pre> typedef struct { unsigned short Cx; /* Ceiling x value */ unsigned short Cz; /* Ceiling z value */ unsigned long counts[5]; /* Number of objects = sum of these 5 long values */ } rdt_sca_header_t;
Followed by the header, the individual boundary entries start.
typedef struct { unsigned short x1; /* X of the top-left corner of the boundary plane/object */ unsigned short z1; /* Z of the top-left corner of the boundary plane/object */ unsigned short x2; /* X of the bottom-right corner of the boundary plane/object */ unsigned short z2; /* Z of the bottom-right corner of the boundary plane/object */ unsigned short type; /* type of the boundary plane/object (01=Standard; 03=Circle etc.) */ unsigned short floor; /* floor value/ 256 = floor value for use in the game as height definition */ } rdt_sca_obj_t;
After this the data block ends with a 4 byte unsigned long holding the total size of the SCA data block in bytes.
Offset 2 (*.TMD/*.TIM) - Item 3D model & texture pointers
This is an array of N structures of the following format, used by script instruction OM_SET (0x1f).
typedef struct { unsigned long tmd_offset; unsigned long tim_offset; } rdt_offset2_t;
Offset 3 (*.TMD/*.TIM) - Room 3D model & texture pointers
This is an array of N structures of the following format, used by script instruction OM_SET (0x1f).
typedef struct { unsigned long tmd_offset; unsigned long tim_offset; } rdt_offset3_t;
Offset 4 (*.BLK) - Block data
It's unknown what this data is used for. It defines plane based areas that look like "inversed" collision boundaries.
unsigned short int Amount; /* Amount of elements */ typedef struct { unsigned short x1; /* X of the top-left corner of the object */ unsigned short z1; /* Z of the top-left corner of the object */ unsigned short x2; /* X of the bottom-right corner of the object */ unsigned short z2; /* Z of the bottom-right corner of the object */ unsigned short int Dir_bit; unsigned short int Abut; } rdt_blk_obj_t; unsigned short int unknown; /* unknown; follows after last structure */ rdt_blk_obj_t Block[Amount];
Offset 5 (*.FLR) - Floor/footstep sound areas
This data defines the footstep sound areas and which sound to use. It is also related to the script opcode, 'Flr_set'.
unsigned short int Amount; /* Amount of elements */ typedef struct { signed short int x; /* x coordinate where the area is drawn from */ signed short int y; /* y coordinate where the area is drawn from */ signed short int x_width; /* x width of the area */ signed short int y_width; /* y width of the area */ unsigned short int sound; /* footstep ID sound to use */ } rdt_flr_obj_t; rdt_flr_obj_t Floor[Amount];
Offset 6 (*.SCD) - Scenario data
Offset 7 (*.SCD) - Execution script for room
Offset 8, Script events ?
This structure starts with a NULL terminated list of unsigned long, which are offsets relative to start of this object. These offsets store also some bytecodes, different than those above.
Byte | Instruction | Length | Description |
---|---|---|---|
0xf6
|
? | 1 | Init some stuff related to instruction 0xf7 |
0xf7
|
? | 1 | |
0xf8
|
? | 1 | Init some stuff related to instruction 0xf8 |
0xf9
|
? | 1 or 3 | |
0xfa
|
For | 4 | Initialize a for loop. typedef struct { unsigned char opcode; /* 0xfa */ unsigned char dummy; unsigned short count; } event_for_t; |
0xfb
|
Next | 1 | |
0xfc
|
Set_Inst | variable | Initialize bytecode instruction to execute later. typedef struct { unsigned char opcode; /* 0xfc */ unsigned char block_length; unsigned char bytecode_inst[]; } event_set_inst_t; |
0xfd
|
Exec_inst | 1 | Execute bytecode instruction previously set with 0xfc instruction. |
0xfe
|
Sleep, process next event | 1 | |
0xff
|
Disable event | 1 |
Offset 9 (*.EMR) - Skeleton animation
Offset 10 (*.EDD) - Skeleton animation steps
Offset 11 (*.MSG) - Text messages
First, you have an arrays of 'unsigned short', which are relative offsets to the beginning of this object. So the number of items is the first offset/2 (if we are lucky that the first offset always has the lowest value).
It contains the texts for cutscenes, dialogs, examining objects.
Conversion table, from byte to ASCII value:
0x00-0x0f: " .___()_____0123" 0x10-0x1f: "456789:_,"!?_ABC" 0x20-0x2f: "DEFGHIJKLMNOPQRS" 0x30-0x3f: "TUVWXYZ[/]'-_abc" 0x40-0x4f: "defghijklmnopqrs" 0x50-0x5f: "tuvwxyz_________" Note: not all characters have been found (i.e. the ones with '_'). Codes above 0x57 may also be different given the language, for characters with trema, accents and the like. There are also some formatting codes: 0x01: End of text 0x02: Carriage return 0x03: Pause 0x08: Yes/No question 0x74: "S." string 0x75: "T." string 0x76: "A." string 0x77: "R." string 0x79: ". " string