mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Fixed knockback direction
This commit is contained in:
parent
1d7dfe4d3c
commit
bf435d5aa9
6 changed files with 28 additions and 9 deletions
|
@ -382,6 +382,7 @@ struct MarioState
|
|||
/*????*/ u8 wasNetworkVisible;
|
||||
/*????*/ f32 minimumBoneY;
|
||||
/*????*/ f32 curAnimOffset;
|
||||
/*????*/ u8 knockbackTimer;
|
||||
};
|
||||
|
||||
struct TextureInfo
|
||||
|
|
|
@ -694,9 +694,14 @@ u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
|
|||
f32 mag = scaler * (f32)gServerSettings.playerKnockbackStrength * sign;
|
||||
m->forwardVel = mag;
|
||||
if (sign > 0 && terrainIndex == 1) { mag *= -1.0f; }
|
||||
|
||||
m->vel[0] = -mag * sins(m->interactObj->oFaceAngleYaw);
|
||||
m->vel[1] = (mag < 0) ? -mag : mag;
|
||||
m->vel[2] = -mag * coss(m->interactObj->oFaceAngleYaw);
|
||||
m->slideVelX = m->vel[0];
|
||||
m->slideVelZ = m->vel[2];
|
||||
m->knockbackTimer = 3;
|
||||
|
||||
m->faceAngle[1] = m->interactObj->oFaceAngleYaw + (sign == 1.0f ? 0 : 0x8000);
|
||||
}
|
||||
|
||||
|
|
|
@ -1903,6 +1903,11 @@ static u8 prevent_hang(u32 hangPreventionActions[], u8* hangPreventionIndex) {
|
|||
*/
|
||||
s32 execute_mario_action(UNUSED struct Object *o) {
|
||||
s32 inLoop = TRUE;
|
||||
|
||||
if (gMarioState->knockbackTimer > 0) {
|
||||
gMarioState->knockbackTimer--;
|
||||
}
|
||||
|
||||
// hide inactive players
|
||||
struct NetworkPlayer *np = &gNetworkPlayers[gMarioState->playerIndex];
|
||||
if (gMarioState->playerIndex != 0) {
|
||||
|
|
|
@ -1105,9 +1105,13 @@ u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFall
|
|||
f32 speed) {
|
||||
u32 stepResult;
|
||||
|
||||
if (m->knockbackTimer == 0) {
|
||||
if (m->interactObj == NULL || !(m->interactObj->oInteractType & INTERACT_PLAYER)) {
|
||||
mario_set_forward_vel(m, speed);
|
||||
}
|
||||
} else {
|
||||
m->knockbackTimer = 3;
|
||||
}
|
||||
|
||||
stepResult = perform_air_step(m, 0);
|
||||
switch (stepResult) {
|
||||
|
|
|
@ -1615,6 +1615,7 @@ s32 common_ground_knockback_action(struct MarioState *m, s32 animation, s32 arg2
|
|||
#endif
|
||||
}
|
||||
|
||||
if (m->knockbackTimer == 0) {
|
||||
if (m->interactObj == NULL || !(m->interactObj->oInteractType & INTERACT_PLAYER)) {
|
||||
if (m->forwardVel > 32.0f) {
|
||||
m->forwardVel = 32.0f;
|
||||
|
@ -1623,6 +1624,9 @@ s32 common_ground_knockback_action(struct MarioState *m, s32 animation, s32 arg2
|
|||
m->forwardVel = -32.0f;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m->knockbackTimer = 3;
|
||||
}
|
||||
|
||||
animFrame = set_mario_animation(m, animation);
|
||||
if (animFrame < arg2) {
|
||||
|
|
|
@ -15,7 +15,7 @@ static void djui_panel_host_settings_knockback_change(UNUSED struct DjuiBase* ca
|
|||
switch (sKnockbackIndex) {
|
||||
case 0: configPlayerKnockbackStrength = 10; break;
|
||||
case 1: configPlayerKnockbackStrength = 25; break;
|
||||
default: configPlayerKnockbackStrength = 75; break;
|
||||
default: configPlayerKnockbackStrength = 60; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue