Moved mario global state vars in to struct

This commit is contained in:
jaburns
2020-10-27 15:11:12 -06:00
parent 0c67335112
commit b921cb04bb
15 changed files with 186 additions and 272 deletions
+3
View File
@@ -0,0 +1,3 @@
#include "debug_print.h"
SM64DebugPrintFunctionPtr g_debug_print_func = NULL;
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include "libsm64.h"
extern SM64DebugPrintFunctionPtr g_debug_print_func;
#define DEBUG_PRINT( ... ) do { \
if( g_debug_print_func ) { \
char debugStr[1024]; \
sprintf( debugStr, __VA_ARGS__ ); \
g_debug_print_func( debugStr ); \
} \
} while(0)
+3 -2
View File
@@ -37,6 +37,7 @@
#include "save_file.h" #include "save_file.h"
// #include "sound_init.h" // #include "sound_init.h"
// #include "thread6.h" // #include "thread6.h"
#include "../../load_anim_data.h"
/************************************************** /**************************************************
@@ -67,7 +68,7 @@ s32 is_anim_past_end(struct MarioState *m) {
s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) { s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) {
struct Object *o = m->marioObj; struct Object *o = m->marioObj;
shim_load_mario_animation(m->animation, targetAnimID); load_mario_animation(m->animation, targetAnimID);
struct Animation *targetAnim = m->animation->targetAnim; struct Animation *targetAnim = m->animation->targetAnim;
//if (load_patchable_table(m->animation, targetAnimID)) { //if (load_patchable_table(m->animation, targetAnimID)) {
// targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values); // targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
@@ -101,7 +102,7 @@ s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) {
s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) { s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) {
struct Object *o = m->marioObj; struct Object *o = m->marioObj;
shim_load_mario_animation(m->animation, targetAnimID); load_mario_animation(m->animation, targetAnimID);
struct Animation *targetAnim = m->animation->targetAnim; struct Animation *targetAnim = m->animation->targetAnim;
//if (load_patchable_table(m->animation, targetAnimID)) { //if (load_patchable_table(m->animation, targetAnimID)) {
// targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values); // targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
-4
View File
@@ -260,10 +260,6 @@ void bhv_mario_update(void) {
// } // }
} }
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) { void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
f32 spC, sp8, sp4; f32 spC, sp8, sp4;
+7 -7
View File
@@ -7,8 +7,8 @@
#include "object_stuff.h" #include "object_stuff.h"
#include "platform_displacement.h" #include "platform_displacement.h"
#include "../shim.h" #include "../shim.h"
#include "../global_state.h"
struct SurfaceObjectTransform *gMarioPlatform = NULL; #include "../../load_surfaces.h"
#define absfx( x ) ( (x) < 0.0f ? -(x) : (x) ) #define absfx( x ) ( (x) < 0.0f ? -(x) : (x) )
@@ -47,16 +47,16 @@ void update_mario_platform(void) {
switch (awayFromFloor) { switch (awayFromFloor) {
case 1: case 1:
gMarioPlatform = NULL; g_state->mgMarioPlatform = NULL;
gMarioObject->platform = NULL; gMarioObject->platform = NULL;
break; break;
case 0: case 0:
if (floor != NULL && floor->object != NULL) { if (floor != NULL && floor->object != NULL) {
gMarioPlatform = (struct SurfaceObjectTransform *)floor->object; g_state->mgMarioPlatform = floor->object;
gMarioObject->platform = floor->object; gMarioObject->platform = floor->object;
} else { } else {
gMarioPlatform = NULL; g_state->mgMarioPlatform = NULL;
gMarioObject->platform = NULL; gMarioObject->platform = NULL;
} }
break; break;
@@ -166,7 +166,7 @@ void apply_platform_displacement(u32 isMario, struct SurfaceObjectTransform *pla
* If Mario's platform is not null, apply platform displacement. * If Mario's platform is not null, apply platform displacement.
*/ */
void apply_mario_platform_displacement(void) { void apply_mario_platform_displacement(void) {
struct SurfaceObjectTransform *platform = gMarioPlatform; struct SurfaceObjectTransform *platform = g_state->mgMarioPlatform;
if (gMarioObject != NULL && platform != NULL) { if (gMarioObject != NULL && platform != NULL) {
apply_platform_displacement(TRUE, platform); apply_platform_displacement(TRUE, platform);
@@ -177,5 +177,5 @@ void apply_mario_platform_displacement(void) {
* Set Mario's platform to NULL. * Set Mario's platform to NULL.
*/ */
void clear_mario_platform(void) { void clear_mario_platform(void) {
gMarioPlatform = NULL; g_state->mgMarioPlatform = NULL;
} }
+5 -5
View File
@@ -83,7 +83,7 @@ extern u8 gLastCompletedStarNum;
extern s8 sUnusedGotGlobalCoinHiScore; extern s8 sUnusedGotGlobalCoinHiScore;
extern u8 gGotFileCoinHiScore; extern u8 gGotFileCoinHiScore;
extern u8 gCurrCourseStarFlags; extern u8 gCurrCourseStarFlags;
extern u8 gSpecialTripleJump; //extern u8 gSpecialTripleJump;
extern s8 gLevelToCourseNumTable[]; extern s8 gLevelToCourseNumTable[];
// game progress flags // game progress flags
@@ -142,10 +142,10 @@ void save_file_collect_star_or_key(s16 coinScore, s16 starIndex);
s32 save_file_exists(s32 fileIndex); s32 save_file_exists(s32 fileIndex);
u32 save_file_get_max_coin_score(s32 courseIndex); u32 save_file_get_max_coin_score(s32 courseIndex);
s32 save_file_get_course_star_count(s32 fileIndex, s32 courseIndex); s32 save_file_get_course_star_count(s32 fileIndex, s32 courseIndex);
s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse); //s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse);
void save_file_set_flags(u32 flags); //void save_file_set_flags(u32 flags);
void save_file_clear_flags(u32 flags); //void save_file_clear_flags(u32 flags);
u32 save_file_get_flags(void); //u32 save_file_get_flags(void);
u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex); u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex);
void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags); void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags);
s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex); s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex);
+21 -1
View File
@@ -1,3 +1,23 @@
#include "global_state.h" #include "global_state.h"
struct GlobalState *gState = 0; #include <stdlib.h>
#include <string.h>
struct GlobalState *g_state = 0;
struct GlobalState *global_state_create(void)
{
struct GlobalState *state = malloc( sizeof( struct GlobalState ));
memset( state, 0, sizeof( struct GlobalState ));
return state;
}
void global_state_bind(struct GlobalState *state)
{
g_state = state;
}
void global_state_destroy(struct GlobalState *state)
{
free( state );
}
+34 -28
View File
@@ -5,44 +5,50 @@
struct GlobalState struct GlobalState
{ {
// Not yet implemented:
// interaction.c // interaction.c
u8 sDelayInvincTimer; u8 msDelayInvincTimer;
s16 sInvulnerable; s16 msInvulnerable;
// mario_actions_moving.c // mario_actions_moving.c
Mat4 sFloorAlignMatrix; Mat4 msFloorAlignMatrix;
// mario_actions_submerged.c // mario_actions_submerged.c
s16 sWasAtSurface; s16 msWasAtSurface;
s16 sSwimStrength; s16 msSwimStrength;
s16 D_80339FD0; s16 mD_80339FD0;
s16 D_80339FD2; s16 mD_80339FD2;
f32 D_80339FD4; f32 mD_80339FD4;
// mario_misc.c // mario_misc.c
struct MarioBodyState gBodyStates[2]; struct MarioBodyState mgBodyStates[2];
// Implemented and in use:
// platform_displacement.c // platform_displacement.c
void *gMarioPlatform; void *mgMarioPlatform;
// misc // misc
u32 gGlobalTimer; u32 mgGlobalTimer;
u8 gSpecialTripleJump; u8 mgSpecialTripleJump;
s16 gCurrLevelNum; s16 mgCurrLevelNum;
s16 gCameraMovementFlags; s16 mgCameraMovementFlags;
u32 gAudioRandom; u32 mgAudioRandom;
s8 gShowDebugText; s8 mgShowDebugText;
s8 gDebugLevelSelect; s8 mgDebugLevelSelect;
s16 gCurrSaveFileNum; s16 mgCurrSaveFileNum;
struct Controller gController; struct Controller mgController;
struct SpawnInfo gMarioSpawnInfoVal; struct SpawnInfo mgMarioSpawnInfoVal;
struct SpawnInfo *gMarioSpawnInfo; struct Area *mgCurrentArea;
struct Area *gCurrentArea; struct Object *mgCurrentObject;
struct Object *gCurrentObject; struct Object *mgMarioObject;
struct Object *gMarioObject; struct MarioAnimation mD_80339D10;
struct MarioAnimation D_80339D10; struct MarioState mgMarioStateVal;
struct MarioState gMarioStateVal;
struct MarioState *gMarioState;
}; };
extern struct GlobalState *gState; extern struct GlobalState *g_state;
extern struct GlobalState *global_state_create(void);
extern void global_state_bind(struct GlobalState *state);
extern void global_state_destroy(struct GlobalState *state);
-128
View File
@@ -1,128 +0,0 @@
#include <string.h>
#include "shim.h"
#include "../load_anim_data.h"
u32 gGlobalTimer = 0;
u8 gSpecialTripleJump = FALSE;
s16 gCurrLevelNum = 0;
s16 gCameraMovementFlags = 0;
u32 gAudioRandom = 0;
s8 gShowDebugText = 0;
s8 gDebugLevelSelect = 0;
s16 gCurrSaveFileNum = 1;
struct Controller gController;
struct SpawnInfo gMarioSpawnInfoVal;
struct SpawnInfo *gMarioSpawnInfo = &gMarioSpawnInfoVal;
struct Area *gCurrentArea = NULL;
struct Object *gCurrentObject;
struct Object *gMarioObject = NULL;
struct PlayerCameraState gPlayerCameraState;
struct MarioAnimation D_80339D10;
struct MarioState gMarioStateVal;
struct MarioState *gMarioState = &gMarioStateVal;
SM64DebugPrintFunctionPtr gDebugPrint = NULL;
void shim_load_mario_animation(struct MarioAnimation *a, u32 index)
{
if ((u32)a->currentAnimAddr != 1 + index) {
a->currentAnimAddr = (u8*)(1 + index);
a->targetAnim = &g_libsm64_mario_animations[index];
}
}
void *segmented_to_virtual(const void *addr)
{
return (void*)addr;
}
void *virtual_to_segmented(u32 segment, const void *addr)
{
return (void*)addr;
}
void func_80320A4C(u8 bankIndex, u8 arg1)
{
}
void lower_background_noise(s32 a)
{
}
void raise_background_noise(s32 a)
{
}
void set_camera_mode(struct Camera *c, s16 mode, s16 frames)
{
}
void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n)
{
}
s16 level_trigger_warp(struct MarioState *m, s32 warpOp)
{
return 0;
}
void play_cap_music(u16 seqArgs)
{
}
void fadeout_cap_music(void)
{
}
void stop_cap_music(void)
{
}
void play_infinite_stairs_music(void)
{
}
s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse)
{
return 0;
}
u32 save_file_get_flags(void)
{
return 0;
}
void save_file_set_flags(u32 flags)
{
}
void save_file_clear_flags(u32 flags)
{
}
void spawn_wind_particles(s16 pitch, s16 yaw)
{
}
void set_camera_shake_from_hit(s16 shake)
{
}
void load_level_init_text(u32 arg)
{
}
void spawn_default_star(f32 sp20, f32 sp24, f32 sp28)
{
}
void play_shell_music(void)
{
}
void stop_shell_music(void)
{
}
u16 level_control_timer(s32 timerOp)
{
}
+51 -86
View File
@@ -4,93 +4,58 @@
#include "game/area.h" #include "game/area.h"
#include "game/level_update.h" #include "game/level_update.h"
#include "../libsm64.h" #include "../libsm64.h"
#include "global_state.h"
#define COURSE_MIN 0 #define COURSE_MIN 0
#define COURSE_MAX 14 #define COURSE_MAX 14
#define LEVEL_LLL 99 #define LEVEL_LLL 99
#define LEVEL_SSL 98 #define LEVEL_SSL 98
#define LEVEL_DDD 97 #define LEVEL_DDD 97
#define LEVEL_TTC 96 #define LEVEL_TTC 96
#define LEVEL_CASTLE 95 #define LEVEL_CASTLE 95
#define LEVEL_THI 94 #define LEVEL_THI 94
// From graph_node.h, trying not to pull that in yet #define play_sound(a,b) {}
#define GRAPH_RENDER_INVISIBLE (1 << 4) #define enable_time_stop() {}
#define disable_time_stop() {}
#define play_cutscene_music(a) {}
#define segmented_to_virtual(addr) ((void*)(addr))
#define virtual_to_segmented(seg,addr) ((void*)(addr))
#define func_80320A4C(bankIndex, arg1) {}
#define raise_background_noise(a) {}
#define lower_background_noise(a) {}
#define set_camera_mode(c, mode, frames) {}
#define print_text_fmt_int(x, y, str, n) {}
#define level_trigger_warp(m, warpOp) 0
#define play_cap_music(seqArgs) {}
#define fadeout_cap_music() {}
#define stop_cap_music() {}
#define play_infinite_stairs_music() {}
#define spawn_wind_particles(pitch, yaw) {}
#define set_camera_shake_from_hit(shake) {}
#define load_level_init_text(arg) {}
#define spawn_default_star(sp20, sp24, sp28) {}
#define play_shell_music() {}
#define stop_shell_music() {}
#define level_control_timer(timerOp) 0
#define save_file_get_flags() 0
#define save_file_set_flags(flags) {}
#define save_file_clear_flags(flags) {}
#define save_file_get_total_star_count(fileIndex, minCourse, maxCourse) 0
#define play_sound(a,b) ({}) #define gGlobalTimer (g_state->mgGlobalTimer)
#define enable_time_stop() ({}) #define gSpecialTripleJump (g_state->mgSpecialTripleJump)
#define disable_time_stop() ({}) #define gCurrLevelNum (g_state->mgCurrLevelNum)
#define play_cutscene_music(a) ({}) #define gCameraMovementFlags (g_state->mgCameraMovementFlags)
#define gAudioRandom (g_state->mgAudioRandom)
struct SurfaceObjectTransform #define gShowDebugText (g_state->mgShowDebugText)
{ #define gDebugLevelSelect (g_state->mgDebugLevelSelect)
float aPosX, aPosY, aPosZ; #define gCurrSaveFileNum (g_state->mgCurrSaveFileNum)
float aVelX, aVelY, aVelZ; #define gController (g_state->mgController)
#define gMarioSpawnInfoVal (g_state->mgMarioSpawnInfoVal)
s16 aFaceAnglePitch; #define gMarioSpawnInfo (&g_state->mgMarioSpawnInfoVal)
s16 aFaceAngleYaw; #define gCurrentArea (g_state->mgCurrentArea)
s16 aFaceAngleRoll; #define gCurrentObject (g_state->mgCurrentObject)
#define gMarioObject (g_state->mgMarioObject)
s16 aAngleVelPitch; #define D_80339D10 (g_state->mD_80339D10)
s16 aAngleVelYaw; #define gMarioState (&g_state->mgMarioStateVal)
s16 aAngleVelRoll;
};
struct SurfaceNode
{
struct SurfaceNode *next;
struct Surface *surface;
};
extern u32 gGlobalTimer;
extern u8 gSpecialTripleJump;
extern s16 gCurrLevelNum;
extern s16 gCameraMovementFlags;
extern u32 gAudioRandom;
extern s8 gShowDebugText;
extern s8 gDebugLevelSelect;
extern s16 gCurrSaveFileNum;
extern struct Controller gController;
extern struct SpawnInfo gMarioSpawnInfoVal;
extern struct SpawnInfo *gMarioSpawnInfo;
extern struct Area *gCurrentArea;
extern struct Object *gCurrentObject;
extern struct Object *gMarioObject;
extern struct PlayerCameraState gPlayerCameraState;
extern struct MarioAnimation D_80339D10;
extern struct MarioState *gMarioState;
extern SM64DebugPrintFunctionPtr gDebugPrint;
#define DEBUG_LOG( ... ) do { \
if( gDebugPrint ) { \
char debugStr[1024]; \
sprintf( debugStr, __VA_ARGS__ ); \
gDebugPrint( debugStr ); \
} \
} while(0)
extern void shim_load_mario_animation(struct MarioAnimation *a, u32 index);
extern void *segmented_to_virtual(const void *addr);
extern void *virtual_to_segmented(u32 segment, const void *addr);
extern void func_80320A4C(u8 bankIndex, u8 arg1);
extern void raise_background_noise(s32 a);
extern void lower_background_noise(s32 a);
extern void set_camera_mode(struct Camera *c, s16 mode, s16 frames);
extern void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n);
extern s16 level_trigger_warp(struct MarioState *m, s32 warpOp);
extern void play_cap_music(u16 seqArgs);
extern void fadeout_cap_music(void);
extern void stop_cap_music(void);
extern void play_infinite_stairs_music(void);
extern s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse);
extern u32 save_file_get_flags(void);
extern void save_file_set_flags(u32 flags);
extern void save_file_clear_flags(u32 flags);
extern void spawn_wind_particles(s16 pitch, s16 yaw);
extern void set_camera_shake_from_hit(s16 shake);
extern void load_level_init_text(u32 arg);
extern void spawn_default_star(f32 sp20, f32 sp24, f32 sp28);
extern void play_shell_music(void);
extern void stop_shell_music(void);
extern u16 level_control_timer(s32 timerOp);
+15 -1
View File
@@ -11,6 +11,7 @@
#include "decomp/include/sm64.h" #include "decomp/include/sm64.h"
#include "decomp/shim.h" #include "decomp/shim.h"
#include "decomp/memory.h" #include "decomp/memory.h"
#include "decomp/global_state.h"
#include "decomp/game/mario.h" #include "decomp/game/mario.h"
#include "decomp/game/object_stuff.h" #include "decomp/game/object_stuff.h"
#include "decomp/engine/surface_collision.h" #include "decomp/engine/surface_collision.h"
@@ -20,6 +21,7 @@
#include "decomp/mario/geo.inc.h" #include "decomp/mario/geo.inc.h"
#include "decomp/game/platform_displacement.h" #include "decomp/game/platform_displacement.h"
#include "debug_print.h"
#include "load_surfaces.h" #include "load_surfaces.h"
#include "gfx_adapter.h" #include "gfx_adapter.h"
#include "load_anim_data.h" #include "load_anim_data.h"
@@ -29,6 +31,8 @@ static struct AllocOnlyPool *s_mario_geo_pool;
static struct GraphNode *s_mario_graph_node; static struct GraphNode *s_mario_graph_node;
static uint32_t s_last_colors_hash; static uint32_t s_last_colors_hash;
static struct GlobalState *s_global_state;
static void update_button( bool on, u16 button ) static void update_button( bool on, u16 button )
{ {
gController.buttonPressed &= ~button; gController.buttonPressed &= ~button;
@@ -83,13 +87,16 @@ static struct Area *hack_build_area( void )
SM64_LIB_FN void sm64_global_init( uint8_t *rom, uint8_t *outTexture, SM64DebugPrintFunctionPtr debugPrintFunction ) SM64_LIB_FN void sm64_global_init( uint8_t *rom, uint8_t *outTexture, SM64DebugPrintFunctionPtr debugPrintFunction )
{ {
s_last_colors_hash = 0; s_last_colors_hash = 0;
gDebugPrint = debugPrintFunction; g_debug_print_func = debugPrintFunction;
load_mario_textures_from_rom( rom, outTexture ); load_mario_textures_from_rom( rom, outTexture );
load_mario_anims_from_rom( rom ); load_mario_anims_from_rom( rom );
memory_init(); memory_init();
s_global_state = global_state_create();
global_state_bind( s_global_state );
gCurrSaveFileNum = 1;
gMarioObject = hack_allocate_mario(); gMarioObject = hack_allocate_mario();
gCurrentArea = hack_build_area(); gCurrentArea = hack_build_area();
gCurrentObject = gMarioObject; gCurrentObject = gMarioObject;
@@ -179,6 +186,13 @@ SM64_LIB_FN void sm64_mario_tick( const struct SM64MarioInputs *inputs, struct S
SM64_LIB_FN void sm64_global_terminate( void ) SM64_LIB_FN void sm64_global_terminate( void )
{ {
//deallocate area,
//deallocate mario object and graph node
global_state_bind( NULL );
global_state_destroy( s_global_state );
s_global_state = NULL;
surfaces_unload_all(); surfaces_unload_all();
unload_mario_anims(); unload_mario_anims();
memory_terminate(); memory_terminate();
+15 -7
View File
@@ -3,7 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
static uint32_t s_num_entries = 0; static uint32_t s_num_entries = 0;
struct Animation *g_libsm64_mario_animations = NULL; static struct Animation *s_libsm64_mario_animations = NULL;
#define ANIM_DATA_ADDRESS 0x004EC000 #define ANIM_DATA_ADDRESS 0x004EC000
@@ -37,8 +37,8 @@ void load_mario_anims_from_rom( uint8_t *rom )
uint8_t *read_ptr = rom + ANIM_DATA_ADDRESS; uint8_t *read_ptr = rom + ANIM_DATA_ADDRESS;
s_num_entries = read_u32_be( read_ptr ); s_num_entries = read_u32_be( read_ptr );
g_libsm64_mario_animations = malloc( s_num_entries * sizeof( struct Animation )); s_libsm64_mario_animations = malloc( s_num_entries * sizeof( struct Animation ));
struct Animation *anims = g_libsm64_mario_animations; struct Animation *anims = s_libsm64_mario_animations;
for( int i = 0; i < s_num_entries; ++i ) for( int i = 0; i < s_num_entries; ++i )
{ {
@@ -80,15 +80,23 @@ void load_mario_anims_from_rom( uint8_t *rom )
#undef GET_SIZE #undef GET_SIZE
} }
void load_mario_animation(struct MarioAnimation *a, u32 index)
{
if ((u32)a->currentAnimAddr != 1 + index) {
a->currentAnimAddr = (u8*)(1 + index);
a->targetAnim = &s_libsm64_mario_animations[index];
}
}
void unload_mario_anims( void ) void unload_mario_anims( void )
{ {
for( int i = 0; i < s_num_entries; ++i ) for( int i = 0; i < s_num_entries; ++i )
{ {
free( g_libsm64_mario_animations[i].index ); free( s_libsm64_mario_animations[i].index );
free( g_libsm64_mario_animations[i].values ); free( s_libsm64_mario_animations[i].values );
} }
free( g_libsm64_mario_animations ); free( s_libsm64_mario_animations );
g_libsm64_mario_animations = NULL; s_libsm64_mario_animations = NULL;
s_num_entries = 0; s_num_entries = 0;
} }
+1 -2
View File
@@ -5,7 +5,6 @@
#include "decomp/include/types.h" #include "decomp/include/types.h"
extern struct Animation *g_libsm64_mario_animations; extern void load_mario_animation(struct MarioAnimation *a, u32 index);
extern void load_mario_anims_from_rom( uint8_t *rom ); extern void load_mario_anims_from_rom( uint8_t *rom );
extern void unload_mario_anims( void ); extern void unload_mario_anims( void );
+3 -1
View File
@@ -8,6 +8,8 @@
#include "decomp/engine/math_util.h" #include "decomp/engine/math_util.h"
#include "decomp/shim.h" #include "decomp/shim.h"
#include "debug_print.h"
struct LoadedSurfaceObject struct LoadedSurfaceObject
{ {
struct SurfaceObjectTransform transform; struct SurfaceObjectTransform transform;
@@ -156,7 +158,7 @@ static void engine_surface_from_lib_surface( struct Surface *surface, const stru
} }
if (mag < 0.0001) if (mag < 0.0001)
DEBUG_LOG("ERROR: normal magnitude is very close to zero"); DEBUG_PRINT("ERROR: normal magnitude is very close to zero");
mag = (f32)(1.0 / mag); mag = (f32)(1.0 / mag);
nx *= mag; nx *= mag;
+15
View File
@@ -1,7 +1,22 @@
#pragma once #pragma once
#include "decomp/include/PR/ultratypes.h"
#include "libsm64.h" #include "libsm64.h"
struct SurfaceObjectTransform
{
float aPosX, aPosY, aPosZ;
float aVelX, aVelY, aVelZ;
s16 aFaceAnglePitch;
s16 aFaceAngleYaw;
s16 aFaceAngleRoll;
s16 aAngleVelPitch;
s16 aAngleVelYaw;
s16 aAngleVelRoll;
};
extern struct Surface *loaded_surface_get_at_index( uint32_t index ); extern struct Surface *loaded_surface_get_at_index( uint32_t index );
extern uint32_t loaded_surface_get_count(); extern uint32_t loaded_surface_get_count();