mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-28 23:13:02 +00:00
Restore local Mario to mirror room (#109)
This commit is contained in:
parent
21451b0974
commit
59e26fbc86
1 changed files with 38 additions and 38 deletions
|
@ -743,46 +743,46 @@ Gfx* geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode* b, Mat4*
|
||||||
* a mirror image of the player.
|
* 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* c) {
|
||||||
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
struct MarioState* mariolocalState = &gMarioStates[0];
|
||||||
f32 mirroredX;
|
struct Object* marioLocal = mariolocalState->marioObj;
|
||||||
struct MarioState* marioState = &gMarioStates[i];
|
|
||||||
struct Object* mario = marioState->marioObj;
|
f32 mirroredX;
|
||||||
|
struct MarioState* marioState = &gMarioStates[0];
|
||||||
|
struct Object* mario = marioState->marioObj;
|
||||||
|
|
||||||
switch (callContext) {
|
switch (callContext) {
|
||||||
case GEO_CONTEXT_CREATE:
|
case GEO_CONTEXT_CREATE:
|
||||||
init_graph_node_object(NULL, &gMirrorMario[i], NULL, gVec3fZero, gVec3sZero, gVec3fOne);
|
init_graph_node_object(NULL, &gMirrorMario[0], NULL, gVec3fZero, gVec3sZero, gVec3fOne);
|
||||||
break;
|
break;
|
||||||
case GEO_CONTEXT_AREA_LOAD:
|
case GEO_CONTEXT_AREA_LOAD:
|
||||||
geo_add_child(node, &gMirrorMario[i].node);
|
geo_add_child(node, &gMirrorMario[0].node);
|
||||||
break;
|
break;
|
||||||
case GEO_CONTEXT_AREA_UNLOAD:
|
case GEO_CONTEXT_AREA_UNLOAD:
|
||||||
geo_remove_child_from_parent(node, &gMirrorMario[i].node);
|
geo_remove_child_from_parent(node, &gMirrorMario[0].node);
|
||||||
break;
|
break;
|
||||||
case GEO_CONTEXT_RENDER:
|
case GEO_CONTEXT_RENDER:
|
||||||
if (mario && (((struct GraphNode*)&mario->header.gfx)->flags & GRAPH_RENDER_ACTIVE)) {
|
if (marioLocal->header.gfx.pos[0] > 1700.0f) {
|
||||||
// TODO: Is this a geo layout copy or a graph node copy?
|
// TODO: Is this a geo layout copy or a graph node copy?
|
||||||
gMirrorMario[i].sharedChild = mario->header.gfx.sharedChild;
|
gMirrorMario[0].sharedChild = mario->header.gfx.sharedChild;
|
||||||
dynos_actor_override((void*)&gMirrorMario[i].sharedChild);
|
dynos_actor_override((void*)&gMirrorMario[0].sharedChild);
|
||||||
gMirrorMario[i].areaIndex = mario->header.gfx.areaIndex;
|
gMirrorMario[0].areaIndex = mario->header.gfx.areaIndex;
|
||||||
vec3s_copy(gMirrorMario[i].angle, mario->header.gfx.angle);
|
vec3s_copy(gMirrorMario[0].angle, mario->header.gfx.angle);
|
||||||
vec3f_copy(gMirrorMario[i].pos, mario->header.gfx.pos);
|
vec3f_copy(gMirrorMario[0].pos, mario->header.gfx.pos);
|
||||||
vec3f_copy(gMirrorMario[i].scale, mario->header.gfx.scale);
|
vec3f_copy(gMirrorMario[0].scale, mario->header.gfx.scale);
|
||||||
// FIXME: why does this set unk38, an inline struct, to a ptr to another one? wrong
|
// FIXME: why does this set unk38, an inline struct, to a ptr to another one? wrong
|
||||||
// GraphNode types again?
|
// GraphNode types again?
|
||||||
gMirrorMario[i].animInfo = *(struct AnimInfo*) & mario->header.gfx.animInfo.animID;
|
gMirrorMario[0].animInfo = *(struct AnimInfo*) & mario->header.gfx.animInfo.animID;
|
||||||
mirroredX = MIRROR_X - gMirrorMario[i].pos[0];
|
mirroredX = MIRROR_X - gMirrorMario[0].pos[0];
|
||||||
gMirrorMario[i].pos[0] = mirroredX + MIRROR_X;
|
gMirrorMario[0].pos[0] = mirroredX + MIRROR_X;
|
||||||
gMirrorMario[i].angle[1] = -gMirrorMario[i].angle[1];
|
gMirrorMario[0].angle[1] = -gMirrorMario[0].angle[1];
|
||||||
gMirrorMario[i].scale[0] *= -1.0f;
|
gMirrorMario[0].scale[0] *= -1.0f;
|
||||||
// TODO: enabling rendering can cause the game to crash when two players are in the mirror room
|
gMirrorMario[0].node.flags |= GRAPH_RENDER_ACTIVE;
|
||||||
//gMirrorMario[i].node.flags |= GRAPH_RENDER_ACTIVE;
|
} else {
|
||||||
gMirrorMario[i].node.flags &= ~GRAPH_RENDER_ACTIVE;
|
gMirrorMario[0].node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||||
} else {
|
}
|
||||||
gMirrorMario[i].node.flags &= ~GRAPH_RENDER_ACTIVE;
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue