mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Fix first sound and size of first punch
The code was skipping playing the sound of the first punch, and changing the size of the first for the first punch. Added hacky stuff to the player packet code to ensure those events are hit. Fixes #10 reported by somario360
This commit is contained in:
parent
f62f80a228
commit
72c4379d8a
2 changed files with 27 additions and 14 deletions
|
|
@ -40,20 +40,12 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
|
|||
case 0:
|
||||
play_sound(SOUND_MARIO_PUNCH_YAH, m->marioObj->header.gfx.cameraToObject);
|
||||
// Fall-through:
|
||||
case 99:
|
||||
// Fall-through:
|
||||
case 1:
|
||||
set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH);
|
||||
if (is_anim_past_end(m)) {
|
||||
m->actionArg = 2;
|
||||
} else {
|
||||
if (m->actionArg == 1 && m->playerIndex != 0) {
|
||||
// hack: play remote YAH punch sound, gets skipped without this
|
||||
play_sound(SOUND_MARIO_PUNCH_YAH, m->marioObj->header.gfx.cameraToObject);
|
||||
m->actionArg = 99;
|
||||
} else {
|
||||
m->actionArg = 1;
|
||||
}
|
||||
m->actionArg = 1;
|
||||
}
|
||||
|
||||
if (m->marioObj->header.gfx.unk38.animFrame >= 2) {
|
||||
|
|
|
|||
|
|
@ -33,12 +33,16 @@ void network_send_player(void) {
|
|||
|
||||
void network_receive_player(struct Packet* p) {
|
||||
if (gMarioStates[1].marioObj == NULL) { return; }
|
||||
int oldActionState = gMarioStates[1].actionState;
|
||||
|
||||
// save previous state
|
||||
u32 heldSyncID = NULL;
|
||||
u32 heldBySyncID = NULL;
|
||||
|
||||
u16 playerIndex = gMarioStates[1].playerIndex;
|
||||
u32 oldAction = gMarioStates[1].action;
|
||||
u16 oldActionState = gMarioStates[1].actionState;
|
||||
u16 oldActionArg = gMarioStates[1].actionArg;
|
||||
u16 playerIndex = gMarioStates[1].playerIndex;
|
||||
|
||||
// load mario information from packet
|
||||
packet_read(p, &gMarioStates[1], sizeof(u32) * 24);
|
||||
packet_read(p, gMarioStates[1].controller, 20);
|
||||
packet_read(p, &gMarioStates[1].marioObj->rawData.asU32, sizeof(u32) * 80);
|
||||
|
|
@ -49,14 +53,18 @@ void network_receive_player(struct Packet* p) {
|
|||
packet_read(p, &gMarioStates[1].actionArg, sizeof(u32));
|
||||
packet_read(p, &gMarioStates[1].currentRoom, sizeof(s16));
|
||||
packet_read(p, &gMarioStates[1].squishTimer, sizeof(u8));
|
||||
|
||||
packet_read(p, &heldSyncID, sizeof(u32));
|
||||
packet_read(p, &heldBySyncID, sizeof(u32));
|
||||
|
||||
// reset player index
|
||||
gMarioStates[1].playerIndex = playerIndex;
|
||||
|
||||
// reset mario sound play flag so that their jump sounds work
|
||||
if (gMarioStates[1].action != oldAction) {
|
||||
gMarioStates[1].flags &= ~(MARIO_ACTION_SOUND_PLAYED | MARIO_MARIO_SOUND_PLAYED);
|
||||
}
|
||||
|
||||
// find and set their held object
|
||||
if (heldSyncID != NULL && syncObjects[heldSyncID].o != NULL) {
|
||||
// TODO: do we have to move graphics nodes around to make this visible?
|
||||
struct Object* heldObj = syncObjects[heldSyncID].o;
|
||||
|
|
@ -67,6 +75,7 @@ void network_receive_player(struct Packet* p) {
|
|||
gMarioStates[1].heldObj = NULL;
|
||||
}
|
||||
|
||||
// find and set their held-by object
|
||||
if (heldBySyncID != NULL && syncObjects[heldBySyncID].o != NULL) {
|
||||
// TODO: do we have to move graphics nodes around to make this visible?
|
||||
gMarioStates[1].heldByObj = syncObjects[heldBySyncID].o;
|
||||
|
|
@ -74,11 +83,23 @@ void network_receive_player(struct Packet* p) {
|
|||
gMarioStates[1].heldByObj = NULL;
|
||||
}
|
||||
|
||||
// restore action state, needed for jump kicking
|
||||
// jump kicking: restore action state, otherwise it won't play
|
||||
if (gMarioStates[1].action == ACT_JUMP_KICK) {
|
||||
gMarioStates[1].actionState = oldActionState;
|
||||
}
|
||||
|
||||
// punching:
|
||||
if ((gMarioStates[1].action == ACT_PUNCHING || gMarioStates[1].action == ACT_MOVE_PUNCHING)) {
|
||||
// play first punching sound, otherwise it will be missed
|
||||
if (gMarioStates[1].action != oldAction) {
|
||||
play_sound(SOUND_MARIO_PUNCH_YAH, gMarioStates[1].marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
// make the first punch large, otherwise it will be missed
|
||||
if (gMarioStates[1].actionArg == 2 && oldActionArg == 1) {
|
||||
gMarioStates[1].marioBodyState->punchState = (0 << 6) | 4;
|
||||
}
|
||||
}
|
||||
|
||||
// mute snoring
|
||||
if (oldAction == ACT_SLEEPING && gMarioStates[1].action != ACT_SLEEPING) {
|
||||
func_803205E8(SOUND_MARIO_SNORING1, gMarioStates[1].marioObj->header.gfx.cameraToObject);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue