Fix all warnings

This commit is contained in:
jaburns
2020-10-30 12:11:26 -06:00
parent 144df0df98
commit fa3d9e77db
19 changed files with 189 additions and 186 deletions
+1
View File
@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "libsm64.h" #include "libsm64.h"
#include <stdio.h>
extern SM64DebugPrintFunctionPtr g_debug_print_func; extern SM64DebugPrintFunctionPtr g_debug_print_func;
+1
View File
@@ -1,5 +1,6 @@
#include "behavior_actions.h" #include "behavior_actions.h"
#include "rendering_graph_node.h" #include "rendering_graph_node.h"
#include "object_stuff.h"
#include "../shim.h" #include "../shim.h"
// not sure what this is doing here. not in a behavior file. // not sure what this is doing here. not in a behavior file.
+41 -41
View File
@@ -369,10 +369,10 @@ struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType)
u32 mario_check_object_grab(struct MarioState *m) { u32 mario_check_object_grab(struct MarioState *m) {
u32 result = FALSE; u32 result = FALSE;
const BehaviorScript *script; // const BehaviorScript *script;
if (m->input & INPUT_INTERACT_OBJ_GRABBABLE) { if (m->input & INPUT_INTERACT_OBJ_GRABBABLE) {
script = virtual_to_segmented(0x13, m->interactObj->behavior); // script = virtual_to_segmented(0x13, m->interactObj->behavior);
// if (script == bhvBowser) { // if (script == bhvBowser) {
// s16 facingDYaw = m->faceAngle[1] - m->interactObj->oMoveAngleYaw; // s16 facingDYaw = m->faceAngle[1] - m->interactObj->oMoveAngleYaw;
@@ -478,35 +478,35 @@ void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o) {
set_camera_shake_from_hit(SHAKE_HIT_FROM_BELOW); set_camera_shake_from_hit(SHAKE_HIT_FROM_BELOW);
} }
static u32 unused_determine_knockback_action(struct MarioState *m) { // static u32 unused_determine_knockback_action(struct MarioState *m) {
u32 bonkAction; // u32 bonkAction;
s16 angleToObject = mario_obj_angle_to_object(m, m->interactObj); // s16 angleToObject = mario_obj_angle_to_object(m, m->interactObj);
s16 facingDYaw = angleToObject - m->faceAngle[1]; // s16 facingDYaw = angleToObject - m->faceAngle[1];
//
if (m->forwardVel < 16.0f) { // if (m->forwardVel < 16.0f) {
m->forwardVel = 16.0f; // m->forwardVel = 16.0f;
} // }
//
m->faceAngle[1] = angleToObject; // m->faceAngle[1] = angleToObject;
//
if (facingDYaw >= -0x4000 && facingDYaw <= 0x4000) { // if (facingDYaw >= -0x4000 && facingDYaw <= 0x4000) {
m->forwardVel *= -1.0f; // m->forwardVel *= -1.0f;
if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) { // if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) {
bonkAction = ACT_BACKWARD_AIR_KB; // bonkAction = ACT_BACKWARD_AIR_KB;
} else { // } else {
bonkAction = ACT_SOFT_BACKWARD_GROUND_KB; // bonkAction = ACT_SOFT_BACKWARD_GROUND_KB;
} // }
} else { // } else {
m->faceAngle[1] += 0x8000; // m->faceAngle[1] += 0x8000;
if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) { // if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) {
bonkAction = ACT_FORWARD_AIR_KB; // bonkAction = ACT_FORWARD_AIR_KB;
} else { // } else {
bonkAction = ACT_SOFT_FORWARD_GROUND_KB; // bonkAction = ACT_SOFT_FORWARD_GROUND_KB;
} // }
} // }
//
return bonkAction; // return bonkAction;
} // }
u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) { u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
u32 bonkAction; u32 bonkAction;
@@ -630,16 +630,16 @@ u32 should_push_or_pull_door(struct MarioState *m, struct Object *o) {
} }
u32 take_damage_from_interact_object(struct MarioState *m) { u32 take_damage_from_interact_object(struct MarioState *m) {
s32 shake; // s32 shake;
s32 damage = m->interactObj->oDamageOrCoinValue; s32 damage = m->interactObj->oDamageOrCoinValue;
if (damage >= 4) { // if (damage >= 4) {
shake = SHAKE_LARGE_DAMAGE; // shake = SHAKE_LARGE_DAMAGE;
} else if (damage >= 2) { // } else if (damage >= 2) {
shake = SHAKE_MED_DAMAGE; // shake = SHAKE_MED_DAMAGE;
} else { // } else {
shake = SHAKE_SMALL_DAMAGE; // shake = SHAKE_SMALL_DAMAGE;
} // }
if (!(m->flags & MARIO_CAP_ON_HEAD)) { if (!(m->flags & MARIO_CAP_ON_HEAD)) {
damage += (damage + 1) / 2; damage += (damage + 1) / 2;
@@ -654,7 +654,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
#ifdef VERSION_SH #ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif #endif
set_camera_shake_from_hit(shake); // set_camera_shake_from_hit(shake);
return damage; return damage;
} }
@@ -908,7 +908,7 @@ void mario_handle_special_floors(struct MarioState *m) {
break; break;
case SURFACE_WARP: case SURFACE_WARP:
level_trigger_warp(m, WARP_OP_WARP_FLOOR); // level_trigger_warp(m, WARP_OP_WARP_FLOOR);
break; break;
case SURFACE_TIMER_START: case SURFACE_TIMER_START:
+4
View File
@@ -40,6 +40,9 @@
#include "../../load_anim_data.h" #include "../../load_anim_data.h"
static f32 gDefaultSoundArgs[3] = { 0.0f, 0.0f, 0.0f };
/************************************************** /**************************************************
* ANIMATIONS * * ANIMATIONS *
**************************************************/ **************************************************/
@@ -1455,6 +1458,7 @@ void set_submerged_cam_preset_and_spawn_bubbles(struct MarioState *m) {
} }
} }
/** /**
* Both increments and decrements Mario's HP. * Both increments and decrements Mario's HP.
*/ */
+10 -11
View File
@@ -49,17 +49,16 @@ void add_tree_leaf_particles(struct MarioState *m) {
void play_climbing_sounds(struct MarioState *m, s32 b) { void play_climbing_sounds(struct MarioState *m, s32 b) {
// s32 isOnTree = (m->usedObj->behavior == segmented_to_virtual(bhvTree)); // s32 isOnTree = (m->usedObj->behavior == segmented_to_virtual(bhvTree));
s32 isOnTree = FALSE;
if (b == 1) { // if (b == 1) {
if (is_anim_past_frame(m, 1)) { // if (is_anim_past_frame(m, 1)) {
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE, // play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
m->marioObj->header.gfx.cameraToObject); // m->marioObj->header.gfx.cameraToObject);
} // }
} else { // } else {
play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE, // play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE,
m->marioObj->header.gfx.cameraToObject); // m->marioObj->header.gfx.cameraToObject);
} // }
} }
s32 set_pole_position(struct MarioState *m, f32 offsetY) { s32 set_pole_position(struct MarioState *m, f32 offsetY) {
@@ -150,7 +149,7 @@ s32 act_holding_pole(struct MarioState *m) {
if (m->controller->stickY > 16.0f) { if (m->controller->stickY > 16.0f) {
f32 poleTop = m->usedObj->hitboxHeight - 100.0f; f32 poleTop = m->usedObj->hitboxHeight - 100.0f;
const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior); // const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior);
if (marioObj->oMarioPolePos < poleTop - 0.4f) { if (marioObj->oMarioPolePos < poleTop - 0.4f) {
return set_mario_action(m, ACT_CLIMBING_POLE, 0); return set_mario_action(m, ACT_CLIMBING_POLE, 0);
+60 -60
View File
@@ -62,7 +62,7 @@ static struct Object *sIntroWarpPipeObj;
static struct Object *sEndPeachObj; static struct Object *sEndPeachObj;
//static struct Object *sEndRightToadObj; //static struct Object *sEndRightToadObj;
//static struct Object *sEndLeftToadObj; //static struct Object *sEndLeftToadObj;
static struct Object *sEndJumboStarObj; //static struct Object *sEndJumboStarObj;
static UNUSED s32 sUnused; static UNUSED s32 sUnused;
static s16 sEndPeachAnimation; static s16 sEndPeachAnimation;
//static s16 sEndToadAnims[2]; //static s16 sEndToadAnims[2];
@@ -71,7 +71,7 @@ static Vp sEndCutsceneVp = { { { 640, 480, 511, 0 }, { 640, 480, 511, 0 } } };
//static struct CreditsEntry *sDispCreditsEntry = NULL; //static struct CreditsEntry *sDispCreditsEntry = NULL;
// related to peach gfx? // related to peach gfx?
static s8 D_8032CBE4 = 0; //static s8 D_8032CBE4 = 0;
//static s8 D_8032CBE8 = 0; //static s8 D_8032CBE8 = 0;
//static s8 D_8032CBEC[7] = { 2, 3, 2, 1, 2, 3, 2 }; //static s8 D_8032CBEC[7] = { 2, 3, 2, 1, 2, 3, 2 };
@@ -2065,22 +2065,22 @@ static void end_peach_cutscene_mario_landing(struct MarioState *m) {
// raise hand animation, lower hand animation, do some special effects // raise hand animation, lower hand animation, do some special effects
static void end_peach_cutscene_summon_jumbo_star(struct MarioState *m) { static void end_peach_cutscene_summon_jumbo_star(struct MarioState *m) {
set_mario_animation(m, m->actionState == 0 ? MARIO_ANIM_CREDITS_RAISE_HAND // set_mario_animation(m, m->actionState == 0 ? MARIO_ANIM_CREDITS_RAISE_HAND
: MARIO_ANIM_CREDITS_LOWER_HAND); // : MARIO_ANIM_CREDITS_LOWER_HAND);
if (m->actionState == 0 && is_anim_past_end(m)) { // if (m->actionState == 0 && is_anim_past_end(m)) {
m->actionState++; // m->actionState++;
} // }
if (m->actionTimer == 90) { // if (m->actionTimer == 90) {
play_cutscene_music(SEQUENCE_ARGS(0, SEQ_EVENT_CUTSCENE_ENDING)); // play_cutscene_music(SEQUENCE_ARGS(0, SEQ_EVENT_CUTSCENE_ENDING));
} // }
if (m->actionTimer == 255) { // if (m->actionTimer == 255) {
advance_cutscene_step(m); // advance_cutscene_step(m);
} // }
sEndJumboStarObj->oFaceAngleYaw += 0x0400; // sEndJumboStarObj->oFaceAngleYaw += 0x0400;
generate_yellow_sparkles(0, 2528, -1800, 250.0f); // generate_yellow_sparkles(0, 2528, -1800, 250.0f);
play_sound(SOUND_AIR_PEACH_TWINKLE, sEndJumboStarObj->header.gfx.cameraToObject); // play_sound(SOUND_AIR_PEACH_TWINKLE, sEndJumboStarObj->header.gfx.cameraToObject);
} }
#ifdef VERSION_EU #ifdef VERSION_EU
@@ -2362,50 +2362,50 @@ static void end_peach_cutscene_kiss_from_peach(struct MarioState *m) {
} }
static void end_peach_cutscene_star_dance(struct MarioState *m) { static void end_peach_cutscene_star_dance(struct MarioState *m) {
s32 animFrame = set_mario_animation(m, MARIO_ANIM_CREDITS_PEACE_SIGN); // s32 animFrame = set_mario_animation(m, MARIO_ANIM_CREDITS_PEACE_SIGN);
//
if (animFrame == 77) { // if (animFrame == 77) {
cutscene_put_cap_on(m); // cutscene_put_cap_on(m);
} // }
if (animFrame == 88) { // if (animFrame == 88) {
play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject); // play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject);
} // }
if (animFrame >= 98) { // if (animFrame >= 98) {
m->marioBodyState->handState = MARIO_HAND_PEACE_SIGN; // m->marioBodyState->handState = MARIO_HAND_PEACE_SIGN;
} // }
//
if (m->actionTimer < 52) { // if (m->actionTimer < 52) {
m->marioBodyState->eyeState = MARIO_EYES_HALF_CLOSED; // m->marioBodyState->eyeState = MARIO_EYES_HALF_CLOSED;
} // }
//
switch (m->actionTimer) { // switch (m->actionTimer) {
case 70: // case 70:
D_8032CBE4 = 1; // D_8032CBE4 = 1;
break; // break;
//
case 86: // case 86:
D_8032CBE4 = 2; // D_8032CBE4 = 2;
break; // break;
//
case 90: // case 90:
D_8032CBE4 = 3; // D_8032CBE4 = 3;
break; // break;
//
case 120: // case 120:
D_8032CBE4 = 0; // D_8032CBE4 = 0;
break; // break;
//
case 140: // case 140:
#ifndef VERSION_JP //#ifndef VERSION_JP
// sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); //// sequence_player_unlower(SEQ_PLAYER_LEVEL, 60);
#endif //#endif
play_cutscene_music(SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_CREDITS)); // play_cutscene_music(SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_CREDITS));
break; // break;
//
case 142: // case 142:
advance_cutscene_step(m); // advance_cutscene_step(m);
break; // break;
} // }
} }
// dialog 3 // dialog 3
+1 -1
View File
@@ -92,7 +92,7 @@ void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2) {
void align_with_floor(struct MarioState *m) { void align_with_floor(struct MarioState *m) {
m->pos[1] = m->floorHeight; m->pos[1] = m->floorHeight;
mtxf_align_terrain_triangle(g_state->msFloorAlignMatrix, m->pos, m->faceAngle[1], 40.0f); mtxf_align_terrain_triangle(g_state->msFloorAlignMatrix, m->pos, m->faceAngle[1], 40.0f);
m->marioObj->header.gfx.throwMatrix = g_state->msFloorAlignMatrix; m->marioObj->header.gfx.throwMatrix = &g_state->msFloorAlignMatrix;
} }
s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg) { s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg) {
+1 -4
View File
@@ -28,10 +28,7 @@
#include "../include/object_fields.h" #include "../include/object_fields.h"
#include "../include/mario_geo_switch_case_ids.h" #include "../include/mario_geo_switch_case_ids.h"
static Vec3f gVec3fZero = {0,0,0};
static Vec3s gVec3sZero = {0,0,0}; static Vec3s gVec3sZero = {0,0,0};
static Vec3f gVec3fOne = {1,1,1};
#define TOAD_STAR_1_REQUIREMENT 12 #define TOAD_STAR_1_REQUIREMENT 12
#define TOAD_STAR_2_REQUIREMENT 25 #define TOAD_STAR_2_REQUIREMENT 25
@@ -627,7 +624,7 @@ Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat
// } // }
// break; // break;
// } // }
// return NULL; return NULL;
} }
/** /**
-1
View File
@@ -59,7 +59,6 @@
static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f }; static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
static Vec3s gVec3sZero = { 0, 0, 0 }; static Vec3s gVec3sZero = { 0, 0, 0 };
static Vec3f gVec3fOne = { 1.0f, 1.0f, 1.0f };
static struct Object *try_allocate_object(void) { static struct Object *try_allocate_object(void) {
struct ObjectNode *nextObj; struct ObjectNode *nextObj;
+20 -19
View File
@@ -153,8 +153,8 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
struct DisplayListNode *currList; struct DisplayListNode *currList;
s32 i; s32 i;
s32 enableZBuffer = (node->node.flags & GRAPH_RENDER_Z_BUFFER) != 0; s32 enableZBuffer = (node->node.flags & GRAPH_RENDER_Z_BUFFER) != 0;
struct RenderModeContainer *modeList = &renderModeTable_1Cycle[enableZBuffer]; // struct RenderModeContainer *modeList = &renderModeTable_1Cycle[enableZBuffer];
struct RenderModeContainer *mode2List = &renderModeTable_2Cycle[enableZBuffer]; // struct RenderModeContainer *mode2List = &renderModeTable_2Cycle[enableZBuffer];
// @bug This is where the LookAt values should be calculated but aren't. // @bug This is where the LookAt values should be calculated but aren't.
// As a result, environment mapping is broken on Fast3DEX2 without the // As a result, environment mapping is broken on Fast3DEX2 without the
@@ -169,12 +169,13 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER); gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER);
} }
// HACK // libsm64 HACK
// Mario ends up in the second master list for some reason, and the first item in that list is an invalid pointer. // Mario ends up in the second master list for some reason.
// The first item in the list is the projection matrix that is uninitialized, so just skip it.
int xx = FALSE; int xx = FALSE;
for (i = 1; i < GFX_NUM_MASTER_LISTS; i++) { for (i = 1; i < GFX_NUM_MASTER_LISTS; i++) {
if ((currList = node->listHeads[i]) != NULL) { if ((currList = node->listHeads[i]) != NULL) {
gDPSetRenderMode(gDisplayListHead++, modeList->modes[i], mode2List->modes[i]); // gDPSetRenderMode(gDisplayListHead++, modeList->modes[i], mode2List->modes[i]);
while (currList != NULL) { while (currList != NULL) {
if( !xx ) { if( !xx ) {
xx = TRUE; xx = TRUE;
@@ -245,13 +246,13 @@ static void geo_process_master_list(struct GraphNodeMasterList *node) {
static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node) { static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node) {
if (node->node.children != NULL) { if (node->node.children != NULL) {
Mtx *mtx = alloc_display_list(sizeof(*mtx)); Mtx *mtx = alloc_display_list(sizeof(*mtx));
f32 left = (gCurGraphNodeRoot->x - gCurGraphNodeRoot->width) / 2.0f * node->scale; // f32 left = (gCurGraphNodeRoot->x - gCurGraphNodeRoot->width) / 2.0f * node->scale;
f32 right = (gCurGraphNodeRoot->x + gCurGraphNodeRoot->width) / 2.0f * node->scale; // f32 right = (gCurGraphNodeRoot->x + gCurGraphNodeRoot->width) / 2.0f * node->scale;
f32 top = (gCurGraphNodeRoot->y - gCurGraphNodeRoot->height) / 2.0f * node->scale; // f32 top = (gCurGraphNodeRoot->y - gCurGraphNodeRoot->height) / 2.0f * node->scale;
f32 bottom = (gCurGraphNodeRoot->y + gCurGraphNodeRoot->height) / 2.0f * node->scale; // f32 bottom = (gCurGraphNodeRoot->y + gCurGraphNodeRoot->height) / 2.0f * node->scale;
guOrtho(mtx, left, right, bottom, top, -2.0f, 2.0f, 1.0f); // guOrtho(mtx, left, right, bottom, top, -2.0f, 2.0f, 1.0f);
gSPPerspNormalize(gDisplayListHead++, 0xFFFF); // gSPPerspNormalize(gDisplayListHead++, 0xFFFF);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
geo_process_node_and_siblings(node->node.children); geo_process_node_and_siblings(node->node.children);
@@ -266,17 +267,17 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]); node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
} }
if (node->fnNode.node.children != NULL) { if (node->fnNode.node.children != NULL) {
u16 perspNorm; // u16 perspNorm;
Mtx *mtx = alloc_display_list(sizeof(*mtx)); Mtx *mtx = alloc_display_list(sizeof(*mtx));
#ifdef VERSION_EU // #ifdef VERSION_EU
f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f; // f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
#else // #else
f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height; // f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
#endif // #endif
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f); // guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
gSPPerspNormalize(gDisplayListHead++, perspNorm); // gSPPerspNormalize(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
+1 -3
View File
@@ -2901,7 +2901,7 @@ typedef union {
#endif #endif
#ifndef F3D_OLD #ifndef F3D_OLD
//# define gSPPerspNormalize(pkt, s) gMoveWd(pkt, G_MW_PERSPNORM, 0, (s)) # define gSPPerspNormalize(pkt, s) gMoveWd(pkt, G_MW_PERSPNORM, 0, (s))
# define gsSPPerspNormalize(s) gsMoveWd( G_MW_PERSPNORM, 0, (s)) # define gsSPPerspNormalize(s) gsMoveWd( G_MW_PERSPNORM, 0, (s))
#else #else
# define gSPPerspNormalize(pkt, s) \ # define gSPPerspNormalize(pkt, s) \
@@ -3127,11 +3127,9 @@ typedef union {
#define gsDPSetDepthSource(src) \ #define gsDPSetDepthSource(src) \
gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, src) gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, src)
/*
#define gDPSetRenderMode(pkt, c0, c1) \ #define gDPSetRenderMode(pkt, c0, c1) \
gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \ gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \
(c0) | (c1)) (c0) | (c1))
*/
#define gsDPSetRenderMode(c0, c1) \ #define gsDPSetRenderMode(c0, c1) \
gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \ gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \
(c0) | (c1)) (c0) | (c1))
+1 -1
View File
@@ -294,7 +294,7 @@ struct MarioAnimDmaRelatedThing
struct MarioAnimation struct MarioAnimation
{ {
struct MarioAnimDmaRelatedThing *animDmaTable; struct MarioAnimDmaRelatedThing *animDmaTable;
u8 *currentAnimAddr; u32 currentAnimAddr; // libsm64: type change
struct Animation *targetAnim; struct Animation *targetAnim;
u8 padding[4]; u8 padding[4];
}; };
+32 -28
View File
@@ -15,34 +15,6 @@
#define LEVEL_CASTLE 95 #define LEVEL_CASTLE 95
#define LEVEL_THI 94 #define LEVEL_THI 94
#define play_sound(a,b) {}
#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 gGlobalTimer (g_state->mgGlobalTimer) #define gGlobalTimer (g_state->mgGlobalTimer)
#define gSpecialTripleJump (g_state->mgSpecialTripleJump) #define gSpecialTripleJump (g_state->mgSpecialTripleJump)
#define gCurrLevelNum (g_state->mgCurrLevelNum) #define gCurrLevelNum (g_state->mgCurrLevelNum)
@@ -60,3 +32,35 @@
#define D_80339D10 (g_state->mD_80339D10) #define D_80339D10 (g_state->mD_80339D10)
#define gMarioState (&g_state->mgMarioStateVal) #define gMarioState (&g_state->mgMarioStateVal)
#define gAreaUpdateCounter (g_state->mgAreaUpdateCounter) #define gAreaUpdateCounter (g_state->mgAreaUpdateCounter)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static void play_sound(s32 soundBits, f32 *pos) {}
static void enable_time_stop() {}
static void disable_time_stop() {}
static void *segmented_to_virtual(const void *addr) { return (void*)addr; }
static void *virtual_to_segmented(u32 segment, const void *addr) { return (void*)addr; }
static void func_80320A4C(u8 bankIndex, u8 arg1) {}
static void raise_background_noise(s32 a) {}
static void lower_background_noise(s32 a) {}
static void set_camera_mode(struct Camera *c, s16 mode, s16 frames) {}
static void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n) {}
static s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { return 0; }
static void play_cap_music(u16 seqArgs) {}
static void fadeout_cap_music(void) {}
static void stop_cap_music(void) {}
static void play_infinite_stairs_music(void) {}
static s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse) { return 0; }
static u32 save_file_get_flags(void) { return 0; }
static void save_file_set_flags(u32 flags) {}
static void save_file_clear_flags(u32 flags) {}
static void spawn_wind_particles(s16 pitch, s16 yaw) {}
static void set_camera_shake_from_hit(s16 shake) {}
static void load_level_init_text(u32 arg) {}
static void spawn_default_star(f32 sp20, f32 sp24, f32 sp28) {}
static void play_shell_music(void) {}
static void stop_shell_music(void) {}
static u16 level_control_timer(s32 timerOp) { return 0; }
#pragma GCC diagnostic pop
+2 -2
View File
@@ -171,8 +171,8 @@ static void process_display_list( void *dl )
{ {
int64_t uls = *ptr++; int64_t uls = *ptr++;
int64_t ult = *ptr++; int64_t ult = *ptr++;
int64_t lrs = *ptr++; ptr++; // lrs
int64_t lrt = *ptr++; ptr++; // lrt
s_uls = (uint16_t)uls; s_uls = (uint16_t)uls;
s_ult = (uint16_t)ult; s_ult = (uint16_t)ult;
-6
View File
@@ -6,16 +6,10 @@
// Commented out in gbi.h - Replaced here // Commented out in gbi.h - Replaced here
#define gDPPipeSync(pkt) ({}) #define gDPPipeSync(pkt) ({})
#define gSPSetGeometryMode(pkt, word) ({}) #define gSPSetGeometryMode(pkt, word) ({})
#define gDPSetRenderMode(pkt, c0, c1) ({})
#define gSPClearGeometryMode(pkt, word) ({}) #define gSPClearGeometryMode(pkt, word) ({})
#define gSPPerspNormalize(pkt, s) ({})
#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) ({}) #define gDPFillRectangle(pkt, ulx, uly, lrx, lry) ({})
#define gSPViewport(pkt, v) ({}) #define gSPViewport(pkt, v) ({})
extern void gSPMatrix( void *pkt, Mtx *m, uint8_t flags ); extern void gSPMatrix( void *pkt, Mtx *m, uint8_t flags );
extern void gSPDisplayList( void *pkt, struct DisplayListNode *dl ); extern void gSPDisplayList( void *pkt, struct DisplayListNode *dl );
// from lib/src/gu*.c
#define guOrtho(mtx, left, right, bottom, top, a, b, c) ({})
#define guPerspective(mtx, perspNorm, fov, aspect, near, far, a) ({})
extern void gfx_adapter_bind_output_buffers( struct SM64MarioGeometryBuffers *outBuffers ); extern void gfx_adapter_bind_output_buffers( struct SM64MarioGeometryBuffers *outBuffers );
+3
View File
@@ -1,4 +1,7 @@
#ifndef SM64_LIB_EXPORT
#define SM64_LIB_EXPORT #define SM64_LIB_EXPORT
#endif
#include "libsm64.h" #include "libsm64.h"
#include <stdio.h> #include <stdio.h>
+4 -4
View File
@@ -31,8 +31,8 @@ static uint32_t read_u32_be( uint8_t *p )
void load_mario_anims_from_rom( uint8_t *rom ) void load_mario_anims_from_rom( uint8_t *rom )
{ {
#define GET_OFFSET( n ) (read_u32_be(&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->offset)) #define GET_OFFSET( n ) (read_u32_be((uint8_t*)&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->offset))
#define GET_SIZE( n ) (read_u32_be(&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->size )) #define GET_SIZE( n ) (read_u32_be((uint8_t*)&((struct OffsetSizePair*)( rom + ANIM_DATA_ADDRESS + 8 + (n)*8 ))->size ))
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 );
@@ -82,8 +82,8 @@ void load_mario_anims_from_rom( uint8_t *rom )
void load_mario_animation(struct MarioAnimation *a, u32 index) void load_mario_animation(struct MarioAnimation *a, u32 index)
{ {
if ((u32)a->currentAnimAddr != 1 + index) { if (a->currentAnimAddr != 1 + index) {
a->currentAnimAddr = (u8*)(1 + index); a->currentAnimAddr = 1 + index;
a->targetAnim = &s_libsm64_mario_animations[index]; a->targetAnim = &s_libsm64_mario_animations[index];
} }
} }
+2 -1
View File
@@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h>
#include "decomp/include/types.h" #include "decomp/include/types.h"
#include "decomp/include/surface_terrains.h" #include "decomp/include/surface_terrains.h"
@@ -88,7 +89,7 @@ static s32 surface_has_force(s16 surfaceType) {
return hasForce; return hasForce;
} }
static void engine_surface_from_lib_surface( struct Surface *surface, const struct SM64Surface *libSurf, const struct SurfaceObjectTransform *transform ) static void engine_surface_from_lib_surface( struct Surface *surface, const struct SM64Surface *libSurf, struct SurfaceObjectTransform *transform )
{ {
int16_t type = libSurf->type; int16_t type = libSurf->type;
int16_t force = libSurf->force; int16_t force = libSurf->force;
+2 -1
View File
@@ -1,6 +1,7 @@
#include "load_tex_data.h" #include "load_tex_data.h"
#include <stddef.h> #include <stddef.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "libsm64.h" #include "libsm64.h"
@@ -34,7 +35,7 @@ void load_mario_textures_from_rom( uint8_t *rom, uint8_t *outTexture )
mio0_decode_header( in_buf, &head ); mio0_decode_header( in_buf, &head );
uint8_t *out_buf = malloc( head.dest_size ); uint8_t *out_buf = malloc( head.dest_size );
int bytes_read = mio0_decode( in_buf, out_buf, NULL ); mio0_decode( in_buf, out_buf, NULL );
for( int i = 0; i < NUM_USED_TEXTURES; ++i ) for( int i = 0; i < NUM_USED_TEXTURES; ++i )
{ {