Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Macros | Functions | Variables
dynlist_proc.c File Reference

Functions for parsing and processing Goddard's DynList object format. More...

#include <ultra64.h>
#include <macros.h>
#include <config.h>
#include "gd_types.h"
#include "bad_declarations.h"
#include "prevent_bss_reordering.h"
#include "gd_main.h"
#include "draw_objects.h"
#include "objects.h"
#include "particles.h"
#include "dynlist_proc.h"
#include "old_menu.h"
#include "debug_utils.h"
#include "joints.h"
#include "skin.h"
#include "gd_math.h"
#include "shape_helper.h"
#include "renderer.h"

Data Structures

struct  DynObjInfo
 Information about a dynamically created GdObj More...
 

Macros

#define DYNOBJ_NAME_SIZE   8
 Size of the dynamic object name buffer. More...
 
#define DYNOBJ_LIST_SIZE   3000
 Total number of dynamic GdObjs that can be created. More...
 
#define VTX_BUF_SIZE   3000
 Maximum number of verticies supported when adding vertices node to an ObjShape More...
 
DynList Accessors

Accessor marcos for easy interpretation of data in a DynList packet

#define Dyn1AsInt(dyn)   ((dyn)->w1.word)
 
#define Dyn1AsPtr(dyn)   ((dyn)->w1.ptr)
 
#define Dyn1AsStr(dyn)   ((dyn)->w1.str)
 
#define Dyn1AsID(dyn)   ((DynId)((dyn)->w1.ptr))
 
#define Dyn2AsInt(dyn)   ((dyn)->w2.word)
 
#define Dyn2AsPtr(dyn)   ((dyn)->w2.ptr)
 
#define Dyn2AsStr(dyn)   ((dyn)->w2.str)
 
#define Dyn2AsID(dyn)   ((DynId)((dyn)->w2.ptr))
 
#define DynVec(dyn)   (&(dyn)->vec)
 
#define DynVecX(dyn)   ((dyn)->vec.x)
 
#define DynVecY(dyn)   ((dyn)->vec.y)
 
#define DynVecZ(dyn)   ((dyn)->vec.z)
 

Functions

void d_add_net_with_subgroup (s32, DynId)
 
void d_end_net_subgroup (DynId id)
 End the ObjNet+ObjGroup set created by d_add_net_with_subgroup(). More...
 
void d_attach_joint_to_net (s32, DynId)
 
void d_addto_group (DynId id)
 Add the current dynamic object to the dynamic ObjGroup id. More...
 
void d_link_with (DynId id)
 Link the dynamic object id to the current dynamic object by wrapping d_link_with_ptr(). More...
 
void d_link_with_ptr (void *ptr)
 Link a variable pointer to the current active dynamic object. More...
 
void d_set_normal (f32 x, f32 y, f32 z)
 Set the normal of the current dynamic ObjVertex. More...
 
void d_make_vertex (struct GdVec3f *pos)
 Create a new dynamic ObjVertex at point pos. More...
 
void d_set_rotation (f32 x, f32 y, f32 z)
 Set the rotation value of the current active dynamic object. More...
 
void d_center_of_gravity (f32 x, f32 y, f32 z)
 Set the center of gravity of the current dynamic ObjNet. More...
 
void d_set_shape_offset (f32 x, f32 y, f32 z)
 Set the shape offset of the current dynamic ObjJoint. More...
 
void d_clear_flags (s32 flags)
 Clear object specific flags from the current dynamic object. More...
 
void d_attach (DynId id)
 Attach dynamic object id to the current active ObjJoint object. More...
 
void d_attach_to (s32 flag, struct GdObj *obj)
 Attach the current dynamic GdObj into the proper subgroup of obj and set the "attach flags" of the current dynamic object to flag More...
 
void d_attachto_dynid (s32 flag, DynId id)
 Attach the current dynamic object to dynamic object id. More...
 
void d_set_att_offset (const struct GdVec3f *off)
 Set the offset of the attached object on the current dynamic object. More...
 
void d_set_nodegroup (DynId id)
 Set the "node group" of the current dynamic object to dynamic object id. More...
 
void d_set_matgroup (DynId id)
 Set the material group of the current dynamic ObjShape to id. More...
 
void d_set_skinshape (DynId id)
 Set the current dynamic ObjNet's skin group with the vertex group from the dynamic ObjShape with id. More...
 
void d_set_planegroup (DynId id)
 In practice, this is used to set the faces of the current active dynamic ObjShape to the dynamic group id of ObjFaces. More...
 
void d_set_shapeptr (DynId id)
 Set the shape pointer of the current active dynamic object to dynamic ObjShape id. More...
 
