From 55bbe8d4d9cf9bf291b83742b7a2e4f14c12621b Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 13 Oct 2020 22:26:13 -0700 Subject: [PATCH] Removed two-player hacks for heldObj and spawning offsets --- src/game/mario.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/game/mario.c b/src/game/mario.c index ad46e044..ea64b7d9 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -1927,9 +1927,10 @@ s32 execute_mario_action(UNUSED struct Object *o) { if (gMarioState->freeze < 2 && sCurrPlayMode == PLAY_MODE_PAUSED) { gMarioState->freeze = 2; } } - // two-player hack: drop held object if server is holding it - if (gNetworkType == NT_CLIENT && gMarioState->playerIndex == 0 && gMarioState->heldObj != NULL) { + // drop held object if someone else is holding it + if (gMarioState->playerIndex == 0 && gMarioState->heldObj != NULL) { u8 inCutscene = ((gMarioState->action & ACT_GROUP_MASK) != ACT_GROUP_CUTSCENE); + u8 higherPriorityPlayerHolding = FALSE; if (!inCutscene && gMarioState->heldObj->heldByPlayerIndex != 0) { drop_and_set_mario_action(gMarioState, ACT_IDLE, 0); } @@ -2073,17 +2074,14 @@ static void init_single_mario(struct MarioState* m) { vec3s_to_vec3f(m->pos, spawnInfo->startPos); vec3f_set(m->vel, 0, 0, 0); - // two-player hack - u8 isLocal = (m->playerIndex == 0); - f32 spawnAngle = m->faceAngle[1] + 0x4000; - if ((gNetworkType == NT_CLIENT && isLocal) || (gNetworkType == NT_SERVER && !isLocal)) { - m->pos[0] += 60.0f * sins(spawnAngle); - m->pos[2] += 60.0f * coss(spawnAngle); - } - else { - m->pos[0] -= 60.0f * sins(spawnAngle); - m->pos[2] -= 60.0f * coss(spawnAngle); - } + // offset spawning + u8 connectedPlayers = network_player_connected_count(); + u8 globalIndex = gNetworkPlayers[m->playerIndex].globalIndex; + u16 spawnAngle = m->faceAngle[1] + 0x4000 + 0x10000 * ((f32)globalIndex / ((f32)connectedPlayers + 1)); + f32 spawnMag = 60.0f * ((connectedPlayers + 1) / 2.0f); + if (spawnMag > 120) { spawnMag = 120; } + m->pos[0] -= spawnMag * sins(spawnAngle); + m->pos[2] -= spawnMag * coss(spawnAngle); m->floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &m->floor);