Burnout Wiki:Format documentation specification: Difference between revisions

Finish enumerations section.
(Created page. Enums and bit fields are still TODO.)
 
(Finish enumerations section.)
Line 21:
|}
 
== Columns ==
==== Offset ====
The offset of the field within the structure. This should always be hexadecimal and prefixed with <code>0x</code>.
Line 67 ⟶ 68:
|}
 
== Columns ==
==== Name ====
The name of the typedef.
Line 79 ⟶ 81:
 
= Enumerations =
While best suited to fields explicitly typed as <code>enum</code>, this may be used when it is not known whether a field is an enumerated type or not but clearly has a constant set of values. Similarly, it may be used when a field clearly uses a constant set of values despite being typed as an integer in official documentation.
 
Enumerations should only be linked to from a structure's Type column if it is explicitly typed as an <code>enum</code>. Otherwise, it should be linked to from the Comments column in the style "See <nowiki>[[link]]</nowiki>".
 
== Traditional enumerations ==
Most enumerations are sets of sequential values from which a single value may be used per variable. It follows that such enumerations are typically in decimal format, and wiki content should reflect this. Sometimes, however, it is appropriate to use hexadecimal, such as with how [[Resource Types (Burnout Paradise) | resource type IDs]] are split up along hexadecimal boundaries. These are the only situations in which mixed base formatting should be used.
TODO
 
Enumerations should be displayed in the following format:
{| class="wikitable"
|-
! Name !! Value !! Comments
|-
| EXAMPLE_ENUM_ZERO || 0 || An example with the value 0.
|-
| EXAMPLE_ENUM_ONE || 1 || An example with the value 1.
|-
| EXAMPLE_ENUM_FORCE_INT || 0x7FFFFFFF || Forces the enum to compile to a 32-bit int
|}
 
== Binary flags ==
Flags allow multiple options to be selected in a single enumeration by way of making each bit a flag. Because of this, there are multiple ways to specify their values, such as <code>bit 2</code>, <code>1 << 2</code>, <code>0b00000100</code>, and <code>0x4</code>. All of these are valid (though the first option is ambiguous), but to maintain consistency and readability across the wiki, hexadecimal should be used.
TODO
 
Binary flags should be displayed in the following format:
{| class="wikitable"
|-
! Name !! Value !! Comments
|-
| EXAMPLE_FLAG_IS_DAMAGEABLE || 0x1 || The vehicle can be damaged.
|-
| EXAMPLE_FLAG_CAN_BOOST || 0x2 || The vehicle can boost.
|-
| EXAMPLE_FLAG_HAS_REAR_LIGHTS || 0x4 || Taillights are attached to the vehicle.
|-
| EXAMPLE_FLAG_HAS_FRONT_LIGHTS || 0x8 || Headlights are attached to the vehicle.
|}
 
== Columns ==
==== Name ====
The name of the enumerated value. This must be from official documentation. If no official documentation is available, use a question mark.
 
==== Value ====
The value referenced by the name given in the enumeration. This must be a valid value and can never be unknown or blank.
 
==== Comments ====
Any description or additional comments related to the enumerated values may be provided here.
 
If there are no additional comments, this column may be left blank. A question mark should never be used.
 
= Bit fields =