void d_friction (f32 x, f32 y, f32 z)
 Set the friction vec of the current dynamic ObjJoint. More...
 
void d_set_spring (f32 spring)
 Set the spring constant of the current dynamic ObjBone. More...
 
void d_set_ambient (f32 r, f32 g, f32 b)
 Set the ambient color of the current dynamic ObjMaterial. More...
 
void d_set_control_type (s32 ctrltype)
 Set the control type of the current dynamic ObjNet. More...
 
void d_set_skin_weight (s32 id, f32 percentWeight)
 Create a new weight for the current dynamic ObjJoint. More...
 
void d_set_id (s32 id)
 Set the specific object ID field for the current dynamic object. More...
 
void d_set_material (void *, s32)
 
void d_map_materials (DynId id)
 Map the material ids for the ObjFaces in the current dynamic ObjGroup to pointer to ObjMaterials in the ObjGroup id. More...
 
void d_map_vertices (DynId id)
 Map the vertex ids for the ObjFaces in the current dynamic ObjGroup to pointer to ObjVertex in the ObjGroup id. More...
 
void d_set_texture_st (f32, f32)
 
void d_use_texture (void *texture)
 Set the texture pointer of the current dynamic ObjMaterial. More...
 
void d_make_netfromshapeid (DynId id)
 Create a new ObjNet linked with the dynamic ObjShape id. More...
 
void d_make_netfromshape_ptrptr (struct ObjShape **shapePtr)
 Create a new ObjNet linked with the doubly indirected ObjShape. More...
 
void add_to_dynobj_list (struct GdObj *newobj, DynId id)
 Add newobj identified by id to the dynamic GdObj list. More...
 
void push_dynobj_stash (void)
 Store the active dynamic GdObj into a one object stash. More...
 
void pop_dynobj_stash (void)
 Set the stashed GdObj as the active dynamic GdObj. More...
 
void reset_dynlist (void)
 Reset dynlist related variables to a starting state. More...
 
struct GdObjproc_dynlist (struct DynList *dylist)
 Parse a DynList array into active GdObjs. More...
 
void d_copystr_to_idbuf (char *str)
 Copy input str into a buffer that will be concatenated to a dynamic GdObj's name string when creating a new dynamic object. More...
 
void d_catstr_to_idbuf (char *str)
 Concatenate input str into a buffer that will be concatenated to a dynamic GdObj's name string when creating a new dynamic object. More...
 
void cpy_idbuf_to_backbuf (void)
 Stash the current string that is appended to a created dynamic GdObj name. More...
 
void cpy_backbuf_to_idbuf (void)
 Pop the stash for the string that is appended to a created dynamic GdObj name. More...
 
struct DynObjInfoget_dynobj_info (DynId id)
 Get the DynObjInfo struct for object id More...
 
void reset_dynamic_objs (void)
 Reset the number of created dynamic objects and free the dynamic object information list (sGdDynObjList). More...
 
void d_add_net_with_subgroup (UNUSED s32 a0, DynId id)
 Create an ObjNet and an associated node ObjGroup. More...
 
void d_attach_joint_to_net (UNUSED s32 arg0, DynId id)
 Create an ObjJoint and add that to the ObjNet created by d_add_net_with_subgroup(). More...
 
charprint_int_dynid (DynId id)
 Format id into string, if DynIds are currently being interpreted as numbers. More...
 
struct GdObjd_makeobj (enum DObjTypes type, DynId id)
 Create a new GdObj of type and add that object to the dynamic object list with id. More...
 
void copy_bytes (u8 *src, u8 *dst, s32 num)
 Helper function to copy bytes. More...
 
void alloc_animdata (struct ObjAnimator *animator)
 Allocate the animation data for animator onto the goddard heap. More...
 
void chk_shapegen (struct ObjShape *shape)
 Generate or create the various ObjVertex, ObjFace, and/or ObjMaterial when groups of those structures are attached to shape. More...
 
void d_set_texture_st (UNUSED f32 s, UNUSED f32 t)
 At one time in the past, this set the s and t value of the current dynamic ObjVertex. More...
 
void d_set_shapeptrptr (struct ObjShape **shpPtrptr)
 Set the shape pointer of the current active dynamic object to the pointer pointed to by shpPtrptr. More...
 
struct GdObjd_use_obj (DynId id)
 Set the current active dynamic object to object id. More...
 
void set_cur_dynobj (struct GdObj *obj)
 Set the current active dynamic object to obj. More...
 
void d_start_group (DynId id)
 Start a dynamic ObjGroup identified with id. More...
 
