Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Functions | Variables
shape_helper.c File Reference
#include <ultra64.h>
#include <macros.h>
#include "gd_types.h"
#include "shape_helper.h"
#include "gd_main.h"
#include "draw_objects.h"
#include "objects.h"
#include "particles.h"
#include "dynlist_proc.h"
#include "debug_utils.h"
#include "joints.h"
#include "skin.h"
#include "gd_math.h"
#include "renderer.h"
#include "dynlists/dynlists.h"
#include "dynlists/dynlist_macros.h"
#include <prevent_bss_reordering.h>

Data Structures

struct  UnkData
 

Functions

struct ObjMaterialfind_or_add_new_mtl (struct ObjGroup *, s32, f32, f32, f32)
 
void func_80197280 (void)
 
void calc_face_normal (struct ObjFace *face)
 
struct ObjVertexgd_make_vertex (f32 x, f32 y, f32 z)
 
struct ObjFacemake_face_with_colour (f32 r, f32 g, f32 b)
 
struct ObjFacemake_face_with_material (struct ObjMaterial *mtl)
 
void Unknown8019773C (struct ObjFace *face, struct ObjVertex *vtx1, struct ObjVertex *vtx2, struct ObjVertex *vtx3, struct ObjVertex *vtx4)
 
void add_3_vtx_to_face (struct ObjFace *face, struct ObjVertex *vtx1, struct ObjVertex *vtx2, struct ObjVertex *vtx3)
 
struct ObjShapemake_shape (s32 flag, const char *name)
 
void clear_buf_to_cr (void)
 
s8 get_current_buf_char (void)
 
s8 get_and_advance_buf (void)
 
s8 load_next_line_into_buf (void)
 
s32 is_line_end (char c)
 
s32 is_white_space (char c)
 
s32 scan_to_next_non_whitespace (void)
 
s32 is_next_buf_word (char *a0)
 
s32 getfloat (f32 *floatPtr)
 
s32 getint (s32 *intPtr)
 
void Unknown80198068 (UNUSED f32 a0)
 
void func_8019807C (struct ObjVertex *vtx)
 
void func_801980E8 (f32 *a0)
 
void Unknown80198154 (f32 x, f32 y, f32 z)
 
void Unknown80198184 (struct ObjShape *shape, f32 x, f32 y, f32 z)
 
void scale_obj_position (struct GdObj *obj)
 
void translate_obj_position (struct GdObj *obj)
 
void scale_verts_in_shape (struct ObjShape *shape, f32 x, f32 y, f32 z)
 
void translate_verts_in_shape (struct ObjShape *shape, f32 x, f32 y, f32 z)
 
void Unknown80198444 (struct ObjVertex *vtx)
 
void Unknown80198524 (struct ObjVertex *vtx)
 
void Unknown801985E8 (struct ObjShape *shape)
 
void get_3DG1_shape (struct ObjShape *shape)
 
void get_OBJ_shape (struct ObjShape *shape)
 
struct ObjGroupgroup_faces_in_mtl_grp (struct ObjGroup *mtlGroup, struct GdObj *fromObj, struct GdObj *toObj)
 
struct ObjMaterialfind_or_add_new_mtl (struct ObjGroup *group, UNUSED s32 a1, f32 r, f32 g, f32 b)
 
void read_ARK_shape (struct ObjShape *shape, char *fileName)
 
struct GdFileget_shape_from_file (struct ObjShape *shape, char *fileName)
 
struct ObjShapemake_grid_shape (enum ObjTypeFlag gridType, s32 a1, s32 a2, s32 a3, s32 a4)
 
void Unknown80199E44 (UNUSED s32 a0, struct GdObj *a1, struct GdObj *a2, UNUSED s32 a3)
 
void Unknown80199E88 (struct ObjFace *face)
 
struct ObjNetmake_netfromshape (struct ObjShape *shape)
 
void animate_mario_head_gameover (struct ObjAnimator *self)
 
