If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Super Mario 64 (Nintendo 64)/Unused Code

From The Cutting Room Floor
Jump to navigation Jump to search

This is a sub-page of Super Mario 64 (Nintendo 64).

So very stubbly.
This page is rather stubbly and could use some expansion.
Are you a bad enough dude to rescue this article?
Notes: Most things aren't documented from the source code, Plus this page needs be cleaned up.

Unused Code

Behavior Scripts

In sm64/data/behavior_data.c, there exist a total of 10 unused behaviors that are never called in the final game. They're from older versions, so they might not function as they were originally intended to, or would have been used in a debug build instead.

Immediately escapes a behavior script. A similar one is used in-game, but the value is changed to 0x0A:

#define BREAK() \
    BC_B(0x0B)

Gets a random short value, right shifts it to the specified amount and adds the minimum value to it, then adds the value to the specified field:

#define ADD_INT_RAND_RSHIFT(field, min, rshift) \
    BC_BBH(0x17, field, min), \
    BC_H(rshift)

Behavior scripts that have no operation. Possibly used for debug testing:

#define CMD_NOP_1(field) \
    BC_BB(0x18, field)
    
#define CMD_NOP_2(field) \
    BC_BB(0x19, field)
    
#define CMD_NOP_3(field) \
    BC_BB(0x1A, field)

#define CMD_NOP_4(field, value) \
    BC_BBH(0x24, field, value)

Sets the destination integer field to the sum of the values of the given integer fields:

#define SUM_INT(fieldDst, fieldSrc1, fieldSrc2) \
    BC_BBBB(0x20, fieldDst, fieldSrc1, fieldSrc2)

Marks the start of a loop that will repeat a limited number of times:

#define BEGIN_REPEAT(count) \
    BC_BB(0x26, count)

Sets the object's interaction subtype:

#define SET_INTERACT_SUBTYPE(subtype) \
    BC_B(0x31), \
    BC_W(subtype)

Sets the specified field to an integer:

#define SET_INT(field, value) \
    BC_BB(0x36, field), \
    BC_HH(0, value)

Debug Mode

Present in sm64/src/game/debug.c.

Hmmm...
To do:
Check 64DD version if these have code for that version.

Empty debug void functions, most likely from a debug build and later removed:

void debug_1(void) {
}

void debug_2(void) {
}

void debug_3(void) {
}

void debug_4(void) {
}

void stub_debug_5(void) {
}
static void try_change_debug_page(void) {
    if (gDebugInfoFlags & DEBUG_INFO_FLAG_DPRINT) {
        if ((gPlayer1Controller->buttonPressed & L_JPAD)
            && (gPlayer1Controller->buttonDown & (L_TRIG | R_TRIG))) {
            sDebugPage++;
        }
        if ((gPlayer1Controller->buttonPressed & R_JPAD)
            && (gPlayer1Controller->buttonDown & (L_TRIG | R_TRIG))) {
            sDebugPage--;
        }
        if (sDebugPage >= (DEBUG_PAGE_MAX + 1)) {
            sDebugPage = DEBUG_PAGE_MIN;
        }
        if (sDebugPage < DEBUG_PAGE_MIN) {
            sDebugPage = DEBUG_PAGE_MAX;
        }
    }
}

A debug enemy function:

void debug_enemy(s16 *enemyArr) {
    enemyArr[4] = gDebugInfo[DEBUG_PAGE_ENEMYINFO][1];
    enemyArr[5] = gDebugInfo[DEBUG_PAGE_ENEMYINFO][2];
    enemyArr[6] = gDebugInfo[DEBUG_PAGE_ENEMYINFO][3];
    enemyArr[7] = gDebugInfo[DEBUG_PAGE_ENEMYINFO][4];
}

A debug function that cycles through most of Bowser's actions:

static void bowser_debug_actions(void) {
    if (gDebugInfo[DEBUG_PAGE_ENEMYINFO][1] != 0) {
        o->oAction = sBowserDebugActions[gDebugInfo[DEBUG_PAGE_ENEMYINFO][2] & 0x0F];
        gDebugInfo[DEBUG_PAGE_ENEMYINFO][1] = 0;
    }
}

Area and Positional Checks

Bob-omb Battlefield was supposed to have it's own unique camera areas.

struct CameraTrigger sCamBOB[] = {
    {  1, cam_bob_tower, 2468, 2720, -4608, 3263, 1696, 3072, 0 },
    { -1, cam_bob_default_free_roam, 0, 0, 0, 0, 0, 0, 0 },
     NULL_TRIGGER
};