void d_end_group (DynId id)
 Add all dynamic objects created between the start of dynamic ObjGroup id and this call. More...
 
void dynid_is_int (s32 isIntBool)
 Set if DynId should be treated as integer values, or as char * string pointers. More...
 
void d_set_init_pos (f32 x, f32 y, f32 z)
 Set the initial position of the current dynamic object to (x, y, z). More...
 
void d_set_velocity (const struct GdVec3f *vel)
 Set the velocity of the current active dynamic object. More...
 
void d_get_velocity (struct GdVec3f *dst)
 Read the velocity value of the current dynamic object into dst More...
 
void d_set_torque (const struct GdVec3f *src)
 Set the torque vectore for the current dynamic object. More...
 
void d_get_init_pos (struct GdVec3f *dst)
 Get the initial position of the current dynamic object and store in dst. More...
 
void d_get_init_rot (struct GdVec3f *dst)
 Get the initial rotation of the current dynamic object and store in dst. More...
 
void d_set_rel_pos (f32 x, f32 y, f32 z)
 Set the position of the current dynamic object. More...
 
void d_addto_rel_pos (struct GdVec3f *src)
 Offset the current position of the current dynamic object. More...
 
void d_get_rel_pos (struct GdVec3f *dst)
 Store the current dynamic object's position into dst. More...
 
struct ObjGroupd_get_att_objgroup (void)
 Return a pointer to the attached object group of the current dynamic object. More...
 
struct GdObjd_get_att_to_obj (void)
 Return a pointer to the attached object of the current dynamic object. More...
 
void d_get_scale (struct GdVec3f *dst)
 Store the current dynamic object's scale into dst. More...
 
void d_set_att_to_offset (UNUSED u32 a)
 An incorrectly-coded recursive function that was presumably supposed to set the offset of an attached object. More...
 
void d_get_att_offset (struct GdVec3f *dst)
 Store the offset of the attached object into dst. More...
 
s32 d_get_att_flags (void)
 Get the attached object flags for the current dynamic object. More...
 
void d_set_world_pos (f32 x, f32 y, f32 z)
 Set the world position of the current dynamic object. More...
 
struct GdVec3fd_get_world_pos_ptr (void)
 Get a pointer to the world position vector of the active dynamic object. More...
 
void d_get_world_pos (struct GdVec3f *dst)
 Copy the world position of the current dynamic object into dst. More...
 
void d_set_scale (f32 x, f32 y, f32 z)
 Scale the current dynamic object by factor (x, y, z). More...
 
void d_add_valptr (DynId objId, u32 vflags, s32 type, u32 offset)
 Create a new ObjValPtr to dynamic object objId and attach that valptr to the current dynamic object. More...
 
void d_add_valproc (valptrproc_t proc)
 Add a value processing function (valptrproc_t) to the current dynamic ObjLabel. More...
 
void d_set_flags (s32 flags)
 Set the object specific flags of the current dynamic object. More...
 
void d_set_parm_f (enum DParmF param, f32 val)
 Set variable float parameters on the current dynamic object. More...
 
void d_set_parm_ptr (enum DParmPtr param, void *ptr)
 Set various pointer parameters for the current dynamic object. More...
 
void d_set_obj_draw_flag (enum ObjDrawingFlags flag)
 Set the generic drawing flags for the current dynamic object. More...
 
void d_set_type (s32 type)
 Set an object specific type field for the current dynamic object. More...
 
void d_set_colour_num (s32 colornum)
 Set the colour of the current dynamic object. More...
 
void d_set_material (UNUSED void *a0, s32 mtlId)
 Set the material ID of the current dynamic ObjFace. More...
 
void d_set_diffuse (f32 r, f32 g, f32 b)
 Set the diffuse color of the current dynamic ObjMaterial or ObjLight. More...
 
struct GdPlaneFd_get_plane (void)
 Get a pointer to a GdPlaneF in the current dynamic object. More...
 
void d_get_matrix (Mat4f *dst)
 Copy the matrix from the current dynamic object into dst. More...
 
void d_set_matrix (Mat4f *src)
 Set the matrix of the current dynamic object by copying src into the object. More...
 
void d_set_rot_mtx (Mat4f *src)
 Set the rotation matrix of the current dynamic object by copying the input matrix src. More...
 
Mat4fd_get_rot_mtx_ptr (void)
 Get a pointer to the current dynamic object's rotation matrix. More...
 
void d_set_idn_mtx (Mat4f *src)
 Copy src into the identity matrix of the current dynamic object. More...
 
Mat4fd_get_matrix_ptr (void)
 Get a pointer to the current dynamic object's matrix. More...
 