void animate_mario_head_normal (struct ObjAnimator *self)
 
s32 load_mario_head (void(*aniFn)(struct ObjAnimator *))
 
void load_shapes2 (void)
 
struct ObjGroupUnknown8019AB98 (UNUSED u32 a0)
 
struct ObjGroupUnknown8019ADC4 (UNUSED u32 a0)
 
struct ObjGroupUnknown8019AEC4 (UNUSED u32 a0)
 

Variables

struct ObjGroupgMarioFaceGrp = NULL
 
struct ObjShapeD_801A82E4 = NULL
 
static struct ObjShapeD_801A82E8 = NULL
 
struct ObjShapegShapeSilSpark = NULL
 
struct ObjShapegShapeRedSpark = NULL
 
struct ObjShapegShapeRedStar = NULL
 
struct ObjShapegShapeSilverStar = NULL
 
static struct UnkData sUnref801A82FC
 
static struct UnkData sUnref801A832C
 
static struct UnkData sUnref801A835C
 
static s32 sUnref801A838C [6] = { 0 }
 
struct ObjShapeD_801A83A4 = NULL
 
static s32 sUnref801A83A8 [31] = { 0 }
 
static struct DynList sSimpleDylist [8]
 
static struct DynList sDynlist801A84E4 [3]
 
static struct DynList sDynlist801A85B3 [5]
 
static struct DynList sDynlist801A85A4 [4]
 
static struct DynList sDynlist801A8604 [4]
 
static f64 D_801A8668 = 0.0
 
static u8 sUnrefSpaceB00 [0x2C]
 
static struct ObjGroupsCubeShapeGroup
 
static u8 sUnrefSpaceB30 [0xC]
 
static struct ObjShapesCubeShape
 
static u8 sUnrefSpaceB40 [0x8]
 
static char sGdLineBuf [0x100]
 
static s32 sGdLineBufCsr
 
static struct GdFilesGdShapeFile
 
static struct ObjShapesGdShapeListHead
 
static u32 sGdShapeCount
 
static u8 sUnrefSpaceC58 [0x8]
 
static struct GdVec3f D_801BAC60
 
static u32 sUnrefSpaceC6C
 
static u32 sUnrefSpaceC70
 
static struct ObjPlaneD_801BAC74
 
static struct ObjPlaneD_801BAC78
 
static u8 sUnrefSpaceC80 [0x1C]
 
static struct ObjFaceD_801BAC9C
 
static struct ObjFaceD_801BACA0
 
static u8 sUnrefSpaceCA8 [0x10]
 
static struct GdVec3f sVertexScaleFactor
 factor for scaling vertices in an ObjShape when calling scale_verts_in_shape() More...
 
static struct GdVec3f sVertexTranslateOffset
 factor for translating vertices in an ObjShape when calling translate_verts_in_shape() More...
 
static u8 sUnrefSpaceCD8 [0x30]
 
static struct ObjGroupD_801BAD08
 
static u8 sUnrefSpaceD10 [0x20]
 
static struct GdVec3f D_801BAD30
 
static u8 sUnrefSpaceD40 [0x120]
 

Function Documentation

◆ add_3_vtx_to_face()

void add_3_vtx_to_face ( struct ObjFace face,
struct ObjVertex vtx1,
struct ObjVertex vtx2,
struct ObjVertex vtx3 
)

◆ animate_mario_head_gameover()

void animate_mario_head_gameover ( struct ObjAnimator self)

◆ animate_mario_head_normal()

void animate_mario_head_normal ( struct ObjAnimator self)

◆ calc_face_normal()

void calc_face_normal ( struct ObjFace face)

◆ clear_buf_to_cr()

void clear_buf_to_cr ( void  )

◆ find_or_add_new_mtl() [1/2]

struct ObjMaterial* find_or_add_new_mtl ( struct ObjGroup ,
s32  ,
f32  ,
f32  ,
f32   
)

◆ find_or_add_new_mtl() [2/2]

