diff --git a/enhancements/platform_displacement_2.diff b/enhancements/platform_displacement_2.diff index ea8bb129..0e5aec8c 100644 --- a/enhancements/platform_displacement_2.diff +++ b/enhancements/platform_displacement_2.diff @@ -1595,9 +1595,9 @@ index 0000000..97cba2a + if (gCurGraphNodeHeldObject != 0) + sp24 = gCurGraphNodeHeldObject->objNode; + if (sp24->oOpacity == 0xFF) -+ sp20->fnNode.node.flags = (sp20->fnNode.node.flags & 0xFF) | GRAPH_NODE_TYPE_FUNCTIONAL; ++ sp20->fnNode.node.flags = (sp20->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | GRAPH_NODE_TYPE_FUNCTIONAL; + else -+ sp20->fnNode.node.flags = (sp20->fnNode.node.flags & 0xFF) | (GRAPH_NODE_TYPE_FUNCTIONAL | GRAPH_NODE_TYPE_400); ++ sp20->fnNode.node.flags = (sp20->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (GRAPH_NODE_TYPE_FUNCTIONAL | GRAPH_NODE_TYPE_400); + sp28 = sp2C = alloc_display_list(2 * sizeof(Gfx)); + + if (sp24->oBowserUnk1B2 != 0) { diff --git a/include/sm64.h b/include/sm64.h index c0c32b7d..9953b1aa 100644 --- a/include/sm64.h +++ b/include/sm64.h @@ -154,6 +154,8 @@ #define MODEL_STATE_NOISE_ALPHA ((1 << 7) | MODEL_STATE_ALPHA) // (0x080 | MODEL_STATE_ALPHA) #define MODEL_STATE_METAL (1 << 9) // 0x200 +#define MODEL_STATE_MASK 0xFF + #define MARIO_NORMAL_CAP /* 0x00000001 */ (1 << 0) #define MARIO_VANISH_CAP /* 0x00000002 */ (1 << 1) #define MARIO_METAL_CAP /* 0x00000004 */ (1 << 2) diff --git a/src/engine/graph_node.c b/src/engine/graph_node.c index aa0a9616..c26ca2bb 100644 --- a/src/engine/graph_node.c +++ b/src/engine/graph_node.c @@ -226,7 +226,7 @@ init_graph_node_translation_rotation(struct AllocOnlyPool *pool, vec3s_copy(graphNode->translation, translation); vec3s_copy(graphNode->rotation, rotation); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->displayList = displayList; } @@ -248,7 +248,7 @@ struct GraphNodeTranslation *init_graph_node_translation(struct AllocOnlyPool *p init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_TRANSLATION); vec3s_copy(graphNode->translation, translation); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->displayList = displayList; } @@ -269,7 +269,7 @@ struct GraphNodeRotation *init_graph_node_rotation(struct AllocOnlyPool *pool, if (graphNode != NULL) { init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ROTATION); vec3s_copy(graphNode->rotation, rotation); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->displayList = displayList; } @@ -288,7 +288,7 @@ struct GraphNodeScale *init_graph_node_scale(struct AllocOnlyPool *pool, if (graphNode != NULL) { init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_SCALE); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->scale = scale; graphNode->displayList = displayList; } @@ -358,7 +358,7 @@ struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct AllocOnlyPool if (graphNode != NULL) { init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ANIMATED_PART); vec3s_copy(graphNode->translation, translation); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->displayList = displayList; } @@ -380,7 +380,7 @@ struct GraphNodeBone *init_graph_node_bone(struct AllocOnlyPool *pool, init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_BONE); vec3s_copy(graphNode->translation, translation); vec3s_copy(graphNode->rotation, rotation); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->displayList = displayList; } @@ -401,7 +401,7 @@ struct GraphNodeBillboard *init_graph_node_billboard(struct AllocOnlyPool *pool, if (graphNode != NULL) { init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_BILLBOARD); vec3s_copy(graphNode->translation, translation); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->displayList = displayList; } @@ -420,7 +420,7 @@ struct GraphNodeDisplayList *init_graph_node_display_list(struct AllocOnlyPool * if (graphNode != NULL) { init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_DISPLAY_LIST); - graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF); + graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & GRAPH_NODE_TYPES_MASK); graphNode->displayList = displayList; } diff --git a/src/engine/graph_node.h b/src/engine/graph_node.h index 20466df1..61e4f687 100644 --- a/src/engine/graph_node.h +++ b/src/engine/graph_node.h @@ -46,6 +46,8 @@ #define GRAPH_NODE_TYPE_HELD_OBJ (0x02E | GRAPH_NODE_TYPE_FUNCTIONAL) #define GRAPH_NODE_TYPE_CULLING_RADIUS 0x02F +#define GRAPH_NODE_TYPES_MASK 0xFF + // The number of master lists. A master list determines the order and render // mode with which display lists are drawn. #define GFX_NUM_MASTER_LISTS (LAYER_LAST_ALL + 1) diff --git a/src/game/behaviors/bowser.inc.c b/src/game/behaviors/bowser.inc.c index 93394344..6c8f4241 100644 --- a/src/game/behaviors/bowser.inc.c +++ b/src/game/behaviors/bowser.inc.c @@ -1912,9 +1912,9 @@ Gfx *geo_bits_bowser_coloring(s32 callContext, struct GraphNode *node, UNUSED s3 } // Set layers if object is transparent or not if (obj->oOpacity == 0xFF) { - graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); } else { - graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); + graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT << 8); } gfx = gfxHead = alloc_display_list(2 * sizeof(Gfx)); // If TRUE, clear lighting to give rainbow color diff --git a/src/game/geo_misc.c b/src/game/geo_misc.c index 383f5fff..eef19673 100644 --- a/src/game/geo_misc.c +++ b/src/game/geo_misc.c @@ -78,7 +78,7 @@ s16 round_float(f32 num) { * Create a display list for the light in the castle lobby that shows the * player where to look to enter Tower of the Wing Cap. */ -Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, UNUSED f32 mtx[4][4]) { +Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx) { s32 flags; struct GraphNodeGenerated *generatedNode; Gfx *displayListHead = NULL; @@ -96,7 +96,7 @@ Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, UNUSE } generatedNode = (struct GraphNodeGenerated *) node; - generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); + generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT << 8); gSPDisplayList(displayListHead++, dl_castle_lobby_wing_cap_light); gSPEndDisplayList(displayListHead); @@ -110,7 +110,7 @@ Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, UNUSE * Update static timer variables that control the flying carpets' ripple effect. */ Gfx *geo_exec_flying_carpet_timer_update(s32 callContext, UNUSED struct GraphNode *node, - UNUSED f32 mtx[4][4]) { + UNUSED Mat4 mtx) { if (callContext != GEO_CONTEXT_RENDER) { sFlyingCarpetRippleTimer = 0; sPrevAreaTimer = gAreaUpdateCounter - 1; @@ -130,7 +130,7 @@ Gfx *geo_exec_flying_carpet_timer_update(s32 callContext, UNUSED struct GraphNod /** * Create a display list for a flying carpet with dynamic ripples. */ -Gfx *geo_exec_flying_carpet_create(s32 callContext, struct GraphNode *node, UNUSED f32 mtx[4][4]) { +Gfx *geo_exec_flying_carpet_create(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx) { s16 n, row, col, x, y, z, tx, ty; Vtx *verts; struct GraphNodeGenerated *generatedNode = (struct GraphNodeGenerated *) node; @@ -149,7 +149,7 @@ Gfx *geo_exec_flying_carpet_create(s32 callContext, struct GraphNode *node, UNUS return NULL; } - generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); for (n = 0; n <= 20; n++) { row = n / 3; @@ -193,7 +193,7 @@ Gfx *geo_exec_flying_carpet_create(s32 callContext, struct GraphNode *node, UNUS /** * Create a display list for the end screen with Peach's delicious cake. */ -Gfx *geo_exec_cake_end_screen(s32 callContext, struct GraphNode *node, UNUSED f32 mtx[4][4]) { +Gfx *geo_exec_cake_end_screen(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx) { struct GraphNodeGenerated *generatedNode = (struct GraphNodeGenerated *) node; Gfx *displayList = NULL; Gfx *displayListHead = NULL; @@ -202,7 +202,7 @@ Gfx *geo_exec_cake_end_screen(s32 callContext, struct GraphNode *node, UNUSED f3 displayList = alloc_display_list(3 * sizeof(*displayList)); displayListHead = displayList; - generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); #ifdef VERSION_EU gSPDisplayList(displayListHead++, dl_cake_end_screen); #else diff --git a/src/game/level_geo.c b/src/game/level_geo.c index 113bcd1a..a108e7a3 100644 --- a/src/game/level_geo.c +++ b/src/game/level_geo.c @@ -40,7 +40,7 @@ Gfx *geo_envfx_main(s32 callContext, struct GraphNode *node, Mat4 mtxf) { mtxf_to_mtx(mtx, mtxf); gSPMatrix(&gfx[0], VIRTUAL_TO_PHYSICAL(mtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); gSPBranchList(&gfx[1], VIRTUAL_TO_PHYSICAL(particleList)); - execNode->fnNode.node.flags = (execNode->fnNode.node.flags & 0xFF) | (LAYER_ALPHA << 8); + execNode->fnNode.node.flags = (execNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_ALPHA << 8); } SET_HIGH_U16_OF_32(*params, gAreaUpdateCounter); } diff --git a/src/game/mario.c b/src/game/mario.c index 3a48d898..a7fa3526 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -1664,8 +1664,8 @@ void mario_update_hitbox_and_cap_model(struct MarioState *m) { m->marioObj->hitboxHeight = 160.0f; } - if ((m->flags & MARIO_TELEPORTING) && (m->fadeWarpOpacity != 0xFF)) { - bodyState->modelState &= ~0xFF; + if ((m->flags & MARIO_TELEPORTING) && (m->fadeWarpOpacity != MODEL_STATE_MASK)) { + bodyState->modelState &= ~MODEL_STATE_MASK; bodyState->modelState |= (MODEL_STATE_ALPHA | m->fadeWarpOpacity); } } diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index c8cd5b31..054f1ac8 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -308,19 +308,16 @@ static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) { Gfx *gfxHead = NULL; if (alpha == 255) { - node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + node->fnNode.node.flags = (node->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); gfxHead = alloc_display_list(2 * sizeof(*gfxHead)); gfx = gfxHead; } else { - node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); + node->fnNode.node.flags = (node->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT << 8); gfxHead = alloc_display_list(3 * sizeof(*gfxHead)); gfx = gfxHead; - if (gMarioState->flags & MARIO_VANISH_CAP) - { + if (gMarioState->flags & MARIO_VANISH_CAP) { gDPSetAlphaCompare(gfx++, G_AC_DITHER); - } - else - { + } else { gDPSetAlphaCompare(gfx++, G_AC_NONE); } } @@ -339,7 +336,7 @@ Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED s16 alpha; if (callContext == GEO_CONTEXT_RENDER) { - alpha = (bodyState->modelState & MODEL_STATE_ALPHA) ? (bodyState->modelState & 0xFF) : 0xFF; + alpha = (bodyState->modelState & MODEL_STATE_ALPHA) ? (bodyState->modelState & MODEL_STATE_MASK) : 0xFF; #ifdef PUPPYCAM if (alpha > gPuppyCam.opacity) { alpha = gPuppyCam.opacity; @@ -370,7 +367,7 @@ Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED /** * Geo node script that makes Mario blink */ -Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node; struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases]; s16 blinkFrame; @@ -393,7 +390,7 @@ Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 /** * Makes Mario's upper body tilt depending on the rotation stored in his bodyState */ -Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node; struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter]; s32 action = bodyState->action; @@ -415,7 +412,7 @@ Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 * /** * Makes Mario's head rotate with the camera angle when in C-up mode */ -Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node; struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter]; s32 action = bodyState->action; @@ -443,7 +440,7 @@ Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat * Switch between hand models. * Possible options are described in the MarioHandGSCId enum. */ -Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node; struct MarioBodyState *bodyState = &gBodyStates[0]; @@ -472,7 +469,7 @@ Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 * ! Since the animation gets updated in GEO_CONTEXT_RENDER, drawing Mario multiple times * (such as in the mirror room) results in a faster and desynced punch / kick animation. */ -Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { static s16 sMarioAttackAnimCounter = 0; struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node; struct GraphNodeScale *scaleNode = (struct GraphNodeScale *) node->next; @@ -496,7 +493,7 @@ Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED /** * Switch between normal cap, wing cap, vanish cap and metal cap. */ -Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node; struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases]; @@ -510,7 +507,7 @@ Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED * Determine whether Mario's head is drawn with or without a cap on. * Also sets the visibility of the wing cap wings on or off. */ -Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { struct GraphNode *next = node->next; struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node; struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases]; @@ -535,7 +532,7 @@ Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED * Geo node script that makes the wings on Mario's wing cap flap. * Should be placed before a rotation node. */ -Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { s16 rotX; struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node; @@ -601,7 +598,7 @@ Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 * * Geo node that creates a clone of Mario's geo node and updates it to becomes * a mirror image of the player. */ -Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { f32 mirroredX; struct Object *mario = gMarioStates[0].marioObj; @@ -629,9 +626,9 @@ Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat gMirrorMario.pos[0] = mirroredX + MIRROR_X; gMirrorMario.angle[1] = -gMirrorMario.angle[1]; gMirrorMario.scale[0] *= -1.0f; - ((struct GraphNode *) &gMirrorMario)->flags |= 1; + ((struct GraphNode *) &gMirrorMario)->flags |= GRAPH_RENDER_ACTIVE; } else { - ((struct GraphNode *) &gMirrorMario)->flags &= ~1; + ((struct GraphNode *) &gMirrorMario)->flags &= ~GRAPH_RENDER_ACTIVE; } break; } @@ -642,7 +639,7 @@ Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat * Since Mirror Mario has an x scale of -1, the mesh becomes inside out. * This node corrects that by changing the culling mode accordingly. */ -Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { +Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) { struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node; Gfx *gfx = NULL; @@ -658,7 +655,7 @@ Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, gSPSetGeometryMode(&gfx[1], G_CULL_BACK); gSPEndDisplayList(&gfx[2]); } - asGenerated->fnNode.node.flags = (asGenerated->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + asGenerated->fnNode.node.flags = (asGenerated->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); } return gfx; } diff --git a/src/game/moving_texture.c b/src/game/moving_texture.c index 8978fa5e..c0794c28 100644 --- a/src/game/moving_texture.c +++ b/src/game/moving_texture.c @@ -661,7 +661,7 @@ Gfx *geo_movtex_draw_water_regions(s32 callContext, struct GraphNode *node, UNUS } asGenerated->fnNode.node.flags = - (asGenerated->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT_INTER << 8); + (asGenerated->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT_INTER << 8); movtex_change_texture_format(asGenerated->parameter, &gfx); gMovetexLastTextureId = -1; @@ -841,7 +841,7 @@ Gfx *geo_movtex_draw_nocolor(s32 callContext, struct GraphNode *node, UNUSED Mat while (gMovtexNonColored[i].movtexVerts != 0) { if (gMovtexNonColored[i].geoId == asGenerated->parameter) { asGenerated->fnNode.node.flags = - (asGenerated->fnNode.node.flags & 0xFF) | (gMovtexNonColored[i].layer << 8); + (asGenerated->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (gMovtexNonColored[i].layer << 8); movtexVerts = segmented_to_virtual(gMovtexNonColored[i].movtexVerts); update_moving_texture_offset(movtexVerts, MOVTEX_ATTR_NOCOLOR_S); gfx = movtex_gen_list(movtexVerts, &gMovtexNonColored[i], @@ -869,7 +869,7 @@ Gfx *geo_movtex_draw_colored(s32 callContext, struct GraphNode *node, UNUSED Mat while (gMovtexColored[i].movtexVerts != 0) { if (gMovtexColored[i].geoId == asGenerated->parameter) { asGenerated->fnNode.node.flags = - (asGenerated->fnNode.node.flags & 0xFF) | (gMovtexColored[i].layer << 8); + (asGenerated->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (gMovtexColored[i].layer << 8); movtexVerts = segmented_to_virtual(gMovtexColored[i].movtexVerts); update_moving_texture_offset(movtexVerts, MOVTEX_ATTR_COLORED_S); gfx = movtex_gen_list(movtexVerts, &gMovtexColored[i], MOVTEX_LAYOUT_COLORED); @@ -900,7 +900,7 @@ Gfx *geo_movtex_draw_colored_no_update(s32 callContext, struct GraphNode *node, while (gMovtexColored[i].movtexVerts != 0) { if (gMovtexColored[i].geoId == asGenerated->parameter) { asGenerated->fnNode.node.flags = - (asGenerated->fnNode.node.flags & 0xFF) | (gMovtexColored[i].layer << 8); + (asGenerated->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (gMovtexColored[i].layer << 8); movtexVerts = segmented_to_virtual(gMovtexColored[i].movtexVerts); gfx = movtex_gen_list(movtexVerts, &gMovtexColored[i], MOVTEX_LAYOUT_COLORED); break; @@ -927,7 +927,7 @@ Gfx *geo_movtex_draw_colored_2_no_update(s32 callContext, struct GraphNode *node while (gMovtexColored2[i].movtexVerts != 0) { if (gMovtexColored2[i].geoId == asGenerated->parameter) { asGenerated->fnNode.node.flags = - (asGenerated->fnNode.node.flags & 0xFF) | (gMovtexColored2[i].layer << 8); + (asGenerated->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (gMovtexColored2[i].layer << 8); movtexVerts = segmented_to_virtual(gMovtexColored2[i].movtexVerts); gfx = movtex_gen_list(movtexVerts, &gMovtexColored2[i], MOVTEX_LAYOUT_COLORED); break; diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index 6b869ec1..d5b91324 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -92,7 +92,6 @@ Gfx UNUSED *geo_obj_transparency_something(s32 callContext, struct GraphNode *no struct Object *heldObject; struct Object *obj; UNUSED struct Object *unusedObject; - UNUSED s32 pad; gfxHead = NULL; @@ -109,7 +108,7 @@ Gfx UNUSED *geo_obj_transparency_something(s32 callContext, struct GraphNode *no gfxHead = alloc_display_list(3 * sizeof(Gfx)); gfx = gfxHead; obj->header.gfx.node.flags = - (obj->header.gfx.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); + (obj->header.gfx.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT << 8); gDPSetEnvColor(gfx++, 255, 255, 255, heldObject->oOpacity); diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index f0412cfa..a1984398 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -74,20 +74,20 @@ Gfx *geo_update_layer_transparency(s32 callContext, struct GraphNode *node, UNUS if (objectOpacity == 0xFF) { if (currentGraphNode->parameter == 20) { currentGraphNode->fnNode.node.flags = - (LAYER_TRANSPARENT_DECAL << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_TRANSPARENT_DECAL << 8) | (currentGraphNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK); } else { currentGraphNode->fnNode.node.flags = - (LAYER_OPAQUE << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_OPAQUE << 8) | (currentGraphNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK); } objectGraphNode->oAnimState = 0; } else { if (currentGraphNode->parameter == 20) { currentGraphNode->fnNode.node.flags = - (LAYER_TRANSPARENT_DECAL << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_TRANSPARENT_DECAL << 8) | (currentGraphNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK); } else { currentGraphNode->fnNode.node.flags = - (LAYER_TRANSPARENT << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_TRANSPARENT << 8) | (currentGraphNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK); } objectGraphNode->oAnimState = 1; diff --git a/src/game/paintings.c b/src/game/paintings.c index a1946f53..00631991 100644 --- a/src/game/paintings.c +++ b/src/game/paintings.c @@ -1144,10 +1144,10 @@ void move_ddd_painting(struct Painting *painting, f32 frontPos, f32 backPos, f32 void set_painting_layer(struct GraphNodeGenerated *gen, struct Painting *painting) { switch (painting->alpha) { case 0xFF: // Opaque - gen->fnNode.node.flags = (gen->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + gen->fnNode.node.flags = (gen->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); break; default: - gen->fnNode.node.flags = (gen->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); + gen->fnNode.node.flags = (gen->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT << 8); break; } } diff --git a/src/game/screen_transition.c b/src/game/screen_transition.c index a2bf0018..e04486b1 100644 --- a/src/game/screen_transition.c +++ b/src/game/screen_transition.c @@ -297,7 +297,7 @@ Gfx *geo_cannon_circle_base(s32 callContext, struct GraphNode *node, UNUSED Mat4 if (callContext == GEO_CONTEXT_RENDER && gCurrentArea != NULL && gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) { - graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); + graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT << 8); #ifndef L3DEX2_ALONE dlist = render_cannon_circle_base(); #endif diff --git a/src/menu/intro_geo.c b/src/menu/intro_geo.c index 50c2574d..e3068ef3 100644 --- a/src/menu/intro_geo.c +++ b/src/menu/intro_geo.c @@ -53,7 +53,7 @@ Gfx *geo_intro_super_mario_64_logo(s32 state, struct GraphNode *node, UNUSED voi if (state != 1) { sIntroFrameCounter = 0; } else if (state == 1) { - graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_OPAQUE << 8); + graphNode->flags = (graphNode->flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); scaleMat = alloc_display_list(sizeof(*scaleMat)); dl = alloc_display_list(4 * sizeof(*dl)); dlIter = dl; @@ -109,11 +109,11 @@ Gfx *geo_intro_tm_copyright(s32 state, struct GraphNode *node, UNUSED void *cont gDPSetEnvColor(dlIter++, 255, 255, 255, sTmCopyrightAlpha); switch (sTmCopyrightAlpha) { case 255: // opaque - graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_OPAQUE << 8); + graphNode->flags = (graphNode->flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); gDPSetRenderMode(dlIter++, G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2); break; default: // blend - graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_TRANSPARENT << 8); + graphNode->flags = (graphNode->flags & GRAPH_NODE_TYPES_MASK) | (LAYER_TRANSPARENT << 8); gDPSetRenderMode(dlIter++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); break; } @@ -202,7 +202,7 @@ Gfx *geo_intro_regular_backdrop(s32 state, struct GraphNode *node, UNUSED void * if (state == 1) { // draw dl = alloc_display_list(16 * sizeof(*dl)); dlIter = dl; - graphNode->node.flags = (graphNode->node.flags & 0xFF) | (LAYER_OPAQUE << 8); + graphNode->node.flags = (graphNode->node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); gSPDisplayList(dlIter++, &dl_proj_mtx_fullscreen); gSPDisplayList(dlIter++, &title_screen_bg_dl_0A000100); for (i = 0; i < 12; ++i) { @@ -258,7 +258,7 @@ Gfx *geo_intro_gameover_backdrop(s32 state, struct GraphNode *node, UNUSED void if (sGameOverTableIndex != 11) { sGameOverFrameCounter++; } - graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_OPAQUE << 8); + graphNode->flags = (graphNode->flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); // draw all the tiles gSPDisplayList(dlIter++, &dl_proj_mtx_fullscreen); @@ -424,7 +424,7 @@ Gfx *geo_intro_face_easter_egg(s32 state, struct GraphNode *node, UNUSED void *c if (sFaceVisible[0] == 1 || sFaceVisible[17] == 1) { image = intro_sample_frame_buffer(40, 40, 2, 2); if (image != NULL) { - genNode->fnNode.node.flags = (genNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + genNode->fnNode.node.flags = (genNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); dl = intro_draw_face(image, 40, 40); } } @@ -447,7 +447,7 @@ Gfx *geo_intro_rumble_pak_graphic(s32 state, struct GraphNode *node, UNUSED void if (state != 1) { dl = NULL; } else if (state == 1) { - genNode->fnNode.node.flags = (genNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + genNode->fnNode.node.flags = (genNode->fnNode.node.flags & GRAPH_NODE_TYPES_MASK) | (LAYER_OPAQUE << 8); introContext = genNode->parameter & 0xFF; if (introContext == 0) { backgroundTileSix = introBackgroundIndexTable[6];