Mat4fd_get_idn_mtx_ptr (void)
 Get a pointer to the current dynamic object's identity matrix. More...
 
f32 d_calc_world_dist_btwn (struct GdObj *obj1, struct GdObj *obj2)
 Use the dynamic object system to calculate the distance between two GdObjs. More...
 

Variables

static struct DynObjInfosGdDynObjList = NULL
 
static struct GdObjsDynListCurObj = NULL
 
static struct GdPlaneF sGdNullPlaneF
 
static s32 sGdDynObjIdIsInt = FALSE
 
static char sIntDynIdBuffer [DYNOBJ_NAME_SIZE]
 buffer for returning formated string from print_int_dynid() More...
 
static struct DynObjInfo sNullDynObjInfo
 
static char sDynIdBuf [DYNOBJ_NAME_SIZE]
 
static s32 sUnnamedObjCount
 
static s32 sLoadedDynObjs
 
static struct DynObjInfosDynListCurInfo
 
static struct DynObjInfosParentNetInfo
 Information for ObjNet made by d_add_net_with_subgroup() More...
 
static struct DynObjInfosStashedDynObjInfo
 
static struct GdObjsStashedDynObj
 
static s32 sDynNetCount
 
static char sDynNetIdBuf [0x20]
 
static char sBackBuf [0x100]
 

Detailed Description

Functions for parsing and processing Goddard's DynList object format.

It also has utility functions for abstracting at runtime over the various flavors of GdObjs.

Macro Definition Documentation

◆ Dyn1AsID

#define Dyn1AsID (   dyn)    ((DynId)((dyn)->w1.ptr))

◆ Dyn1AsInt

#define Dyn1AsInt (   dyn)    ((dyn)->w1.word)

◆ Dyn1AsPtr

#define Dyn1AsPtr (   dyn)    ((dyn)->w1.ptr)

◆ Dyn1AsStr

#define Dyn1AsStr (   dyn)    ((dyn)->w1.str)

◆ Dyn2AsID

#define Dyn2AsID (   dyn)    ((DynId)((dyn)->w2.ptr))

◆ Dyn2AsInt

#define Dyn2AsInt (   dyn)    ((dyn)->w2.word)

◆ Dyn2AsPtr

#define Dyn2AsPtr (   dyn)    ((dyn)->w2.ptr)

◆ Dyn2AsStr

#define Dyn2AsStr (   dyn)    ((dyn)->w2.str)

◆ DYNOBJ_LIST_SIZE

#define DYNOBJ_LIST_SIZE   3000

Total number of dynamic GdObjs that can be created.

◆ DYNOBJ_NAME_SIZE

#define DYNOBJ_NAME_SIZE   8

Size of the dynamic object name buffer.

◆ DynVec

#define DynVec (   dyn)    (&(dyn)->vec)

◆ DynVecX

#define DynVecX (   dyn)    ((dyn)->vec.x)

◆ DynVecY

#define DynVecY (   dyn)    ((dyn)->vec.y)

◆ DynVecZ

#define DynVecZ (   dyn)    ((dyn)->vec.z)

◆ VTX_BUF_SIZE

#define VTX_BUF_SIZE   3000

Maximum number of verticies supported when adding vertices node to an ObjShape

Function Documentation

◆ add_to_dynobj_list()

void add_to_dynobj_list ( struct GdObj newobj,
DynId  id 
)

Add newobj identified by id to the dynamic GdObj list.

Once a GdObj is in the dynamic list, it can referred to by its id when that object is needed later.

◆ alloc_animdata()

void alloc_animdata ( struct ObjAnimator animator)

Allocate the animation data for animator onto the goddard heap.

Animation data of type GD_ANIM_9H is converted to a AnimMtxVec struct, rather than solely byted copied like the other types.

◆ chk_shapegen()

void chk_shapegen ( struct ObjShape shape)

Generate or create the various ObjVertex, ObjFace, and/or ObjMaterial when groups of those structures are attached to shape.

This function is called when d_set_nodegroup(), d_set_planegroup(), or d_set_matgroup() are called when an ObjShape is the active dynamic object.

Note
Face/vertices need to be set before materials
Bug:
Call to make_face_with_colour() compiles incorrectly due to Goddard only declaring the functions, not prototyping the functions

◆ copy_bytes()

void copy_bytes ( u8 src,
u8 dst,
s32  num 
)

Helper function to copy bytes.

Where's memcpy when you need it?

◆ cpy_backbuf_to_idbuf()

void cpy_backbuf_to_idbuf ( void  )