struct ObjMaterial* find_or_add_new_mtl ( struct ObjGroup group,
UNUSED s32  a1,
f32  r,
f32  g,
f32  b 
)

◆ func_80197280()

void func_80197280 ( void  )

◆ func_8019807C()

void func_8019807C ( struct ObjVertex vtx)

◆ func_801980E8()

void func_801980E8 ( f32 a0)

◆ gd_make_vertex()

struct ObjVertex* gd_make_vertex ( f32  x,
f32  y,
f32  z 
)

◆ get_3DG1_shape()

void get_3DG1_shape ( struct ObjShape shape)

◆ get_and_advance_buf()

s8 get_and_advance_buf ( void  )

◆ get_current_buf_char()

s8 get_current_buf_char ( void  )

◆ get_OBJ_shape()

void get_OBJ_shape ( struct ObjShape shape)

◆ get_shape_from_file()

struct GdFile* get_shape_from_file ( struct ObjShape shape,
char fileName 
)

◆ getfloat()

s32 getfloat ( f32 floatPtr)

◆ getint()

s32 getint ( s32 intPtr)

◆ group_faces_in_mtl_grp()

struct ObjGroup* group_faces_in_mtl_grp ( struct ObjGroup mtlGroup,
struct GdObj fromObj,
struct GdObj toObj 
)

◆ is_line_end()

s32 is_line_end ( char  c)

◆ is_next_buf_word()

s32 is_next_buf_word ( char a0)

◆ is_white_space()

s32 is_white_space ( char  c)

◆ load_mario_head()

s32 load_mario_head ( void(*)(struct ObjAnimator *)  aniFn)

◆ load_next_line_into_buf()

s8 load_next_line_into_buf ( void  )

◆ load_shapes2()

void load_shapes2 ( void  )

◆ make_face_with_colour()

struct ObjFace* make_face_with_colour ( f32  r,
f32  g,
f32  b 
)

◆ make_face_with_material()

struct ObjFace* make_face_with_material ( struct ObjMaterial mtl)

◆ make_grid_shape()

struct ObjShape* make_grid_shape ( enum ObjTypeFlag  gridType,
s32  a1,
s32  a2,
s32  a3,
s32  a4 
)

◆ make_netfromshape()

struct ObjNet* make_netfromshape ( struct ObjShape shape)

◆ make_shape()

struct ObjShape* make_shape ( s32  flag,
const char name 
)

◆ read_ARK_shape()

void read_ARK_shape ( struct ObjShape shape,
char fileName 
)

◆ scale_obj_position()

void scale_obj_position ( struct GdObj obj)

◆ scale_verts_in_shape()

void scale_verts_in_shape ( struct ObjShape shape,
f32  x,
f32  y,
f32  z 
)

◆ scan_to_next_non_whitespace()

s32 scan_to_next_non_whitespace ( void  )

◆ translate_obj_position()

void translate_obj_position ( struct GdObj obj)

◆ translate_verts_in_shape()

void translate_verts_in_shape ( struct ObjShape shape,
f32  x,
f32  y,
f32  z 
)

◆ Unknown8019773C()

void Unknown8019773C ( struct ObjFace face,
struct ObjVertex vtx1,
struct ObjVertex vtx2,
struct ObjVertex vtx3,
struct ObjVertex vtx4 
)

◆ Unknown80198068()

void Unknown80198068 ( UNUSED f32  a0)

◆ Unknown80198154()

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

◆ Unknown80198184()

void Unknown80198184 ( struct ObjShape shape,
f32  x,
f32  y,
f32  z 
)

◆ Unknown80198444()

void Unknown80198444 ( struct ObjVertex vtx)

◆ Unknown80198524()

void Unknown80198524 ( struct ObjVertex vtx)

◆ Unknown801985E8()

void Unknown801985E8 ( struct ObjShape shape)

◆ Unknown80199E44()

