mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Autogen documentation for vec types (#609)
This commit is contained in:
parent
adcd730d5d
commit
85b51fd02a
3 changed files with 117 additions and 12 deletions
|
|
@ -144,9 +144,13 @@ override_allowed_structs = {
|
||||||
sLuaManuallyDefinedStructs = [{
|
sLuaManuallyDefinedStructs = [{
|
||||||
'path': 'n/a',
|
'path': 'n/a',
|
||||||
'structs': [
|
'structs': [
|
||||||
'struct Vec3f { float x; float y; float z; }',
|
'struct %s { %s }' % (
|
||||||
'struct Vec3s { s16 x; s16 y; s16 z; }',
|
type_name,
|
||||||
'struct Color { u8 r; u8 g; u8 b; }'
|
' '.join([
|
||||||
|
'%s %s;' % (vec_type['field_c_type'], lua_field)
|
||||||
|
for lua_field in vec_type['fields_mapping'].keys()
|
||||||
|
])
|
||||||
|
) for type_name, vec_type in VEC_TYPES.items()
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
@ -254,7 +258,7 @@ def table_to_string(table):
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
def parse_struct(struct_str):
|
def parse_struct(struct_str, sortFields = True):
|
||||||
struct = {}
|
struct = {}
|
||||||
identifier = struct_str.split(' ')[1]
|
identifier = struct_str.split(' ')[1]
|
||||||
struct['identifier'] = identifier
|
struct['identifier'] = identifier
|
||||||
|
|
@ -291,15 +295,16 @@ def parse_struct(struct_str):
|
||||||
if identifier == 'Object':
|
if identifier == 'Object':
|
||||||
struct['fields'] += extract_object_fields()
|
struct['fields'] += extract_object_fields()
|
||||||
|
|
||||||
|
if sortFields:
|
||||||
struct['fields'] = sorted(struct['fields'], key=lambda d: d['identifier'])
|
struct['fields'] = sorted(struct['fields'], key=lambda d: d['identifier'])
|
||||||
|
|
||||||
return struct
|
return struct
|
||||||
|
|
||||||
def parse_structs(extracted):
|
def parse_structs(extracted, sortFields = True):
|
||||||
structs = []
|
structs = []
|
||||||
for e in extracted:
|
for e in extracted:
|
||||||
for struct in e['structs']:
|
for struct in e['structs']:
|
||||||
parsed = parse_struct(struct)
|
parsed = parse_struct(struct, sortFields)
|
||||||
if e['path'] in override_allowed_structs:
|
if e['path'] in override_allowed_structs:
|
||||||
if parsed['identifier'] not in override_allowed_structs[e['path']]:
|
if parsed['identifier'] not in override_allowed_structs[e['path']]:
|
||||||
continue
|
continue
|
||||||
|
|
@ -647,7 +652,7 @@ def doc_struct(struct):
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def doc_structs(structs):
|
def doc_structs(structs):
|
||||||
structs.extend(parse_structs(sLuaManuallyDefinedStructs))
|
structs.extend(parse_structs(sLuaManuallyDefinedStructs, False)) # Don't sort fields for vec types in the documentation
|
||||||
structs = sorted(structs, key=lambda d: d['identifier'])
|
structs = sorted(structs, key=lambda d: d['identifier'])
|
||||||
|
|
||||||
s = '## [:rewind: Lua Reference](lua.md)\n\n'
|
s = '## [:rewind: Lua Reference](lua.md)\n\n'
|
||||||
|
|
|
||||||
|
|
@ -2344,20 +2344,54 @@
|
||||||
--- @field public unk00 integer
|
--- @field public unk00 integer
|
||||||
--- @field public unk02 integer
|
--- @field public unk02 integer
|
||||||
|
|
||||||
|
--- @class Vec2f
|
||||||
|
--- @field public x number
|
||||||
|
--- @field public y number
|
||||||
|
|
||||||
--- @class Vec3f
|
--- @class Vec3f
|
||||||
--- @field public x number
|
--- @field public x number
|
||||||
--- @field public y number
|
--- @field public y number
|
||||||
--- @field public z number
|
--- @field public z number
|
||||||
|
|
||||||
|
--- @class Vec4f
|
||||||
|
--- @field public x number
|
||||||
|
--- @field public y number
|
||||||
|
--- @field public z number
|
||||||
|
--- @field public w number
|
||||||
|
|
||||||
--- @class Vec3s
|
--- @class Vec3s
|
||||||
--- @field public x integer
|
--- @field public x integer
|
||||||
--- @field public y integer
|
--- @field public y integer
|
||||||
--- @field public z integer
|
--- @field public z integer
|
||||||
|
|
||||||
|
--- @class Vec4s
|
||||||
|
--- @field public x integer
|
||||||
|
--- @field public y integer
|
||||||
|
--- @field public z integer
|
||||||
|
--- @field public w integer
|
||||||
|
|
||||||
|
--- @class Mat4
|
||||||
|
--- @field public m00 number
|
||||||
|
--- @field public m01 number
|
||||||
|
--- @field public m02 number
|
||||||
|
--- @field public m03 number
|
||||||
|
--- @field public m10 number
|
||||||
|
--- @field public m11 number
|
||||||
|
--- @field public m12 number
|
||||||
|
--- @field public m13 number
|
||||||
|
--- @field public m20 number
|
||||||
|
--- @field public m21 number
|
||||||
|
--- @field public m22 number
|
||||||
|
--- @field public m23 number
|
||||||
|
--- @field public m30 number
|
||||||
|
--- @field public m31 number
|
||||||
|
--- @field public m32 number
|
||||||
|
--- @field public m33 number
|
||||||
|
|
||||||
--- @class Color
|
--- @class Color
|
||||||
--- @field public b integer
|
|
||||||
--- @field public g integer
|
|
||||||
--- @field public r integer
|
--- @field public r integer
|
||||||
|
--- @field public g integer
|
||||||
|
--- @field public b integer
|
||||||
|
|
||||||
--- @class Pointer_integer
|
--- @class Pointer_integer
|
||||||
--- @class Pointer_Trajectory
|
--- @class Pointer_Trajectory
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@
|
||||||
- [MarioAnimation](#MarioAnimation)
|
- [MarioAnimation](#MarioAnimation)
|
||||||
- [MarioBodyState](#MarioBodyState)
|
- [MarioBodyState](#MarioBodyState)
|
||||||
- [MarioState](#MarioState)
|
- [MarioState](#MarioState)
|
||||||
|
- [Mat4](#Mat4)
|
||||||
- [Mod](#Mod)
|
- [Mod](#Mod)
|
||||||
- [ModAudio](#ModAudio)
|
- [ModAudio](#ModAudio)
|
||||||
- [ModAudioSampleCopies](#ModAudioSampleCopies)
|
- [ModAudioSampleCopies](#ModAudioSampleCopies)
|
||||||
|
|
@ -103,8 +104,11 @@
|
||||||
- [TransitionInfo](#TransitionInfo)
|
- [TransitionInfo](#TransitionInfo)
|
||||||
- [UnusedArea28](#UnusedArea28)
|
- [UnusedArea28](#UnusedArea28)
|
||||||
- [VblankHandler](#VblankHandler)
|
- [VblankHandler](#VblankHandler)
|
||||||
|
- [Vec2f](#Vec2f)
|
||||||
- [Vec3f](#Vec3f)
|
- [Vec3f](#Vec3f)
|
||||||
- [Vec3s](#Vec3s)
|
- [Vec3s](#Vec3s)
|
||||||
|
- [Vec4f](#Vec4f)
|
||||||
|
- [Vec4s](#Vec4s)
|
||||||
- [WallCollisionData](#WallCollisionData)
|
- [WallCollisionData](#WallCollisionData)
|
||||||
- [WarpNode](#WarpNode)
|
- [WarpNode](#WarpNode)
|
||||||
- [WarpTransition](#WarpTransition)
|
- [WarpTransition](#WarpTransition)
|
||||||
|
|
@ -759,9 +763,9 @@
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
| ----- | ---- | ------ |
|
| ----- | ---- | ------ |
|
||||||
| b | `integer` | |
|
|
||||||
| g | `integer` | |
|
|
||||||
| r | `integer` | |
|
| r | `integer` | |
|
||||||
|
| g | `integer` | |
|
||||||
|
| b | `integer` | |
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
|
@ -1793,6 +1797,31 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [Mat4](#Mat4)
|
||||||
|
|
||||||
|
| Field | Type | Access |
|
||||||
|
| ----- | ---- | ------ |
|
||||||
|
| m00 | `number` | |
|
||||||
|
| m01 | `number` | |
|
||||||
|
| m02 | `number` | |
|
||||||
|
| m03 | `number` | |
|
||||||
|
| m10 | `number` | |
|
||||||
|
| m11 | `number` | |
|
||||||
|
| m12 | `number` | |
|
||||||
|
| m13 | `number` | |
|
||||||
|
| m20 | `number` | |
|
||||||
|
| m21 | `number` | |
|
||||||
|
| m22 | `number` | |
|
||||||
|
| m23 | `number` | |
|
||||||
|
| m30 | `number` | |
|
||||||
|
| m31 | `number` | |
|
||||||
|
| m32 | `number` | |
|
||||||
|
| m33 | `number` | |
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [Mod](#Mod)
|
## [Mod](#Mod)
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
|
|
@ -3088,6 +3117,17 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [Vec2f](#Vec2f)
|
||||||
|
|
||||||
|
| Field | Type | Access |
|
||||||
|
| ----- | ---- | ------ |
|
||||||
|
| x | `number` | |
|
||||||
|
| y | `number` | |
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [Vec3f](#Vec3f)
|
## [Vec3f](#Vec3f)
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
|
|
@ -3112,6 +3152,32 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [Vec4f](#Vec4f)
|
||||||
|
|
||||||
|
| Field | Type | Access |
|
||||||
|
| ----- | ---- | ------ |
|
||||||
|
| x | `number` | |
|
||||||
|
| y | `number` | |
|
||||||
|
| z | `number` | |
|
||||||
|
| w | `number` | |
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [Vec4s](#Vec4s)
|
||||||
|
|
||||||
|
| Field | Type | Access |
|
||||||
|
| ----- | ---- | ------ |
|
||||||
|
| x | `integer` | |
|
||||||
|
| y | `integer` | |
|
||||||
|
| z | `integer` | |
|
||||||
|
| w | `integer` | |
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [WallCollisionData](#WallCollisionData)
|
## [WallCollisionData](#WallCollisionData)
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue