mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-22 16:30:23 +00:00
Synchronize various LLL platforms
This commit is contained in:
parent
0052e97605
commit
fdee4eceea
14 changed files with 135 additions and 60 deletions
|
@ -4603,6 +4603,7 @@ const BehaviorScript bhvLllDrawbridgeSpawner[] = {
|
|||
BEGIN(OBJ_LIST_DEFAULT),
|
||||
ID(id_bhvLllDrawbridgeSpawner),
|
||||
HIDE(),
|
||||
CALL_NATIVE(bhv_lll_drawbridge_spawner_init),
|
||||
BEGIN_LOOP(),
|
||||
CALL_NATIVE(bhv_lll_drawbridge_spawner_loop),
|
||||
END_LOOP(),
|
||||
|
|
|
@ -325,6 +325,7 @@ void bhv_celebration_star_init(void);
|
|||
void bhv_celebration_star_loop(void);
|
||||
void bhv_celebration_star_sparkle_loop(void);
|
||||
void bhv_star_key_collection_puff_spawner_loop(void);
|
||||
void bhv_lll_drawbridge_spawner_init(void);
|
||||
void bhv_lll_drawbridge_spawner_loop(void);
|
||||
void bhv_lll_drawbridge_loop(void);
|
||||
void bhv_small_bomp_init(void);
|
||||
|
|
|
@ -1,22 +1,35 @@
|
|||
// drawbridge.c.inc
|
||||
|
||||
void bhv_lll_drawbridge_spawner_loop(void) {
|
||||
struct Object *drawbridge1, *drawbridge2;
|
||||
void bhv_lll_drawbridge_spawner_init(void) {
|
||||
struct Object *drawbridge[2];
|
||||
|
||||
drawbridge1 = spawn_object(o, MODEL_LLL_DRAWBRIDGE_PART, bhvLllDrawbridge);
|
||||
drawbridge1->oMoveAngleYaw = o->oMoveAngleYaw;
|
||||
drawbridge1->oPosX += coss(o->oMoveAngleYaw) * 640.0f;
|
||||
drawbridge1->oPosZ += sins(o->oMoveAngleYaw) * 640.0f;
|
||||
drawbridge[0] = spawn_object(o, MODEL_LLL_DRAWBRIDGE_PART, bhvLllDrawbridge);
|
||||
drawbridge[0]->oMoveAngleYaw = o->oMoveAngleYaw;
|
||||
drawbridge[0]->oPosX += coss(o->oMoveAngleYaw) * 640.0f;
|
||||
drawbridge[0]->oPosZ += sins(o->oMoveAngleYaw) * 640.0f;
|
||||
|
||||
drawbridge2 = spawn_object(o, MODEL_LLL_DRAWBRIDGE_PART, bhvLllDrawbridge);
|
||||
drawbridge2->oMoveAngleYaw = o->oMoveAngleYaw + 0x8000;
|
||||
drawbridge2->oPosX += coss(o->oMoveAngleYaw) * -640.0f;
|
||||
drawbridge2->oPosZ += sins(o->oMoveAngleYaw) * -640.0f;
|
||||
drawbridge[1] = spawn_object(o, MODEL_LLL_DRAWBRIDGE_PART, bhvLllDrawbridge);
|
||||
drawbridge[1]->oMoveAngleYaw = o->oMoveAngleYaw + 0x8000;
|
||||
drawbridge[1]->oPosX += coss(o->oMoveAngleYaw) * -640.0f;
|
||||
drawbridge[1]->oPosZ += sins(o->oMoveAngleYaw) * -640.0f;
|
||||
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
network_init_object(o, 3000.0f);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
network_init_object_field(o, &drawbridge[i]->oFaceAngleRoll);
|
||||
network_init_object_field(o, &drawbridge[i]->oAction);
|
||||
network_init_object_field(o, &drawbridge[i]->oPrevAction);
|
||||
network_init_object_field(o, &drawbridge[i]->oTimer);
|
||||
}
|
||||
}
|
||||
|
||||
//o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
}
|
||||
|
||||
void bhv_lll_drawbridge_spawner_loop(void) { }
|
||||
|
||||
void bhv_lll_drawbridge_loop(void) {
|
||||
|
||||
s32 globalTimer = gGlobalTimer;
|
||||
|
||||
switch (o->oAction) {
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// lll_floating_wood_piece.c.inc
|
||||
|
||||
void bhv_lll_wood_piece_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
network_init_object(o, 1000.0f);
|
||||
network_init_object_field(o, &o->oLllWoodPieceOscillationTimer);
|
||||
}
|
||||
|
||||
if (o->oTimer == 0)
|
||||
o->oPosY -= 100.0f;
|
||||
o->oPosY += sins(o->oLllWoodPieceOscillationTimer) * 3.0f;
|
||||
|
|
|
@ -15,12 +15,17 @@ void hexagonal_ring_spawn_flames(void) {
|
|||
}
|
||||
|
||||
void bhv_lll_rotating_hexagonal_ring_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
struct SyncObject* so = network_init_object(o, 4000.0f);
|
||||
so->keepRandomSeed = FALSE;
|
||||
network_init_object_field(o, &o->oAngleVelYaw);
|
||||
}
|
||||
UNUSED s32 unused;
|
||||
o->oCollisionDistance = 4000.0f;
|
||||
o->oDrawingDistance = 8000.0f;
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
if (gMarioObject->platform == o)
|
||||
if (cur_obj_is_any_player_on_platform())
|
||||
o->oAction++;
|
||||
o->oAngleVelYaw = 0x100;
|
||||
break;
|
||||
|
@ -30,7 +35,7 @@ void bhv_lll_rotating_hexagonal_ring_loop(void) {
|
|||
o->oAction++;
|
||||
break;
|
||||
case 2:
|
||||
if (gMarioObject->platform != o)
|
||||
if (cur_obj_is_any_player_on_platform())
|
||||
o->oAction++;
|
||||
if (o->oTimer > 128)
|
||||
o->oAction++;
|
||||
|
|
|
@ -41,7 +41,7 @@ s32 lll_octagonal_mesh_move(s16 *a0, s32 a1) {
|
|||
}
|
||||
|
||||
s32 lll_octagonal_mesh_find_y_offset(s32 *a0, f32 *a1, s32 a2, s32 a3) {
|
||||
if (cur_obj_is_mario_on_platform()) {
|
||||
if (cur_obj_is_any_player_on_platform()) {
|
||||
if (a0[0] < 0x4000)
|
||||
a0[0] += a2;
|
||||
else
|
||||
|
@ -60,6 +60,13 @@ s32 lll_octagonal_mesh_find_y_offset(s32 *a0, f32 *a1, s32 a2, s32 a3) {
|
|||
}
|
||||
|
||||
void bhv_lll_moving_octagonal_mesh_platform_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
network_init_object(o, 4000.0f);
|
||||
network_init_object_field(o, &o->oHorizontalMovementUnkF8);
|
||||
network_init_object_field(o, &o->oHorizontalMovementUnkF4);
|
||||
network_init_object_field(o, &o->oHorizontalMovementUnk100);
|
||||
network_init_object_field(o, &o->oForwardVel);
|
||||
}
|
||||
if (o->oAction == 0) {
|
||||
o->oHorizontalMovementUnkF8 = 0;
|
||||
o->oAction++;
|
||||
|
|
|
@ -61,6 +61,10 @@ void (*sRotatingCwFireBarsActions[])(void) = { fire_bar_act_0, fire_bar_act_1,
|
|||
fire_bar_act_2, fire_bar_act_3 };
|
||||
|
||||
void bhv_lll_rotating_block_fire_bars_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
network_init_object(o, 4000.0f);
|
||||
network_init_object_field(o, &o->oAngleVelYaw);
|
||||
}
|
||||
cur_obj_call_action_function(sRotatingCwFireBarsActions);
|
||||
if (o->oBehParams2ndByte == 0)
|
||||
load_object_collision_model();
|
||||
|
|
|
@ -16,6 +16,11 @@ void sinking_rectangular_plat_actions(f32 a0, s32 a1) {
|
|||
}
|
||||
|
||||
void bhv_lll_sinking_rectangular_platform_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
struct SyncObject* so = network_init_object(o, 1000.0f);
|
||||
network_init_object_field(o, &o->oLllWoodPieceOscillationTimer);
|
||||
network_init_object_field(o, &o->oFaceAnglePitch);
|
||||
}
|
||||
f32 sp1C = 0.4f;
|
||||
s32 sp18 = 0x100;
|
||||
if (o->oMoveAngleYaw != 0)
|
||||
|
@ -27,6 +32,10 @@ void bhv_lll_sinking_rectangular_platform_loop(void) {
|
|||
}
|
||||
|
||||
void bhv_lll_sinking_square_platforms_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
network_init_object(o, 1000.0f);
|
||||
network_init_object_field(o, &o->oLllWoodPieceOscillationTimer);
|
||||
}
|
||||
f32 sp1C = 0.5f;
|
||||
s32 sp18 = 0x100;
|
||||
sinking_rectangular_plat_actions(sp1C, sp18);
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// lll_sinking_rock_block.c.inc
|
||||
|
||||
void bhv_lll_sinking_rock_block_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
network_init_object(o, 1000.0f);
|
||||
network_init_object_field(o, &o->oSinkWhenSteppedOnUnk104);
|
||||
network_init_object_field(o, &o->oGraphYOffset);
|
||||
}
|
||||
lll_octagonal_mesh_find_y_offset(&o->oSinkWhenSteppedOnUnk104, &o->oSinkWhenSteppedOnUnk108, 124, -110);
|
||||
o->oGraphYOffset = 0.0f;
|
||||
o->oPosY = o->oHomeY + o->oSinkWhenSteppedOnUnk108;
|
||||
|
|
|
@ -117,13 +117,7 @@ static void platform_on_track_act_init(void) {
|
|||
* Wait for mario to stand on the platform for 20 frames, then begin moving.
|
||||
*/
|
||||
static void platform_on_track_act_wait_for_mario(void) {
|
||||
u8 anyMarioOnPlatform = FALSE;
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].marioObj->platform == o) { anyMarioOnPlatform = TRUE; }
|
||||
}
|
||||
|
||||
if (anyMarioOnPlatform) {
|
||||
if (cur_obj_is_any_player_on_platform()) {
|
||||
if (o->oTimer > 20) {
|
||||
o->oAction = PLATFORM_ON_TRACK_ACT_MOVE_ALONG_TRACK;
|
||||
if (network_owns_object(o)) { network_send_object(o); }
|
||||
|
@ -223,13 +217,7 @@ static void platform_on_track_act_move_along_track(void) {
|
|||
}
|
||||
}
|
||||
|
||||
u8 anyMarioOnPlatform = FALSE;
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].marioObj->platform == o) { anyMarioOnPlatform = TRUE; }
|
||||
}
|
||||
|
||||
if (!anyMarioOnPlatform) {
|
||||
if (!cur_obj_is_any_player_on_platform()) {
|
||||
platform_on_track_mario_not_on_platform();
|
||||
} else {
|
||||
o->oTimer = 0;
|
||||
|
@ -253,13 +241,7 @@ static void platform_on_track_act_pause_briefly(void) {
|
|||
static void platform_on_track_act_fall(void) {
|
||||
cur_obj_move_using_vel_and_gravity();
|
||||
|
||||
u8 anyMarioOnPlatform = FALSE;
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].marioObj->platform == o) { anyMarioOnPlatform = TRUE; }
|
||||
}
|
||||
|
||||
if (!anyMarioOnPlatform) {
|
||||
if (!cur_obj_is_any_player_on_platform()) {
|
||||
platform_on_track_mario_not_on_platform();
|
||||
} else {
|
||||
o->oTimer = 0;
|
||||
|
@ -324,16 +306,10 @@ void bhv_platform_on_track_update(void) {
|
|||
break;
|
||||
}
|
||||
|
||||
u8 anyMarioOnPlatform = FALSE;
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].marioObj->platform == o) { anyMarioOnPlatform = TRUE; }
|
||||
}
|
||||
|
||||
if (!o->oPlatformOnTrackIsNotSkiLift) {
|
||||
platform_on_track_rock_ski_lift();
|
||||
} else if (o->oPlatformOnTrackType == PLATFORM_ON_TRACK_TYPE_CARPET) {
|
||||
if (!o->oPlatformOnTrackWasStoodOn && anyMarioOnPlatform) {
|
||||
if (!o->oPlatformOnTrackWasStoodOn && cur_obj_is_any_player_on_platform()) {
|
||||
o->oPlatformOnTrackOffsetY = -8.0f;
|
||||
o->oPlatformOnTrackWasStoodOn = TRUE;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
// hypothesis is that the object in the middle here used to be
|
||||
// a rolling log of another variation.
|
||||
|
||||
static void bhv_rolling_log_network_init(void) {
|
||||
network_init_object(o, 4000.0f);
|
||||
network_init_object_field(o, &o->oAngleVelPitch);
|
||||
network_init_object_field(o, &o->oFaceAnglePitch);
|
||||
network_init_object_field(o, &o->oMoveAnglePitch);
|
||||
network_init_object_field(o, &o->oPitouneUnkF4);
|
||||
network_init_object_field(o, &o->oPitouneUnkF8);
|
||||
network_init_object_field(o, &o->oPitouneUnkFC);
|
||||
}
|
||||
|
||||
void bhv_ttm_rolling_log_init(void) {
|
||||
o->oPitouneUnkF8 = 3970.0f;
|
||||
o->oPitouneUnkFC = 3654.0f;
|
||||
|
@ -16,14 +26,32 @@ void bhv_ttm_rolling_log_init(void) {
|
|||
o->oVelZ = 0;
|
||||
o->oFaceAnglePitch = 0;
|
||||
o->oAngleVelPitch = 0;
|
||||
bhv_rolling_log_network_init();
|
||||
}
|
||||
|
||||
void rolling_log_roll_log(void) {
|
||||
f32 sp24;
|
||||
|
||||
if (gMarioObject->platform == o) {
|
||||
sp24 = (gMarioObject->header.gfx.pos[2] - o->oPosZ) * coss(-1*o->oMoveAngleYaw)
|
||||
- (gMarioObject->header.gfx.pos[0] - o->oPosX) * sins(-1*o->oMoveAngleYaw);
|
||||
f32 x = 0;
|
||||
f32 y = 0;
|
||||
f32 z = 0;
|
||||
u8 playersTouched = 0;
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
||||
x += gMarioObject->header.gfx.pos[0];
|
||||
y += gMarioObject->header.gfx.pos[1];
|
||||
z += gMarioObject->header.gfx.pos[2];
|
||||
playersTouched++;
|
||||
if (i == 0) { marioOnPlatform = TRUE; }
|
||||
}
|
||||
|
||||
if (playersTouched > 0) {
|
||||
x /= (f32)playersTouched;
|
||||
y /= (f32)playersTouched;
|
||||
z /= (f32)playersTouched;
|
||||
|
||||
sp24 = (z - o->oPosZ) * coss(-1*o->oMoveAngleYaw) - (x - o->oPosX) * sins(-1*o->oMoveAngleYaw);
|
||||
if (sp24 > 0)
|
||||
o->oAngleVelPitch += 0x10;
|
||||
else
|
||||
|
@ -112,6 +140,13 @@ void volcano_act_3(void) {
|
|||
}
|
||||
|
||||
void bhv_volcano_trap_loop(void) {
|
||||
if (!network_sync_object_initialized(o)) {
|
||||
network_init_object(o, 4000.0f);
|
||||
network_init_object_field(o, &o->oRollingLogUnkF4);
|
||||
network_init_object_field(o, &o->oAngleVelPitch);
|
||||
network_init_object_field(o, &o->oFaceAnglePitch);
|
||||
}
|
||||
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 1000)) {
|
||||
|
@ -151,4 +186,5 @@ void bhv_lll_rolling_log_init(void) {
|
|||
o->oVelZ = 0;
|
||||
o->oFaceAnglePitch = 0;
|
||||
o->oAngleVelPitch = 0;
|
||||
bhv_rolling_log_network_init();
|
||||
}
|
||||
|
|
|
@ -81,19 +81,36 @@ void bhv_tilting_inverted_pyramid_loop(void) {
|
|||
Mat4 *transform = &o->transform;
|
||||
UNUSED s32 unused2[7];
|
||||
|
||||
if (gMarioObject->platform == o) {
|
||||
f32 x = 0;
|
||||
f32 y = 0;
|
||||
f32 z = 0;
|
||||
u8 playersTouched = 0;
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
||||
x += gMarioStates[i].marioObj->oPosX;
|
||||
y += gMarioStates[i].marioObj->oPosY;
|
||||
z += gMarioStates[i].marioObj->oPosZ;
|
||||
playersTouched++;
|
||||
if (i == 0) { marioOnPlatform = TRUE; }
|
||||
}
|
||||
|
||||
if (playersTouched > 0) {
|
||||
x /= (f32)playersTouched;
|
||||
y /= (f32)playersTouched;
|
||||
z /= (f32)playersTouched;
|
||||
get_mario_pos(&mx, &my, &mz);
|
||||
|
||||
dist[0] = gMarioObject->oPosX - o->oPosX;
|
||||
dist[1] = gMarioObject->oPosY - o->oPosY;
|
||||
dist[2] = gMarioObject->oPosZ - o->oPosZ;
|
||||
dist[0] = x - o->oPosX;
|
||||
dist[1] = y - o->oPosY;
|
||||
dist[2] = z - o->oPosZ;
|
||||
linear_mtxf_mul_vec3f(*transform, posBeforeRotation, dist);
|
||||
|
||||
dx = gMarioObject->oPosX - o->oPosX;
|
||||
dx = x - o->oPosX;
|
||||
dy = 500.0f;
|
||||
dz = gMarioObject->oPosZ - o->oPosZ;
|
||||
dz = z - o->oPosZ;
|
||||
d = sqrtf(dx * dx + dy * dy + dz * dz);
|
||||
|
||||
|
||||
//! Always true since dy = 500, making d >= 500.
|
||||
if (d != 0.0f) {
|
||||
// Normalizing
|
||||
|
@ -107,8 +124,8 @@ void bhv_tilting_inverted_pyramid_loop(void) {
|
|||
dz = 0.0f;
|
||||
}
|
||||
|
||||
if (o->oTiltingPyramidMarioOnPlatform == TRUE)
|
||||
marioOnPlatform++;
|
||||
/*if (o->oTiltingPyramidMarioOnPlatform == TRUE)
|
||||
marioOnPlatform++;*/
|
||||
|
||||
o->oTiltingPyramidMarioOnPlatform = TRUE;
|
||||
} else {
|
||||
|
|
|
@ -185,12 +185,7 @@ void king_whomp_on_ground(void) {
|
|||
void whomp_on_ground(void) {
|
||||
|
||||
if (o->oSubAction == 0) {
|
||||
u8 anyMarioOnPlatform = FALSE;
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (gMarioStates[i].marioObj->platform == o) { anyMarioOnPlatform = TRUE; }
|
||||
}
|
||||
if (anyMarioOnPlatform) {
|
||||
if (cur_obj_is_any_player_on_platform()) {
|
||||
if (cur_obj_is_mario_ground_pounding_platform()) {
|
||||
o->oNumLootCoins = 5;
|
||||
obj_spawn_loot_yellow_coins(o, 5, 20.0f);
|
||||
|
|
|
@ -127,6 +127,7 @@ void celeb_star_act_face_camera(void);
|
|||
void bhv_celebration_star_loop(void);
|
||||
void bhv_celebration_star_sparkle_loop(void);
|
||||
void bhv_star_key_collection_puff_spawner_loop(void);
|
||||
void bhv_lll_drawbridge_spawner_init(void);
|
||||
void bhv_lll_drawbridge_spawner_loop(void);
|
||||
void bhv_lll_drawbridge_loop(void);
|
||||
void bhv_small_bomp_init(void);
|
||||
|
|
Loading…
Reference in a new issue