Make players invisible until their level/area can be verified
This commit is contained in:
parent
aef216c4d5
commit
3f0f9646b9
|
@ -1868,18 +1868,18 @@ s32 execute_mario_action(UNUSED struct Object *o) {
|
||||||
// hide inactive players
|
// hide inactive players
|
||||||
struct NetworkPlayer* np = &gNetworkPlayers[gMarioState->playerIndex];
|
struct NetworkPlayer* np = &gNetworkPlayers[gMarioState->playerIndex];
|
||||||
if (gMarioState->playerIndex != 0) {
|
if (gMarioState->playerIndex != 0) {
|
||||||
bool levelAreaMismatch =
|
bool levelAreaMismatch = ((gNetworkPlayerLocal == NULL)
|
||||||
((gNetworkPlayerLocal == NULL)
|
|
||||||
|| np->currCourseNum != gNetworkPlayerLocal->currCourseNum
|
|| np->currCourseNum != gNetworkPlayerLocal->currCourseNum
|
||||||
|| np->currActNum != gNetworkPlayerLocal->currActNum
|
|| np->currActNum != gNetworkPlayerLocal->currActNum
|
||||||
|| np->currLevelNum != gNetworkPlayerLocal->currLevelNum
|
|| np->currLevelNum != gNetworkPlayerLocal->currLevelNum
|
||||||
|| np->currAreaIndex != gNetworkPlayerLocal->currAreaIndex);
|
|| np->currAreaIndex != gNetworkPlayerLocal->currAreaIndex);
|
||||||
|
|
||||||
if (!np->connected || levelAreaMismatch) {
|
if (!np->connected || levelAreaMismatch || !gNetworkAreaLoaded) {
|
||||||
gMarioState->marioObj->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
|
gMarioState->marioObj->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
|
||||||
gMarioState->marioObj->oIntangibleTimer = -1;
|
gMarioState->marioObj->oIntangibleTimer = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (np->fadeOpacity < 32) {
|
if (np->fadeOpacity < 32) {
|
||||||
if (!(gMarioState->flags & MARIO_TELEPORTING)) {
|
if (!(gMarioState->flags & MARIO_TELEPORTING)) {
|
||||||
np->fadeOpacity += 2;
|
np->fadeOpacity += 2;
|
||||||
|
@ -2118,7 +2118,8 @@ static void init_single_mario(struct MarioState* m) {
|
||||||
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
||||||
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
|
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
|
||||||
|
|
||||||
if (save_file_get_cap_pos(capPos)) {
|
// cap will never be lying on the ground in coop
|
||||||
|
/*if (save_file_get_cap_pos(capPos)) {
|
||||||
capObject = spawn_object(m->marioObj, MODEL_MARIOS_CAP, bhvNormalCap);
|
capObject = spawn_object(m->marioObj, MODEL_MARIOS_CAP, bhvNormalCap);
|
||||||
|
|
||||||
capObject->oPosX = capPos[0];
|
capObject->oPosX = capPos[0];
|
||||||
|
@ -2128,6 +2129,11 @@ static void init_single_mario(struct MarioState* m) {
|
||||||
capObject->oForwardVelS32 = 0;
|
capObject->oForwardVelS32 = 0;
|
||||||
|
|
||||||
capObject->oMoveAngleYaw = 0;
|
capObject->oMoveAngleYaw = 0;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// force all other players to be invisible by default
|
||||||
|
if (playerIndex != 0) {
|
||||||
|
m->marioObj->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set mario/luigi model
|
// set mario/luigi model
|
||||||
|
|
|
@ -205,6 +205,14 @@ void network_receive_player(struct Packet* p) {
|
||||||
struct MarioState* m = &gMarioStates[np->localIndex];
|
struct MarioState* m = &gMarioStates[np->localIndex];
|
||||||
if (m == NULL || m->marioObj == NULL) { return; }
|
if (m == NULL || m->marioObj == NULL) { return; }
|
||||||
|
|
||||||
|
// prevent receiving player from other area
|
||||||
|
bool levelAreaMismatch = ((gNetworkPlayerLocal == NULL)
|
||||||
|
|| np->currCourseNum != gNetworkPlayerLocal->currCourseNum
|
||||||
|
|| np->currActNum != gNetworkPlayerLocal->currActNum
|
||||||
|
|| np->currLevelNum != gNetworkPlayerLocal->currLevelNum
|
||||||
|
|| np->currAreaIndex != gNetworkPlayerLocal->currAreaIndex);
|
||||||
|
if (levelAreaMismatch) { return; }
|
||||||
|
|
||||||
// save previous state
|
// save previous state
|
||||||
struct PacketPlayerData oldData = { 0 };
|
struct PacketPlayerData oldData = { 0 };
|
||||||
read_packet_data(&oldData, m);
|
read_packet_data(&oldData, m);
|
||||||
|
|
Loading…
Reference in New Issue