Skip to content

Commit

Permalink
[SEGA NN] Improve NODENAMELIST docs
Browse files Browse the repository at this point in the history
Improves the ordering/phrasing/formatting of things.
  • Loading branch information
Radfordhound committed Jul 25, 2024
1 parent a219aa2 commit 0fbf335
Showing 1 changed file with 45 additions and 29 deletions.
74 changes: 45 additions & 29 deletions hedgedocs/docs/nn/common/chunk-format/nodenamelist.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
```

0 comments on commit 0fbf335

Please sign in to comment.