mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-28 23:13:02 +00:00
reset mario state on player disconnect (#44)
fixes some mod related bugs
This commit is contained in:
parent
eaa1a59996
commit
2f5b0c4880
3 changed files with 7 additions and 2 deletions
|
@ -123,7 +123,7 @@ s16 set_character_animation(struct MarioState *m, s32 targetAnimID) {
|
||||||
struct Animation *targetAnim = m->animation->targetAnim;
|
struct Animation *targetAnim = m->animation->targetAnim;
|
||||||
s32 charAnimID = get_character_anim(m, targetAnimID);
|
s32 charAnimID = get_character_anim(m, targetAnimID);
|
||||||
if (!targetAnim) { return 0; }
|
if (!targetAnim) { return 0; }
|
||||||
|
|
||||||
if (load_patchable_table(m->animation, charAnimID)) {
|
if (load_patchable_table(m->animation, charAnimID)) {
|
||||||
targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
|
targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
|
||||||
targetAnim->index = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->index);
|
targetAnim->index = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->index);
|
||||||
|
@ -2379,7 +2379,7 @@ void init_mario(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_mario_single_from_save_file(struct MarioState* m, u16 index) {
|
void init_mario_single_from_save_file(struct MarioState* m, u16 index) {
|
||||||
if (!m) { return; }
|
if (!m) { return; }
|
||||||
m->playerIndex = index;
|
m->playerIndex = index;
|
||||||
m->flags = 0;
|
m->flags = 0;
|
||||||
|
|
|
@ -64,6 +64,7 @@ s32 execute_mario_action(UNUSED struct Object *o);
|
||||||
s32 force_idle_state(struct MarioState* m);
|
s32 force_idle_state(struct MarioState* m);
|
||||||
void init_single_mario(struct MarioState* m);
|
void init_single_mario(struct MarioState* m);
|
||||||
void init_mario(void);
|
void init_mario(void);
|
||||||
|
void init_mario_single_from_save_file(struct MarioState* m, u16 index);
|
||||||
void init_mario_from_save_file(void);
|
void init_mario_from_save_file(void);
|
||||||
void set_mario_particle_flags(struct MarioState* m, u32 flags, u8 clear);
|
void set_mario_particle_flags(struct MarioState* m, u32 flags, u8 clear);
|
||||||
void mario_update_wall(struct MarioState* m, struct WallCollisionData* wcd);
|
void mario_update_wall(struct MarioState* m, struct WallCollisionData* wcd);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#ifdef DISCORD_SDK
|
#ifdef DISCORD_SDK
|
||||||
#include "pc/discord/discord.h"
|
#include "pc/discord/discord.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "game/mario.h"
|
||||||
|
|
||||||
struct NetworkPlayer gNetworkPlayers[MAX_PLAYERS] = { 0 };
|
struct NetworkPlayer gNetworkPlayers[MAX_PLAYERS] = { 0 };
|
||||||
struct NetworkPlayer *gNetworkPlayerLocal = NULL;
|
struct NetworkPlayer *gNetworkPlayerLocal = NULL;
|
||||||
|
@ -374,6 +375,9 @@ u8 network_player_disconnected(u8 globalIndex) {
|
||||||
discord_activity_update();
|
discord_activity_update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// reset mario state
|
||||||
|
init_mario_single_from_save_file(&gMarioStates[i], i);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return UNKNOWN_GLOBAL_INDEX;
|
return UNKNOWN_GLOBAL_INDEX;
|
||||||
|
|
Loading…
Reference in a new issue