Pop the stash for the string that is appended to a created dynamic GdObj name.

◆ cpy_idbuf_to_backbuf()

void cpy_idbuf_to_backbuf ( void  )

Stash the current string that is appended to a created dynamic GdObj name.

◆ d_add_net_with_subgroup() [1/2]

void d_add_net_with_subgroup ( s32  ,
DynId   
)

◆ d_add_net_with_subgroup() [2/2]

void d_add_net_with_subgroup ( UNUSED s32  a0,
DynId  id 
)

Create an ObjNet and an associated node ObjGroup.

This function creates its own naming string to append to later created dynamic objects.

◆ d_add_valproc()

void d_add_valproc ( valptrproc_t  proc)

Add a value processing function (valptrproc_t) to the current dynamic ObjLabel.

◆ d_add_valptr()

void d_add_valptr ( DynId  objId,
u32  vflags,
s32  type,
u32  offset 
)

Create a new ObjValPtr to dynamic object objId and attach that valptr to the current dynamic object.

Parameters
typeValPtrType

◆ d_addto_group()

void d_addto_group ( DynId  id)

Add the current dynamic object to the dynamic ObjGroup id.

◆ d_addto_rel_pos()

void d_addto_rel_pos ( struct GdVec3f src)

Offset the current position of the current dynamic object.

◆ d_attach()

void d_attach ( DynId  id)

Attach dynamic object id to the current active ObjJoint object.

Note
This function doesn't actually do anything.

◆ d_attach_joint_to_net() [1/2]

void d_attach_joint_to_net ( s32  ,
DynId   
)

◆ d_attach_joint_to_net() [2/2]

void d_attach_joint_to_net ( UNUSED s32  arg0,
DynId  id 
)

Create an ObjJoint and add that to the ObjNet created by d_add_net_with_subgroup().

Parameters
arg0Not used
idId for created ObjJoint

◆ d_attach_to()

void d_attach_to ( s32  flag,
struct GdObj obj 
)

Attach the current dynamic GdObj into the proper subgroup of obj and set the "attach flags" of the current dynamic object to flag

◆ d_attachto_dynid()

void d_attachto_dynid ( s32  flag,
DynId  id 
)

Attach the current dynamic object to dynamic object id.

This function is a wrapper around d_attach_to()

◆ d_calc_world_dist_btwn()

f32 d_calc_world_dist_btwn ( struct GdObj obj1,
struct GdObj obj2 
)

Use the dynamic object system to calculate the distance between two GdObjs.

The objects don't have to be dynamic objects.

◆ d_catstr_to_idbuf()

void d_catstr_to_idbuf ( char str)

Concatenate input str into a buffer that will be concatenated to a dynamic GdObj's name string when creating a new dynamic object.

If input is NULL, then a generic string is created based on the number of unnamed objects.

Note
Not called

◆ d_center_of_gravity()

void d_center_of_gravity ( f32  x,
f32  y,
f32  z 
)

Set the center of gravity of the current dynamic ObjNet.

◆ d_clear_flags()

void d_clear_flags ( s32  flags)

Clear object specific flags from the current dynamic object.

◆ d_copystr_to_idbuf()

void d_copystr_to_idbuf ( char str)

Copy input str into a buffer that will be concatenated to a dynamic GdObj's name string when creating a new dynamic object.

If input is NULL, then a generic string is created based on the number of unnamed objects.

◆ d_end_group()

void d_end_group ( DynId  id)

Add all dynamic objects created between the start of dynamic ObjGroup id and this call.

◆ d_end_net_subgroup()

void d_end_net_subgroup ( DynId  id)

End the ObjNet+ObjGroup set created by d_add_net_with_subgroup().

◆ d_friction()

void d_friction ( f32  x,
f32  y,
f32  z 
)

Set the friction vec of the current dynamic ObjJoint.

◆ d_get_att_flags()

s32 d_get_att_flags ( void  )

Get the attached object flags for the current dynamic object.

◆ d_get_att_objgroup()

struct ObjGroup* d_get_att_objgroup ( void  )

Return a pointer to the attached object group of the current dynamic object.

◆ d_get_att_offset()

void d_get_att_offset ( struct GdVec3f dst)

Store the offset of the attached object into dst.

Note
Not called

◆ d_get_att_to_obj()

struct GdObj* d_get_att_to_obj ( void  )

Return a pointer to the attached object of the current dynamic object.

◆ d_get_idn_mtx_ptr()

Mat4f* d_get_idn_mtx_ptr ( void  )

Get a pointer to the current dynamic object's identity matrix.

◆ d_get_init_pos()

void d_get_init_pos ( struct GdVec3f dst)

