Made bubble-on-death a server setting

This commit is contained in:
MysterD 2022-01-14 20:33:06 -08:00
parent 625e9b5df9
commit 6a1ceab5ca
11 changed files with 78 additions and 27 deletions

View file

@ -2130,6 +2130,15 @@ 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->pos[1] < m->floorHeight + 2048.0f) {
switch (gCurrCourseNum) {
case COURSE_COTMC: // (20) Cavern of the Metal Cap

View file

@ -421,9 +421,11 @@ void init_mario_after_warp(void) {
}
// enforce bubble on area change
if (i == 0 && gMarioStates[i].numLives == -1) {
mario_set_bubbled(&gMarioStates[i]);
gMarioStates[i].health = 0xFF;
if (gServerSettings.bubbleDeath) {
if (i == 0 && gMarioStates[i].numLives == -1) {
mario_set_bubbled(&gMarioStates[i]);
gMarioStates[i].health = 0xFF;
}
}
}

View file

@ -1568,8 +1568,12 @@ s32 act_lava_boost(struct MarioState *m) {
// never kill remote marios
m->health = 0x100;
} else {
m->health = 0xFF;
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
m->health = 0xFF;
mario_set_bubbled(m);
} else {
level_trigger_warp(m, WARP_OP_DEATH);
}
}
}

View file

@ -763,8 +763,11 @@ 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) {
//level_trigger_warp(m, WARP_OP_DEATH);
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
mario_set_bubbled(m);
} else {
level_trigger_warp(m, WARP_OP_DEATH);
}
}
m->marioBodyState->eyeState = MARIO_EYES_DEAD;
stop_and_set_height_to_floor(m);
@ -823,8 +826,11 @@ 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) {
//level_trigger_warp(m, WARP_OP_DEATH);
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
mario_set_bubbled(m);
} else {
level_trigger_warp(m, WARP_OP_DEATH);
}
m->actionState = 2;
}
}
@ -836,15 +842,20 @@ 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);
//m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
if (m != &gMarioStates[0]) {
// never kill remote marios
m->health = 0x100;
} else {
m->health = 0xFF;
}
if (m->playerIndex == 0) {
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
if (m->playerIndex == 0) {
m->health = 0xFF;
mario_set_bubbled(m);
}
} else {
m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
if (m->actionTimer++ == 60) {
level_trigger_warp(m, WARP_OP_DEATH);
}
}
return FALSE;
@ -1714,15 +1725,19 @@ s32 act_squished(struct MarioState *m) {
if (m != &gMarioStates[0]) {
// never kill remote marios
m->health = 0x100;
} else {
} else if (gServerSettings.bubbleDeath) {
m->health = 0xFF;
}
m->hurtCounter = 0;
//level_trigger_warp(m, WARP_OP_DEATH);
// woosh, he's gone!
//set_mario_action(m, ACT_DISAPPEARED, 0);
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
mario_set_bubbled(m);
} else {
level_trigger_warp(m, WARP_OP_DEATH);
// woosh, he's gone!
set_mario_action(m, ACT_DISAPPEARED, 0);
}
}
stop_and_set_height_to_floor(m);
set_mario_animation(m, MARIO_ANIM_A_POSE);

View file

@ -924,8 +924,11 @@ 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.unk38.animFrame == 30) {
//level_trigger_warp(m, WARP_OP_DEATH);
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
mario_set_bubbled(m);
} else {
level_trigger_warp(m, WARP_OP_DEATH);
}
}
break;
}
@ -945,8 +948,11 @@ 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) {
//level_trigger_warp(m, WARP_OP_DEATH);
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
mario_set_bubbled(m);
} else {
level_trigger_warp(m, WARP_OP_DEATH);
}
}
return FALSE;
@ -1053,8 +1059,11 @@ 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) {
//level_trigger_warp(m, WARP_OP_DEATH);
mario_set_bubbled(m);
if (gServerSettings.bubbleDeath) {
mario_set_bubbled(m);
} else {
level_trigger_warp(m, WARP_OP_DEATH);
}
}
}

View file

