Common file format types

From Arx Libertatis Wiki
Jump to navigation Jump to search

This page describes types common to various Arx Fatalis file formats.

Numbers

All integers are encoded in little-endian byte order. Types are the same as in platform/Platform.h - s (signed integer) / u (unsigned integer) / f (float), followed by the number of bits.

Example: u32 is an unsigned 32-bit integer.

Arrays

Arrays are denoted by brackets like in c++.

Example: u32[64] is an array of 64 unsigned 32-bit integers.

C Strings

Types described as c string are variably sized strings that are terminated with a null-byte.

The original Arx Fatalis code did not define an encoding for most strings and presumably only allowed ASCII characters. Unless noted otherwise, Arx Libertatis interprets c strings as UTF-8.

Fixed-length strings

Fixed length strings use the array syntax with the component type char. All unused bytes of fixed length strings should be set to zero but readers should ignore all bytes after the first null byte.

Unless noted otherwise, Arx Libertatis interprets fixed length strings as UTF-8.

Example: char[128] is a fixed length string of (max) 128 bytes.

Interactive Object IDs

Interactive objects are any kind of dynamic object in Arx Fatalis. Interactive objects have a class name and an instance number, both encoded into their id by padding the instance number to for digits with leading zeros and prepending the class name and a seperating underscore.

Example: spider_base_0011 is the ID for the eleventh instance of the spider base class.

There are also some special IDs:

  • "player": the player character
  • "none" or empty string: no object
  • "self" or "me": the same interactive object as where the ID is specified

As these IDs are very common, their semantics are abbreviated with the type object id which is stored as char[64].

Color

rgb32f:

Type Description
f32 Red
f32 Green
f32 Blue