Made death animations/warps a lot less janky
This commit is contained in:
parent
425a0ad0eb
commit
b87421dd9d
|
@ -2163,30 +2163,30 @@ void mario_process_interactions(struct MarioState *m) {
|
|||
}
|
||||
|
||||
void check_death_barrier(struct MarioState *m) {
|
||||
if (!gServerSettings.bubbleDeath) {
|
||||
if (m->pos[1] < m->floorHeight + 2048.0f) {
|
||||
if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_UNKNOWN_18)) {
|
||||
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (m->playerIndex != 0) { return; }
|
||||
|
||||
if (m->pos[1] < m->floorHeight + 2048.0f) {
|
||||
switch (gCurrCourseNum) {
|
||||
case COURSE_COTMC: // (20) Cavern of the Metal Cap
|
||||
case COURSE_TOTWC: // (21) Tower of the Wing Cap
|
||||
case COURSE_VCUTM: // (22) Vanish Cap Under the Moat
|
||||
case COURSE_WMOTR: // (23) Winged Mario over the Rainbow
|
||||
break;
|
||||
default:
|
||||
m->pos[1] = m->floorHeight + 2048.0f;
|
||||
if (m->vel[1] < 0) { m->vel[1] = 0; }
|
||||
mario_set_bubbled(m);
|
||||
return;
|
||||
if (mario_can_bubble(m)) {
|
||||
switch (gCurrCourseNum) {
|
||||
case COURSE_COTMC: // (20) Cavern of the Metal Cap
|
||||
case COURSE_TOTWC: // (21) Tower of the Wing Cap
|
||||
case COURSE_VCUTM: // (22) Vanish Cap Under the Moat
|
||||
case COURSE_WMOTR: // (23) Winged Mario over the Rainbow
|
||||
break;
|
||||
default:
|
||||
mario_set_bubbled(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (m->action == ACT_BUBBLED) {
|
||||
m->pos[1] = m->floorHeight + 2048.0f;
|
||||
if (m->vel[1] < 0) { m->vel[1] = 0; }
|
||||
return;
|
||||
}
|
||||
|
||||
if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_UNKNOWN_18)) {
|
||||
play_character_sound(m, CHAR_SOUND_WAAAOOOW);
|
||||
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "save_file.h"
|
||||
#include "sound_init.h"
|
||||
#include "thread6.h"
|
||||
#include "obj_behaviors.h"
|
||||
#include "pc/configfile.h"
|
||||
#include "pc/cheats.h"
|
||||
#include "pc/network/network.h"
|
||||
|
@ -394,6 +395,23 @@ void play_mario_sound(struct MarioState *m, s32 actionSound, s32 marioSound) {
|
|||
* ACTIONS *
|
||||
**************************************************/
|
||||
|
||||
bool mario_can_bubble(struct MarioState* m) {
|
||||
if (!gServerSettings.bubbleDeath) { return false; }
|
||||
if (m->playerIndex != 0) { return false; }
|
||||
if (m->action == ACT_BUBBLED) { return false; }
|
||||
|
||||
u8 allInBubble = TRUE;
|
||||
for (int i = 1; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].action != ACT_BUBBLED && gMarioStates[i].health >= 0x100) {
|
||||
allInBubble = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allInBubble) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
void mario_set_bubbled(struct MarioState* m) {
|
||||
if (m->playerIndex != 0) { return; }
|
||||
if (m->action == ACT_BUBBLED) { return; }
|
||||
|
|
|
@ -27,6 +27,7 @@ void play_mario_landing_sound_once(struct MarioState *m, u32 soundBits);
|
|||
void play_mario_heavy_landing_sound(struct MarioState *m, u32 soundBits);
|
||||
void play_mario_heavy_landing_sound_once(struct MarioState *m, u32 soundBits);
|
||||
void play_mario_sound(struct MarioState *m, s32 primarySoundBits, s32 scondarySoundBits);
|
||||
bool mario_can_bubble(struct MarioState* m);
|
||||
void mario_set_bubbled(struct MarioState* m);
|
||||
void mario_set_forward_vel(struct MarioState *m, f32 speed);
|
||||
s32 mario_get_floor_class(struct MarioState *m);
|
||||
|
|
|
@ -1569,13 +1569,11 @@ s32 act_lava_boost(struct MarioState *m) {
|
|||
if (m != &gMarioStates[0]) {
|
||||
// never kill remote marios
|
||||
m->health = 0x100;
|
||||
} else if (mario_can_bubble(m)) {
|
||||
m->health = 0xFF;
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
m->health = 0xFF;
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
}
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -945,7 +945,7 @@ s32 act_bubbled(struct MarioState* m) {
|
|||
}
|
||||
if (allInBubble) {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
return set_mario_action(m, ACT_DEATH_ON_BACK, 0);
|
||||
return set_mario_action(m, ACT_SOFT_BONK, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -762,7 +762,9 @@ s32 act_fall_after_star_grab(struct MarioState *m) {
|
|||
s32 common_death_handler(struct MarioState *m, s32 animation, s32 frameToDeathWarp) {
|
||||
s32 animFrame = set_mario_animation(m, animation);
|
||||
if (animFrame == frameToDeathWarp) {
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
if (m->playerIndex != 0) {
|
||||
// do nothing
|
||||
} else if (mario_can_bubble(m)) {
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
|
@ -825,7 +827,9 @@ s32 act_quicksand_death(struct MarioState *m) {
|
|||
play_character_sound_if_no_flag(m, CHAR_SOUND_WAAAOOOW, MARIO_MARIO_SOUND_PLAYED);
|
||||
}
|
||||
if ((m->quicksandDepth += 5.0f) >= 180.0f) {
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
if (m->playerIndex != 0) {
|
||||
// do nothing
|
||||
} else if (mario_can_bubble(m)) {
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
|
@ -841,18 +845,14 @@ s32 act_quicksand_death(struct MarioState *m) {
|
|||
s32 act_eaten_by_bubba(struct MarioState *m) {
|
||||
play_character_sound_if_no_flag(m, CHAR_SOUND_DYING, MARIO_ACTION_SOUND_PLAYED);
|
||||
set_mario_animation(m, MARIO_ANIM_A_POSE);
|
||||
if (m != &gMarioStates[0]) {
|
||||
// never kill remote marios
|
||||
m->health = 0x100;
|
||||
}
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
if (m->playerIndex == 0) {
|
||||
|
||||
if (m->actionTimer++ == 60) {
|
||||
if (m->playerIndex != 0) {
|
||||
// do nothing
|
||||
} else if (mario_can_bubble(m)) {
|
||||
m->health = 0xFF;
|
||||
mario_set_bubbled(m);
|
||||
}
|
||||
} else {
|
||||
m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
if (m->actionTimer++ == 60) {
|
||||
} else {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
}
|
||||
}
|
||||
|
@ -1717,19 +1717,15 @@ s32 act_squished(struct MarioState *m) {
|
|||
|
||||
// squished for more than 10 seconds, so kill Mario
|
||||
if (m->actionArg++ > 300) {
|
||||
// 0 units of health
|
||||
if (m != &gMarioStates[0]) {
|
||||
if (m->playerIndex != 0) {
|
||||
// never kill remote marios
|
||||
m->health = 0x100;
|
||||
} else if (gServerSettings.bubbleDeath) {
|
||||
m->health = 0xFF;
|
||||
}
|
||||
|
||||
m->hurtCounter = 0;
|
||||
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
} else if (mario_can_bubble(m)) {
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
// 0 units of health
|
||||
m->health = 0x00FF;
|
||||
m->hurtCounter = 0;
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
// woosh, he's gone!
|
||||
set_mario_action(m, ACT_DISAPPEARED, 0);
|
||||
|
|
|
@ -928,7 +928,9 @@ static s32 act_drowning(struct MarioState *m) {
|
|||
set_mario_animation(m, MARIO_ANIM_DROWNING_PART2);
|
||||
m->marioBodyState->eyeState = MARIO_EYES_DEAD;
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 30) {
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
if (m->playerIndex != 0) {
|
||||
// do nothing
|
||||
} else if (mario_can_bubble(m)) {
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
|
@ -954,7 +956,9 @@ static s32 act_water_death(struct MarioState *m) {
|
|||
|
||||
set_mario_animation(m, MARIO_ANIM_WATER_DYING);
|
||||
if (set_mario_animation(m, MARIO_ANIM_WATER_DYING) == 35) {
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
if (m->playerIndex != 0) {
|
||||
// do nothing
|
||||
} else if (mario_can_bubble(m)) {
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
|
@ -1065,7 +1069,9 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) {
|
|||
if ((marioObj->oMarioWhirlpoolPosY += m->vel[1]) < 0.0f) {
|
||||
marioObj->oMarioWhirlpoolPosY = 0.0f;
|
||||
if (distance < 16.1f && m->actionTimer++ == 16) {
|
||||
if (gServerSettings.bubbleDeath) {
|
||||
if (m->playerIndex != 0) {
|
||||
// do nothing
|
||||
} else if (mario_can_bubble(m)) {
|
||||
mario_set_bubbled(m);
|
||||
} else {
|
||||
level_trigger_warp(m, WARP_OP_DEATH);
|
||||
|
|
|
@ -45,7 +45,7 @@ static void debug_warp_level1() {
|
|||
}
|
||||
|
||||
static void debug_warp_level2() {
|
||||
dynos_warp_to_level(LEVEL_BOWSER_2, 1, 1);
|
||||
dynos_warp_to_level(LEVEL_WF, 1, 1);
|
||||
}
|
||||
|
||||
static void debug_grand_star(void) {
|
||||
|
|
Loading…
Reference in New Issue