-
Notifications
You must be signed in to change notification settings - Fork 1
Object Prototypes
Prototypes (templates) for objects are stored in rules\protos.tab in a tab-separated format. Each line is a prototype, with it's properties separated by a tab character.
The prototypes are read line-by-line and converted into the internal object format of ToEE. So the templates for objects are themselves represented as objects by ToEE.
Prototype lines are handled by the function @ 0x1003B640, which has the following signature:
void __cdecl protos_tab_parse_line(int, int lineNo, const char **columns);
The first argument is unknown. The last argument points to an array of strings that contain the values for each column in the prototype definition. This function also creates the internal ToEE object based on the type of object the prototype represents. The object type is determined by the prototype number (first column). Fixed ranges of prototype ids are assigned an object type. The mapping is determined by the function @ 0x10039220.
To apply the values found in protos.tab to the internal object, ToEE uses an array @ 0x102AD570, which contains 333 entries (equivalent to the number of columns in protos.tab) of the following structure:
typedef void (__cdecl *ProtoParseColumn)(int colIndex, uint64_t protoId, const char *value,
int unk1, int unk2, int unk3, int unk4);
struct ProtoColumnSpec {
// If this field is a flag bit-field, this points to the list of names used for the flags
const char **flagTable;
int field4; // Unknown
int field8; // Unknown
ProtoParseColumn parse; // Value handler
int field10; // Unknown
int field11; // Unknown
};
ToEE calls each columns's parse function (if it is set) and passes it the current column index (starting at 0), the id of the internal prototype object (ObjHandle), the value of the column, and 4 values from the proto spec itself (order yet unknown).