From 0fbf335c9369d7a7cc5d247296afecce28429ea8 Mon Sep 17 00:00:00 2001 From: Graham Scott Date: Thu, 25 Jul 2024 01:14:01 -0500 Subject: [PATCH] [SEGA NN] Improve NODENAMELIST docs Improves the ordering/phrasing/formatting of things. --- .../nn/common/chunk-format/nodenamelist.md | 74 +++++++++++-------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/hedgedocs/docs/nn/common/chunk-format/nodenamelist.md b/hedgedocs/docs/nn/common/chunk-format/nodenamelist.md index 8ab0e313..b4079843 100644 --- a/hedgedocs/docs/nn/common/chunk-format/nodenamelist.md +++ b/hedgedocs/docs/nn/common/chunk-format/nodenamelist.md @@ -4,57 +4,73 @@ description: Sega NN NODENAMELIST Data Chunk Format Specification # NODENAMELIST +## NNE_NODENAME_SORTTYPE + +!!! note + The underlying type of this enum is not specified, thus it + may differ depending on the platform. In practice, it's always + an `int32_t` in all known NN games. + +This enum indicates the way the [NNS_NODENAME](#NNS_NODENAME) structs are sorted in the `pNodeNameList` array used in the [NNS_NODENAMELIST](#NNS_NODENAMELIST). + +```c +enum NNE_NODENAME_SORTTYPE +{ + // The NNS_NODENAME structs are sorted by their + // [iNode] index field, from least to greatest. + NNE_NODENAME_SORTTYPE_INDEX, + + // The NNS_NODENAME structs are sorted by their + // [Name] field, ordered as if by C's strcmp. + NNE_NODENAME_SORTTYPE_NAME +}; +``` + ## NNS_NODENAMELIST !!! important - This is the "main" (root) struct for all NN node (bone) name list chunks. + This is the root struct for all NODENAMELIST data chunks. + +A list of the names for the nodes (bones) that make up an object (model). ```c struct NNS_NODENAMELIST { - /* The sorting type */ + // The way the NNS_NODENAME structs in + // the [pNodeNameList] array are sorted. NNE_NODENAME_SORTTYPE SortType; - /* The size of [pNodeNameList] array */ - uint32_t nNode; + // The number of elements in the [pNodeNameList] array. + int32_t nNode; - /* An array of NNS_NODENAME structs */ + // An array of NNS_NODENAME structs. NNS_NODENAME* pNodeNameList; }; -/* Macros used by Text-Form files: */ -#define NODENAMELIST( SortType, nNode, pNodeNameList ) { SortType, nNode, pNodeNameList } +// Macros used by Text-Form files: +#define NODENAMELIST(SortType, nNode, pNodeNameList) { SortType, nNode, pNodeNameList } +#define NDNL_TYPE(SortType) (SortType) +#define NDNL_N_NODE(nNode) (nNode) +#define NDNL_NAMELIST(pNodeNameList) (pNodeNameList) ``` ## NNS_NODENAME -The actual node (bone) name +A name for a single node (bone). ```c struct NNS_NODENAME { - /* The node index */ - uint32_t iNode; + // The index of the node, in the [pNodeList] + // array in the corresponding NNS_OBJECT. + int32_t iNode; - /* The node name */ - char* Name; + // The name of the node. + const char* Name; }; -/* Macros used by Text-Form files: */ -#define NODENAME( iNode, Name ) { iNode, Name } +// Macros used by Text-Form files: +#define NODENAME(iNode, Name) { iNode, Name } +#define NDNM_IDX(iNode) (iNode) +#define NDNM_NAME(Name) (Name) ``` - -## NNE_NODENAME_SORTTYPE - -This enum indicates the sorting type used in the node name list. - -```c -enum NNE_NODENAME_SORTTYPE -{ - /* Sorting by index */ - NNE_NODENAME_SORTTYPE_INDEX, - - /* Sorting by name */ - NNE_NODENAME_SORTTYPE_NAME -}; -``` \ No newline at end of file