mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-22 16:30:23 +00:00
Resynchronized checkerboard platforms
This commit is contained in:
parent
d2a2a80d56
commit
a778bf497d
5 changed files with 37 additions and 6 deletions
|
@ -2307,7 +2307,9 @@ const BehaviorScript bhvCheckerboardElevatorGroup[] = {
|
|||
ID(id_bhvCheckerboardElevatorGroup),
|
||||
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
|
||||
CALL_NATIVE(bhv_checkerboard_elevator_group_init),
|
||||
DELAY(1),
|
||||
BEGIN_LOOP(),
|
||||
CALL_NATIVE(bhv_checkerboard_elevator_group_loop),
|
||||
END_LOOP(),
|
||||
DEACTIVATE(),
|
||||
};
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@ void bhv_flame_large_burning_out_init(void);
|
|||
void bhv_blue_fish_movement_loop(void);
|
||||
void bhv_tank_fish_group_loop(void);
|
||||
void bhv_checkerboard_elevator_group_init(void);
|
||||
void bhv_checkerboard_elevator_group_loop(void);
|
||||
void bhv_checkerboard_platform_init(void);
|
||||
void bhv_checkerboard_platform_loop(void);
|
||||
void bhv_bowser_key_unlock_door_loop(void);
|
||||
|
|
|
@ -4,6 +4,11 @@ struct Struct8032F754 D_8032F754[] = { { 145, { 0.7f, 1.5f, 0.7f }, 7.0f },
|
|||
{ 235, { 1.2f, 2.0f, 1.2f }, 11.6f } };
|
||||
|
||||
void bhv_checkerboard_elevator_group_init(void) {
|
||||
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
|
||||
struct SyncObject* so = network_init_object(o, 1000.0f);
|
||||
so->hasStandardFields = FALSE;
|
||||
so->maxUpdateRate = 5.0f;
|
||||
so->keepRandomSeed = TRUE;
|
||||
s32 sp3C;
|
||||
s32 sp38;
|
||||
s32 sp34;
|
||||
|
@ -23,9 +28,30 @@ void bhv_checkerboard_elevator_group_init(void) {
|
|||
bhvCheckerboardPlatformSub);
|
||||
sp2C->oCheckerBoardPlatformUnk1AC = D_8032F754[sp34].unk2;
|
||||
vec3f_copy_2(sp2C->header.gfx.scale, D_8032F754[sp34].unk1);
|
||||
|
||||
network_init_object_field(o, &sp2C->oMoveAnglePitch);
|
||||
network_init_object_field(o, &sp2C->oMoveAngleYaw);
|
||||
network_init_object_field(o, &sp2C->oFaceAnglePitch);
|
||||
network_init_object_field(o, &sp2C->oFaceAngleYaw);
|
||||
network_init_object_field(o, &sp2C->oAngleVelPitch);
|
||||
network_init_object_field(o, &sp2C->oAngleVelYaw);
|
||||
network_init_object_field(o, &sp2C->oForwardVel);
|
||||
network_init_object_field(o, &sp2C->oPosX);
|
||||
network_init_object_field(o, &sp2C->oPosY);
|
||||
network_init_object_field(o, &sp2C->oPosZ);
|
||||
network_init_object_field(o, &sp2C->oVelX);
|
||||
network_init_object_field(o, &sp2C->oVelY);
|
||||
network_init_object_field(o, &sp2C->oVelZ);
|
||||
network_init_object_field(o, &sp2C->oAction);
|
||||
network_init_object_field(o, &sp2C->oPrevAction);
|
||||
network_init_object_field(o, &sp2C->oTimer);
|
||||
network_init_object_field(o, &sp2C->oCheckerBoardPlatformUnkF8);
|
||||
network_init_object_field(o, &sp2C->oCheckerBoardPlatformUnkFC);
|
||||
}
|
||||
}
|
||||
|
||||
void bhv_checkerboard_elevator_group_loop(void) { }
|
||||
|
||||
void checkerboard_plat_act_move_y(UNUSED s32 unused, f32 vel, s32 a2) {
|
||||
o->oMoveAnglePitch = 0;
|
||||
o->oAngleVelPitch = 0;
|
||||
|
@ -45,10 +71,6 @@ void checkerboard_plat_act_rotate(s32 a0, s16 a1) {
|
|||
|
||||
void bhv_checkerboard_platform_init(void) {
|
||||
o->oCheckerBoardPlatformUnkFC = o->parentObj->oBehParams2ndByte;
|
||||
struct SyncObject* so = network_init_object(o, 1000.0f);
|
||||
so->fullObjectSync = TRUE;
|
||||
so->maxUpdateRate = 5.0f;
|
||||
so->keepRandomSeed = TRUE;
|
||||
}
|
||||
|
||||
void bhv_checkerboard_platform_loop(void) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define SYNC_DISTANCE_ONLY_EVENTS -2.0f
|
||||
#define SYNC_DISTANCE_INFINITE 0
|
||||
#define MAX_SYNC_OBJECTS 256
|
||||
#define MAX_SYNC_OBJECT_FIELDS 16
|
||||
#define MAX_SYNC_OBJECT_FIELDS 64
|
||||
#define PACKET_LENGTH 1024
|
||||
#define NETWORKTYPESTR (networkType == NT_CLIENT ? "Client" : "Server")
|
||||
|
||||
|
@ -52,6 +52,7 @@ struct SyncObject {
|
|||
bool fullObjectSync;
|
||||
bool keepRandomSeed;
|
||||
bool syncDeathEvent;
|
||||
bool hasStandardFields;
|
||||
float maxUpdateRate;
|
||||
u8 (*ignore_if_true)(struct Object*);
|
||||
void* extraFields[MAX_SYNC_OBJECT_FIELDS];
|
||||
|
|
|
@ -63,6 +63,7 @@ struct SyncObject* network_init_object(struct Object *o, float maxSyncDistance)
|
|||
so->txEventId = 0;
|
||||
so->fullObjectSync = false;
|
||||
so->keepRandomSeed = false;
|
||||
so->hasStandardFields = (maxSyncDistance >= 0);
|
||||
so->maxUpdateRate = 0;
|
||||
so->ignore_if_true = NULL;
|
||||
so->syncDeathEvent = true;
|
||||
|
@ -171,10 +172,12 @@ static void packet_write_object_standard_fields(struct Packet* p, struct Object*
|
|||
if (so->fullObjectSync) { return; }
|
||||
if (so->maxSyncDistance == SYNC_DISTANCE_ONLY_DEATH) { return; }
|
||||
if (so->maxSyncDistance == SYNC_DISTANCE_ONLY_EVENTS) { return; }
|
||||
if (!so->hasStandardFields) { return; }
|
||||
|
||||
// write the standard fields
|
||||
packet_write(p, &o->oPosX, sizeof(u32) * 7);
|
||||
packet_write(p, &o->oAction, sizeof(u32));
|
||||
packet_write(p, &o->oPrevAction, sizeof(u32));
|
||||
packet_write(p, &o->oSubAction, sizeof(u32));
|
||||
packet_write(p, &o->oInteractStatus, sizeof(u32));
|
||||
packet_write(p, &o->oHeldState, sizeof(u32));
|
||||
|
@ -189,10 +192,12 @@ static void packet_read_object_standard_fields(struct Packet* p, struct Object*
|
|||
if (so->fullObjectSync) { return; }
|
||||
if (so->maxSyncDistance == SYNC_DISTANCE_ONLY_DEATH) { return; }
|
||||
if (so->maxSyncDistance == SYNC_DISTANCE_ONLY_EVENTS) { return; }
|
||||
if (!so->hasStandardFields) { return; }
|
||||
|
||||
// read the standard fields
|
||||
packet_read(p, &o->oPosX, sizeof(u32) * 7);
|
||||
packet_read(p, &o->oAction, sizeof(u32));
|
||||
packet_read(p, &o->oPrevAction, sizeof(u32));
|
||||
packet_read(p, &o->oSubAction, sizeof(u32));
|
||||
packet_read(p, &o->oInteractStatus, sizeof(u32));
|
||||
packet_read(p, &o->oHeldState, sizeof(u32));
|
||||
|
|
Loading…
Reference in a new issue