diff --git a/.gitignore b/.gitignore index c017da149..64c56cceb 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,6 @@ sm64config.txt # visual studio build-windows-visual-studio/.vs + +# misc +todo.txt \ No newline at end of file diff --git a/src/game/behaviors/recovery_heart.inc.c b/src/game/behaviors/recovery_heart.inc.c index 6bebfaa34..341b97ddd 100644 --- a/src/game/behaviors/recovery_heart.inc.c +++ b/src/game/behaviors/recovery_heart.inc.c @@ -12,14 +12,21 @@ struct ObjectHitbox sRecoveryHeartHitbox = { }; void bhv_recovery_heart_loop(void) { + u8 collided = FALSE; obj_set_hitbox(o, &sRecoveryHeartHitbox); - if (obj_check_if_collided_with_object(o, gMarioObject)) { + + for (int i = 0; i < MAX_PLAYERS; i++) { + if (obj_check_if_collided_with_object(o, gMarioStates[i].marioObj)) { collided = TRUE; } + } + + if (collided) { if (o->oSpinningHeartPlayedSound == 0) { cur_obj_play_sound_2(SOUND_GENERAL_HEART_SPIN); o->oSpinningHeartPlayedSound += 1; } - o->oAngleVelYaw = (s32)(200.0f * gMarioStates[0].forwardVel) + 1000; + struct MarioState* marioState = nearest_mario_state_to_object(o); + o->oAngleVelYaw = (s32)(200.0f * marioState->forwardVel) + 1000; } else { o->oSpinningHeartPlayedSound = 0; @@ -30,7 +37,13 @@ void bhv_recovery_heart_loop(void) { } if ((o->oSpinningHeartTotalSpin += o->oAngleVelYaw) >= 0x10000) { - gMarioStates[0].healCounter += 4; + + struct MarioState* nearestState = nearest_mario_state_to_object(o); + for (int i = 0; i < MAX_PLAYERS; i++) { + if (&gMarioState[i] == nearestState || dist_between_objects(o, gMarioState[i].marioObj) < 1000) { + gMarioStates[i].healCounter += 4; + } + } o->oSpinningHeartTotalSpin -= 0x10000; } diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c index 456f89b79..ed81817b3 100644 --- a/src/pc/network/packets/packet_player.c +++ b/src/pc/network/packets/packet_player.c @@ -28,7 +28,7 @@ void network_receive_player(struct Packet* p) { packet_read(p, &gMarioStates[1], 96); packet_read(p, gMarioStates[1].controller, 20); packet_read(p, &gMarioStates[1].marioObj->rawData.asU32, 320); - packet_write(p, &gMarioStates[1].health, 2); + packet_read(p, &gMarioStates[1].health, 2); packet_read(p, &heldSyncID, 4); if (heldSyncID != NULL) {