@ -94,6 +94,7 @@ bool configCameraMouse = false;
bool configSkipIntro = 0;
bool configShareLives = 0;
bool configEnableCheats = 0;
bool configBubbleDeath = true;
bool configHUD = true;
#ifdef DISCORDRPC
bool configDiscordRPC = true;
@ -160,6 +161,7 @@ static const struct ConfigOption options[] = {
{.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro},
{.name = "share_lives", .type = CONFIG_TYPE_BOOL, .boolValue = &configShareLives},
{.name = "enable_cheats", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCheats},
{.name = "bubble_death", .type = CONFIG_TYPE_BOOL, .boolValue = &configBubbleDeath},
#ifdef DISCORDRPC
{.name = "discordrpc_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configDiscordRPC},
#endif

View file

@ -63,6 +63,7 @@ extern bool configHUD;
extern bool configSkipIntro;
extern bool configShareLives;
extern bool configEnableCheats;
extern bool configBubbleDeath;
#ifdef DISCORDRPC
extern bool configDiscordRPC;
#endif

View file

@ -60,9 +60,9 @@ static void djui_panel_host_do_host(struct DjuiBase* caller) {
void djui_panel_host_create(struct DjuiBase* caller) {
#ifdef DISCORD_SDK
f32 bodyHeight = 32 * 7 + 64 * 2 + 16 * 9;
f32 bodyHeight = 32 * 8 + 64 * 2 + 16 * 10;
#else
f32 bodyHeight = 32 * 6 + 64 * 2 + 16 * 8;
f32 bodyHeight = 32 * 7 + 64 * 2 + 16 * 9;
#endif
struct DjuiBase* defaultBase = NULL;
@ -152,6 +152,10 @@ void djui_panel_host_create(struct DjuiBase* caller) {
djui_base_set_size_type(&checkbox4->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox4->base, 1.0f, 32);
struct DjuiCheckbox* checkbox5 = djui_checkbox_create(&body->base, "Bubble on death", &configBubbleDeath);
djui_base_set_size_type(&checkbox5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox5->base, 1.0f, 32);
struct DjuiRect* rect3 = djui_rect_create(&body->base);
djui_base_set_size_type(&rect3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&rect3->base, 1.0f, 64);

View file

@ -42,6 +42,7 @@ struct ServerSettings gServerSettings = {
.skipIntro = 0,
.shareLives = 0,
.enableCheats = 0,
.bubbleDeath = 1,
};
void network_set_system(enum NetworkSystemType nsType) {
@ -68,6 +69,7 @@ bool network_init(enum NetworkType inNetworkType) {
gServerSettings.skipIntro = configSkipIntro;
gServerSettings.shareLives = configShareLives;
gServerSettings.enableCheats = configEnableCheats;
gServerSettings.bubbleDeath = configBubbleDeath;
Cheats.EnableCheats = gServerSettings.enableCheats;
// initialize the network system

View file

@ -88,6 +88,7 @@ struct ServerSettings {
u8 skipIntro;
u8 shareLives;
u8 enableCheats;
u8 bubbleDeath;
};
// Networking-specific externs

View file

@ -92,6 +92,7 @@ void network_send_join(struct Packet* joinRequestPacket) {
packet_write(&p, &gServerSettings.skipIntro, sizeof(u8));
packet_write(&p, &gServerSettings.shareLives, sizeof(u8));
packet_write(&p, &gServerSettings.enableCheats, sizeof(u8));
packet_write(&p, &gServerSettings.bubbleDeath, sizeof(u8));
packet_write(&p, eeprom, sizeof(u8) * 512);
u8 modCount = string_linked_list_count(&gRegisteredMods);
@ -153,6 +154,7 @@ void network_receive_join(struct Packet* p) {
packet_read(p, &gServerSettings.skipIntro, sizeof(u8));
packet_read(p, &gServerSettings.shareLives, sizeof(u8));
packet_read(p, &gServerSettings.enableCheats, sizeof(u8));
packet_read(p, &gServerSettings.bubbleDeath, sizeof(u8));
packet_read(p, eeprom, sizeof(u8) * 512);
packet_read(p, &modCount, sizeof(u8));