Get the initial position of the current dynamic object and store in dst.

◆ d_get_init_rot()

void d_get_init_rot ( struct GdVec3f dst)

Get the initial rotation of the current dynamic object and store in dst.

◆ d_get_matrix()

void d_get_matrix ( Mat4f dst)

Copy the matrix from the current dynamic object into dst.

◆ d_get_matrix_ptr()

Mat4f* d_get_matrix_ptr ( void  )

Get a pointer to the current dynamic object's matrix.

◆ d_get_plane()

struct GdPlaneF* d_get_plane ( void  )

Get a pointer to a GdPlaneF in the current dynamic object.

If the current object does not have a plane, a pointer to a global plane at (0,0) is returned.

◆ d_get_rel_pos()

void d_get_rel_pos ( struct GdVec3f dst)

Store the current dynamic object's position into dst.

◆ d_get_rot_mtx_ptr()

Mat4f* d_get_rot_mtx_ptr ( void  )

Get a pointer to the current dynamic object's rotation matrix.

◆ d_get_scale()

void d_get_scale ( struct GdVec3f dst)

Store the current dynamic object's scale into dst.

◆ d_get_velocity()

void d_get_velocity ( struct GdVec3f dst)

Read the velocity value of the current dynamic object into dst

Parameters
[out]dstvalues are copied to this GdVec3f

◆ d_get_world_pos()

void d_get_world_pos ( struct GdVec3f dst)

Copy the world position of the current dynamic object into dst.

◆ d_get_world_pos_ptr()

struct GdVec3f* d_get_world_pos_ptr ( void  )

Get a pointer to the world position vector of the active dynamic object.

This is a pointer inside the actual object.

Note
Not called.

◆ d_link_with()

void d_link_with ( DynId  id)

Link the dynamic object id to the current dynamic object by wrapping d_link_with_ptr().

◆ d_link_with_ptr()

void d_link_with_ptr ( void ptr)

Link a variable pointer to the current active dynamic object.

In the final game, this is used to link arrays of raw vertex, face, or animation data to ObjGroups, or to link joints to ObjAnimators.

◆ d_make_netfromshape_ptrptr()

void d_make_netfromshape_ptrptr ( struct ObjShape **  shapePtr)

Create a new ObjNet linked with the doubly indirected ObjShape.

The newly made net is added to the dynamic object list, but the shape is not moved into the dynamic list.

◆ d_make_netfromshapeid()

void d_make_netfromshapeid ( DynId  id)

Create a new ObjNet linked with the dynamic ObjShape id.

The newly made net is added to the dynamic object list.

◆ d_make_vertex()

void d_make_vertex ( struct GdVec3f pos)

Create a new dynamic ObjVertex at point pos.

Parameters
[in]posvalues are copied to set vertex position

◆ d_makeobj()

struct GdObj* d_makeobj ( enum DObjTypes  type,
DynId  id 
)

Create a new GdObj of type and add that object to the dynamic object list with id.

Created objects have default parameters, which are usually 0 or NULL.

Returns
pointer to created object
Bug:
Returns garbage when making D_DATA_GRP object
Bug:
When making a D_LABEL, the call to make_label() compiles incorrectly due to Goddard only declaring the functions, not prototyping the functions

◆ d_map_materials()

void d_map_materials ( DynId  id)

Map the material ids for the ObjFaces in the current dynamic ObjGroup to pointer to ObjMaterials in the ObjGroup id.

See map_face_materials() for more info.

◆ d_map_vertices()

void d_map_vertices ( DynId  id)

Map the vertex ids for the ObjFaces in the current dynamic ObjGroup to pointer to ObjVertex in the ObjGroup id.

See map_vertices() for more info.

◆ d_set_ambient()

void d_set_ambient ( f32  r,
f32  g,
f32  b 
)

Set the ambient color of the current dynamic ObjMaterial.

◆ d_set_att_offset()

void d_set_att_offset ( const struct GdVec3f off)

Set the offset of the attached object on the current dynamic object.

◆ d_set_att_to_offset()

void d_set_att_to_offset ( UNUSED u32  a)

An incorrectly-coded recursive function that was presumably supposed to set the offset of an attached object.

Now, it will only call itself until it encounters a NULL pointer, which will trigger a fatal_printf() call.

Note
Not called

◆ d_set_colour_num()

void d_set_colour_num ( s32  colornum)

Set the colour of the current dynamic object.

The input color is an index for gd_get_colour()

◆ d_set_control_type()

void d_set_control_type ( s32  ctrltype)

Set the control type of the current dynamic ObjNet.

◆ d_set_diffuse()