void Unknown80199E44 ( UNUSED s32  a0,
struct GdObj a1,
struct GdObj a2,
UNUSED s32  a3 
)

◆ Unknown80199E88()

void Unknown80199E88 ( struct ObjFace face)

◆ Unknown8019AB98()

struct ObjGroup* Unknown8019AB98 ( UNUSED u32  a0)

◆ Unknown8019ADC4()

struct ObjGroup* Unknown8019ADC4 ( UNUSED u32  a0)

◆ Unknown8019AEC4()

struct ObjGroup* Unknown8019AEC4 ( UNUSED u32  a0)

Variable Documentation

◆ D_801A82E4

struct ObjShape* D_801A82E4 = NULL

◆ D_801A82E8

struct ObjShape* D_801A82E8 = NULL
static

◆ D_801A83A4

struct ObjShape* D_801A83A4 = NULL

◆ D_801A8668

f64 D_801A8668 = 0.0
static

◆ D_801BAC60

struct GdVec3f D_801BAC60
static

◆ D_801BAC74

struct ObjPlane* D_801BAC74
static

◆ D_801BAC78

struct ObjPlane* D_801BAC78
static

◆ D_801BAC9C

struct ObjFace* D_801BAC9C
static

◆ D_801BACA0

struct ObjFace* D_801BACA0
static

◆ D_801BAD08

struct ObjGroup* D_801BAD08
static

◆ D_801BAD30

struct GdVec3f D_801BAD30
static

◆ gMarioFaceGrp

struct ObjGroup* gMarioFaceGrp = NULL

◆ gShapeRedSpark

struct ObjShape* gShapeRedSpark = NULL

◆ gShapeRedStar

struct ObjShape* gShapeRedStar = NULL

◆ gShapeSilSpark

struct ObjShape* gShapeSilSpark = NULL

◆ gShapeSilverStar

struct ObjShape* gShapeSilverStar = NULL

◆ sCubeShape

struct ObjShape* sCubeShape
static

◆ sCubeShapeGroup

struct ObjGroup* sCubeShapeGroup
static

◆ sDynlist801A84E4

struct DynList sDynlist801A84E4[3]
static
Initial value:
= {
SetFlag(0x1800),
}
#define SetFlag(w2)
Definition: dynlist_macros.h:54
#define StartList()
Definition: dynlist_macros.h:6
#define StopList()
Definition: dynlist_macros.h:10

◆ sDynlist801A85A4

struct DynList sDynlist801A85A4[4]
static
Initial value:
= {
SetFriction(0.04, 0.01, 0.01),
}
#define SetFriction(x, y, z)
Definition: dynlist_macros.h:64
static struct DynList sDynlist801A84E4[3]
Definition: shape_helper.c:79
#define StartList()
Definition: dynlist_macros.h:6
#define StopList()
Definition: dynlist_macros.h:10
#define JumpToList(w1)
Definition: dynlist_macros.h:73

◆ sDynlist801A85B3

struct DynList sDynlist801A85B3[5]
static
Initial value:
= {
StartList(), JumpToList(sDynlist801A84E4), SetFlag(0x400), SetFriction(0.04, 0.01, 0.01),
}
#define SetFriction(x, y, z)
Definition: dynlist_macros.h:64
static struct DynList sDynlist801A84E4[3]
Definition: shape_helper.c:79
#define SetFlag(w2)
Definition: dynlist_macros.h:54
#define StartList()
Definition: dynlist_macros.h:6
#define StopList()
Definition: dynlist_macros.h:10
#define JumpToList(w1)
Definition: dynlist_macros.h:73

◆ sDynlist801A8604

struct DynList sDynlist801A8604[4]
static
Initial value:
= {
SetFriction(0.005, 0.005, 0.005),
}
#define SetFriction(x, y, z)
Definition: dynlist_macros.h:64
static struct DynList sDynlist801A84E4[3]
Definition: shape_helper.c:79
#define StartList()
Definition: dynlist_macros.h:6
#define StopList()
Definition: dynlist_macros.h:10
#define JumpToList(w1)
Definition: dynlist_macros.h:73

