mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Resynchronized platform_on_track to prevent crash
This commit is contained in:
parent
394d1970c5
commit
a924f7977b
1 changed files with 25 additions and 3 deletions
|
@ -48,15 +48,37 @@ static void platform_on_track_mario_not_on_platform(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static u32 platformTrackPathedPrevWaypoint = 0;
|
||||
|
||||
static void bhv_platform_track_on_received_post(UNUSED u8 fromLocalIndex) {
|
||||
if (o->oPathedStartWaypoint == NULL) { return; }
|
||||
o->oPathedPrevWaypoint = (struct Waypoint*)o->oPathedStartWaypoint + platformTrackPathedPrevWaypoint;
|
||||
}
|
||||
|
||||
static void bhv_platform_track_on_sent_pre(void) {
|
||||
if (o->oPathedStartWaypoint == NULL) { platformTrackPathedPrevWaypoint = 0; return; }
|
||||
platformTrackPathedPrevWaypoint = ((u8*)o->oPathedPrevWaypoint - (u8*)o->oPathedStartWaypoint) / sizeof(struct Waypoint*);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init function for bhvPlatformOnTrack.
|
||||
*/
|
||||
void bhv_platform_on_track_init(void) {
|
||||
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
struct SyncObject* so = network_init_object(o, 1000.0f);
|
||||
so->fullObjectSync = TRUE;
|
||||
if (so != NULL) {
|
||||
so->on_sent_pre = bhv_platform_track_on_sent_pre;
|
||||
so->on_received_post = bhv_platform_track_on_received_post;
|
||||
so->maxUpdateRate = 5.0f;
|
||||
network_init_object_field(o, &platformTrackPathedPrevWaypoint);
|
||||
network_init_object_field(o, &o->oPlatformOnTrackBaseBallIndex);
|
||||
network_init_object_field(o, &o->oPlatformOnTrackDistMovedSinceLastBall);
|
||||
network_init_object_field(o, &o->oPlatformOnTrackSkiLiftRollVel);
|
||||
network_init_object_field(o, &o->oPlatformOnTrackPrevWaypointFlags);
|
||||
network_init_object_field(o, &o->oPlatformOnTrackPitch);
|
||||
network_init_object_field(o, &o->oPlatformOnTrackYaw);
|
||||
network_init_object_field(o, &o->oPlatformOnTrackOffsetY);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)) {
|
||||
|
|
Loading…
Reference in a new issue