void d_set_diffuse ( f32  r,
f32  g,
f32  b 
)

Set the diffuse color of the current dynamic ObjMaterial or ObjLight.

◆ d_set_flags()

void d_set_flags ( s32  flags)

Set the object specific flags of the current dynamic object.

◆ d_set_id()

void d_set_id ( s32  id)

Set the specific object ID field for the current dynamic object.

◆ d_set_idn_mtx()

void d_set_idn_mtx ( Mat4f src)

Copy src into the identity matrix of the current dynamic object.

◆ d_set_init_pos()

void d_set_init_pos ( f32  x,
f32  y,
f32  z 
)

Set the initial position of the current dynamic object to (x, y, z).

◆ d_set_material() [1/2]

void d_set_material ( void ,
s32   
)

◆ d_set_material() [2/2]

void d_set_material ( UNUSED void a0,
s32  mtlId 
)

Set the material ID of the current dynamic ObjFace.

◆ d_set_matgroup()

void d_set_matgroup ( DynId  id)

Set the material group of the current dynamic ObjShape to id.

◆ d_set_matrix()

void d_set_matrix ( Mat4f src)

Set the matrix of the current dynamic object by copying src into the object.

Bug:
When setting an ObjNet matrix, the source is copied twice due to a probable copy-paste line repeat error

◆ d_set_nodegroup()

void d_set_nodegroup ( DynId  id)

Set the "node group" of the current dynamic object to dynamic object id.

The node group depends on the type of the current dynamic object:

◆ d_set_normal()

void d_set_normal ( f32  x,
f32  y,
f32  z 
)

Set the normal of the current dynamic ObjVertex.

The input x, y, z values are normalized into a unit vector before setting the vertex normal.

◆ d_set_obj_draw_flag()

void d_set_obj_draw_flag ( enum ObjDrawingFlags  flag)

Set the generic drawing flags for the current dynamic object.

◆ d_set_parm_f()

void d_set_parm_f ( enum DParmF  param,
f32  val 
)

Set variable float parameters on the current dynamic object.

These are mainly used for ObjGadgets to set the drawing size range.

◆ d_set_parm_ptr()

void d_set_parm_ptr ( enum DParmPtr  param,
void ptr 
)

Set various pointer parameters for the current dynamic object.

Normally, this is used to set char * pointer for various objects, but it can also set the vertices for an ObjFace.

◆ d_set_planegroup()

void d_set_planegroup ( DynId  id)

In practice, this is used to set the faces of the current active dynamic ObjShape to the dynamic group id of ObjFaces.

It also has interactions with ObjNets, but there are no examples of that usage in existing code.

◆ d_set_rel_pos()

void d_set_rel_pos ( f32  x,
f32  y,
f32  z 
)

Set the position of the current dynamic object.

Note
This function automatically adjusts the three zoom levels for an ObjCamera.

◆ d_set_rot_mtx()

void d_set_rot_mtx ( Mat4f src)

Set the rotation matrix of the current dynamic object by copying the input matrix src.

◆ d_set_rotation()

void d_set_rotation ( f32  x,
f32  y,
f32  z 
)

Set the rotation value of the current active dynamic object.

◆ d_set_scale()

void d_set_scale ( f32  x,
f32  y,
f32  z 
)

Scale the current dynamic object by factor (x, y, z).

Note
Sets the lower right coordinates of an ObjView

◆ d_set_shape_offset()

void d_set_shape_offset ( f32  x,
f32  y,
f32  z 
)

Set the shape offset of the current dynamic ObjJoint.

◆ d_set_shapeptr()

void d_set_shapeptr ( DynId  id)

Set the shape pointer of the current active dynamic object to dynamic ObjShape id.

◆ d_set_shapeptrptr()

void d_set_shapeptrptr ( struct ObjShape **  shpPtrptr)

Set the shape pointer of the current active dynamic object to the pointer pointed to by shpPtrptr.

◆ d_set_skin_weight()

void d_set_skin_weight ( s32  id,
f32  percentWeight 
)

Create a new weight for the current dynamic ObjJoint.

The input weight value is out of 100.

◆ d_set_skinshape()

void d_set_skinshape ( DynId  id)

Set the current dynamic ObjNet's skin group with the vertex group from the dynamic ObjShape with id.

◆ d_set_spring()

void d_set_spring ( f32  spring)

Set the spring constant of the current dynamic ObjBone.

◆ d_set_texture_st() [1/2]

void d_set_texture_st ( f32  ,
f32   
)

◆ d_set_texture_st() [2/2]

void d_set_texture_st ( UNUSED f32  s,
UNUSED f32  t 
)

