Removed two-player hacks for heldObj and spawning offsets

This commit is contained in:
MysterD 2020-10-13 22:26:13 -07:00
parent c8a45235ca
commit 55bbe8d4d9

View file

@ -1927,9 +1927,10 @@ s32 execute_mario_action(UNUSED struct Object *o) {
if (gMarioState->freeze < 2 && sCurrPlayMode == PLAY_MODE_PAUSED) { gMarioState->freeze = 2; } if (gMarioState->freeze < 2 && sCurrPlayMode == PLAY_MODE_PAUSED) { gMarioState->freeze = 2; }
} }
// two-player hack: drop held object if server is holding it // drop held object if someone else is holding it
if (gNetworkType == NT_CLIENT && gMarioState->playerIndex == 0 && gMarioState->heldObj != NULL) { if (gMarioState->playerIndex == 0 && gMarioState->heldObj != NULL) {
u8 inCutscene = ((gMarioState->action & ACT_GROUP_MASK) != ACT_GROUP_CUTSCENE); u8 inCutscene = ((gMarioState->action & ACT_GROUP_MASK) != ACT_GROUP_CUTSCENE);
u8 higherPriorityPlayerHolding = FALSE;
if (!inCutscene && gMarioState->heldObj->heldByPlayerIndex != 0) { if (!inCutscene && gMarioState->heldObj->heldByPlayerIndex != 0) {
drop_and_set_mario_action(gMarioState, ACT_IDLE, 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); vec3s_to_vec3f(m->pos, spawnInfo->startPos);
vec3f_set(m->vel, 0, 0, 0); vec3f_set(m->vel, 0, 0, 0);
// two-player hack // offset spawning
u8 isLocal = (m->playerIndex == 0); u8 connectedPlayers = network_player_connected_count();
f32 spawnAngle = m->faceAngle[1] + 0x4000; u8 globalIndex = gNetworkPlayers[m->playerIndex].globalIndex;
if ((gNetworkType == NT_CLIENT && isLocal) || (gNetworkType == NT_SERVER && !isLocal)) { u16 spawnAngle = m->faceAngle[1] + 0x4000 + 0x10000 * ((f32)globalIndex / ((f32)connectedPlayers + 1));
m->pos[0] += 60.0f * sins(spawnAngle); f32 spawnMag = 60.0f * ((connectedPlayers + 1) / 2.0f);
m->pos[2] += 60.0f * coss(spawnAngle); if (spawnMag > 120) { spawnMag = 120; }
} m->pos[0] -= spawnMag * sins(spawnAngle);
else { m->pos[2] -= spawnMag * coss(spawnAngle);
m->pos[0] -= 60.0f * sins(spawnAngle);
m->pos[2] -= 60.0f * coss(spawnAngle);
}
m->floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &m->floor); m->floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &m->floor);