◆ sGdLineBuf

char sGdLineBuf[0x100]
static

◆ sGdLineBufCsr

s32 sGdLineBufCsr
static

◆ sGdShapeCount

u32 sGdShapeCount
static

◆ sGdShapeFile

struct GdFile* sGdShapeFile
static

◆ sGdShapeListHead

struct ObjShape* sGdShapeListHead
static

◆ sSimpleDylist

struct DynList sSimpleDylist[8]
static
Initial value:
= {
StartGroup("simpleg"),
MakeDynObj(D_NET, "simple"),
SetType(3),
EndGroup("simpleg"),
UseObj("simpleg"),
}
#define EndGroup(w1)
Definition: dynlist_macros.h:91
#define StartList()
Definition: dynlist_macros.h:6
#define StartGroup(w1)
Definition: dynlist_macros.h:86
#define StopList()
Definition: dynlist_macros.h:10
#define UseObj(w1)
Definition: dynlist_macros.h:156
#define SetType(w2)
Definition: dynlist_macros.h:101
struct ObjShape * D_801A83A4
Definition: shape_helper.c:67
#define SetShapePtrPtr(w1)
Definition: dynlist_macros.h:126
#define MakeDynObj(w2, w1)
Definition: dynlist_macros.h:82
Definition: dynlist_proc.h:38

◆ sUnref801A82FC

struct UnkData sUnref801A82FC
static
Initial value:
= { { {
1.0,
1.0,
1.0,
},
{ 0.0, 0.0, 0.0 },
{ 0.0, 0.0, 0.0 } },
1,
4,
static struct UnkData sUnref801A82FC
Definition: shape_helper.c:36

◆ sUnref801A832C

struct UnkData sUnref801A832C
static
Initial value:
= { { {
1.0,
1.0,
1.0,
},
{ 0.0, 0.0, 0.0 },
{ 0.0, 0.0, 0.0 } },
1,
4,
static struct UnkData sUnref801A832C
Definition: shape_helper.c:46

◆ sUnref801A835C

struct UnkData sUnref801A835C
static
Initial value:
= { { {
1.0,
1.0,
1.0,
},
{ 0.0, 0.0, 0.0 },
{ 0.0, 0.0, 0.0 } },
1,
4,
static struct UnkData sUnref801A835C
Definition: shape_helper.c:56

◆ sUnref801A838C

s32 sUnref801A838C[6] = { 0 }
static

◆ sUnref801A83A8

s32 sUnref801A83A8[31] = { 0 }
static

◆ sUnrefSpaceB00

u8 sUnrefSpaceB00[0x2C]
static

◆ sUnrefSpaceB30

u8 sUnrefSpaceB30[0xC]
static

◆ sUnrefSpaceB40

u8 sUnrefSpaceB40[0x8]
static

◆ sUnrefSpaceC58

u8 sUnrefSpaceC58[0x8]
static

◆ sUnrefSpaceC6C

u32 sUnrefSpaceC6C
static

◆ sUnrefSpaceC70

u32 sUnrefSpaceC70
static

◆ sUnrefSpaceC80

u8 sUnrefSpaceC80[0x1C]
static

◆ sUnrefSpaceCA8

u8 sUnrefSpaceCA8[0x10]
static

◆ sUnrefSpaceCD8

u8 sUnrefSpaceCD8[0x30]
static

◆ sUnrefSpaceD10

u8 sUnrefSpaceD10[0x20]
static

◆ sUnrefSpaceD40

u8 sUnrefSpaceD40[0x120]
static

◆ sVertexScaleFactor

struct GdVec3f sVertexScaleFactor
static

factor for scaling vertices in an ObjShape when calling scale_verts_in_shape()

◆ sVertexTranslateOffset

struct GdVec3f sVertexTranslateOffset
static

factor for translating vertices in an ObjShape when calling translate_verts_in_shape()