At one time in the past, this set the s and t value of the current dynamic ObjVertex.

However, this function does nothing now. See BetaVtx for a possible remnant of vertex code that had ST coordinates.

◆ d_set_torque()

void d_set_torque ( const struct GdVec3f src)

Set the torque vectore for the current dynamic object.

Values from input GdVec3f are copied into the object.

Note
Not called

◆ d_set_type()

void d_set_type ( s32  type)

Set an object specific type field for the current dynamic object.

◆ d_set_velocity()

void d_set_velocity ( const struct GdVec3f vel)

Set the velocity of the current active dynamic object.

The values of the input GdVec3f are copied into the object.

◆ d_set_world_pos()

void d_set_world_pos ( f32  x,
f32  y,
f32  z 
)

Set the world position of the current dynamic object.

Note
Sets the upper left coordinates of an ObjView

◆ d_start_group()

void d_start_group ( DynId  id)

Start a dynamic ObjGroup identified with id.

◆ d_use_obj()

struct GdObj* d_use_obj ( DynId  id)

Set the current active dynamic object to object id.

◆ d_use_texture()

void d_use_texture ( void texture)

Set the texture pointer of the current dynamic ObjMaterial.

◆ dynid_is_int()

void dynid_is_int ( s32  isIntBool)

Set if DynId should be treated as integer values, or as char * string pointers.

Parameters
isIntBoolTRUE to interpret ids as integers

◆ get_dynobj_info()

struct DynObjInfo* get_dynobj_info ( DynId  id)

Get the DynObjInfo struct for object id

Parameters
idEither a string or integer id for a dynamic GdObj
Returns
pointer to that object's information

◆ pop_dynobj_stash()

void pop_dynobj_stash ( void  )

Set the stashed GdObj as the active dynamic GdObj.

◆ print_int_dynid()

char* print_int_dynid ( DynId  id)

Format id into string, if DynIds are currently being interpreted as numbers.

Returns
pointer to global buffer for id
Return values
NULLif id is NULL or if DynIds are interpreted as strings

◆ proc_dynlist()

struct GdObj* proc_dynlist ( struct DynList dylist)

Parse a DynList array into active GdObjs.

Returns
Pointer to current dynamically created dynamic GdObj. Normally the dynlist specifically sets an object for return.

◆ push_dynobj_stash()

void push_dynobj_stash ( void  )

Store the active dynamic GdObj into a one object stash.

◆ reset_dynamic_objs()

void reset_dynamic_objs ( void  )

Reset the number of created dynamic objects and free the dynamic object information list (sGdDynObjList).

The objects themselves still exist, though.

Note
Not called

◆ reset_dynlist()

void reset_dynlist ( void  )

Reset dynlist related variables to a starting state.

◆ set_cur_dynobj()

void set_cur_dynobj ( struct GdObj obj)

Set the current active dynamic object to obj.

This object can any type of GdObj, not just an object created through the dynmaic object system.

Variable Documentation

◆ sBackBuf

char sBackBuf[0x100]
static

◆ sDynIdBuf

char sDynIdBuf[DYNOBJ_NAME_SIZE]
static

◆ sDynListCurInfo

struct DynObjInfo* sDynListCurInfo
static

◆ sDynListCurObj

struct GdObj* sDynListCurObj = NULL
static

◆ sDynNetCount

s32 sDynNetCount
static

◆ sDynNetIdBuf

char sDynNetIdBuf[0x20]
static

◆ sGdDynObjIdIsInt

s32 sGdDynObjIdIsInt = FALSE
static

◆ sGdDynObjList

struct DynObjInfo* sGdDynObjList = NULL
static

◆ sGdNullPlaneF

struct GdPlaneF sGdNullPlaneF
static
Initial value:
= {
{ 0.0, 0.0, 0.0 },
{ 0.0, 0.0, 0.0 }
}

◆ sIntDynIdBuffer

char sIntDynIdBuffer[DYNOBJ_NAME_SIZE]
static

buffer for returning formated string from print_int_dynid()

◆ sLoadedDynObjs

s32 sLoadedDynObjs
static

◆ sNullDynObjInfo

struct DynObjInfo sNullDynObjInfo
static

◆ sParentNetInfo

struct DynObjInfo* sParentNetInfo
static

Information for ObjNet made by d_add_net_with_subgroup()

◆ sStashedDynObj

struct GdObj* sStashedDynObj
static

◆ sStashedDynObjInfo

struct DynObjInfo* sStashedDynObjInfo
static

◆ sUnnamedObjCount

s32 sUnnamedObjCount
static