Synchronized square platforms as groups of two

This commit is contained in:
MysterD 2020-08-28 20:25:34 -07:00
parent a778bf497d
commit ab9d7db29f
7 changed files with 53 additions and 6 deletions

View File

@ -1803,6 +1803,15 @@ const BehaviorScript bhvAnotherTiltingPlatform[] = {
END_LOOP(),
};
const BehaviorScript bhvSquarishPathParent[] = {
BEGIN(OBJ_LIST_SURFACE),
ID(id_bhvSquarishPathParent),
CALL_NATIVE(bhv_squarish_path_parent_init),
BEGIN_LOOP(),
CALL_NATIVE(bhv_squarish_path_parent_loop),
END_LOOP(),
};
const BehaviorScript bhvSquarishPathMoving[] = {
BEGIN(OBJ_LIST_SURFACE),
ID(id_bhvSquarishPathMoving),

View File

@ -124,6 +124,7 @@ const BehaviorScript* gBehaviorTable[id_bhv_max_count] = {
[id_bhvTreeLeaf] = bhvTreeLeaf,
[id_bhvAnotherTiltingPlatform] = bhvAnotherTiltingPlatform,
[id_bhvSquarishPathMoving] = bhvSquarishPathMoving,
[id_bhvSquarishPathParent] = bhvSquarishPathParent,
[id_bhvPiranhaPlantBubble] = bhvPiranhaPlantBubble,
[id_bhvPiranhaPlantWakingBubbles] = bhvPiranhaPlantWakingBubbles,
[id_bhvFloorSwitchAnimatesObject] = bhvFloorSwitchAnimatesObject,

View File

@ -128,6 +128,7 @@ extern const BehaviorScript bhvTreeSnow[];
extern const BehaviorScript bhvTreeLeaf[];
extern const BehaviorScript bhvAnotherTiltingPlatform[];
extern const BehaviorScript bhvSquarishPathMoving[];
extern const BehaviorScript bhvSquarishPathParent[];
extern const BehaviorScript bhvPiranhaPlantBubble[];
extern const BehaviorScript bhvPiranhaPlantWakingBubbles[];
extern const BehaviorScript bhvFloorSwitchAnimatesObject[];

View File

@ -128,6 +128,7 @@ enum BehaviorId {
id_bhvTreeLeaf,
id_bhvAnotherTiltingPlatform,
id_bhvSquarishPathMoving,
id_bhvSquarishPathParent,
id_bhvPiranhaPlantBubble,
id_bhvPiranhaPlantWakingBubbles,
id_bhvFloorSwitchAnimatesObject,

View File

@ -17,12 +17,9 @@
#include "levels/bitdw/header.h"
static const LevelScript script_func_local_1[] = {
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -1966, -3154, 3586, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSquarishPathMoving),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -1352, -3154, 4200, /*angle*/ 0, 0, 0, /*behParam*/ 0x00020000, /*beh*/ bhvSquarishPathMoving),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -2963, 1017, -2464, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSquarishPathMoving),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -2349, 1017, -1849, /*angle*/ 0, 0, 0, /*behParam*/ 0x00020000, /*beh*/ bhvSquarishPathMoving),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -2349, 1017, -1235, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSquarishPathMoving),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -1735, 1017, -621, /*angle*/ 0, 0, 0, /*behParam*/ 0x00020000, /*beh*/ bhvSquarishPathMoving),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -1966, -3154, 3586, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSquarishPathParent),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -2963, 1017, -2464, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSquarishPathParent),
OBJECT(/*model*/ MODEL_BITDW_SQUARE_PLATFORM, /*pos*/ -2349, 1017, -1235, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSquarishPathParent),
OBJECT(/*model*/ MODEL_BITDW_SEESAW_PLATFORM, /*pos*/ 1491, 1273, 512, /*angle*/ 0, 90, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSeesawPlatform),
OBJECT(/*model*/ MODEL_BITDW_SEESAW_PLATFORM, /*pos*/ -147, 894, 512, /*angle*/ 0, 90, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSeesawPlatform),
OBJECT(/*model*/ MODEL_BITDW_SLIDING_PLATFORM, /*pos*/ -5728, 819, -2151, /*angle*/ 0, 0, 0, /*behParam*/ 0x03CE0000, /*beh*/ bhvSlidingPlatform2),

View File

@ -131,6 +131,8 @@ void bhv_small_water_wave_loop(void);
void bhv_yellow_coin_init(void);
void bhv_yellow_coin_loop(void);
void bhv_squarish_path_moving_loop(void);
void bhv_squarish_path_parent_init(void);
void bhv_squarish_path_parent_loop(void);
void bhv_heave_ho_loop(void);
void bhv_heave_ho_throw_mario_loop(void);
void bhv_ccm_touched_star_spawn_loop(void);

View File

@ -1,5 +1,41 @@
// square_platform_cycle.c.inc
void bhv_squarish_path_parent_init(void) {
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
cur_obj_become_intangible();
static s16 radius = (614 / 2);
o->oPosX += radius;
o->oPosZ += radius;
struct SyncObject* so = network_init_object(o, 2000.0f);
so->hasStandardFields = FALSE;
so->maxUpdateRate = 5.0f;
for (int i = 0; i < 2; i++) {
s16 action = (i == 0) ? 1 : 3;
s16 offset = (i == 0) ? (-radius) : (radius);
struct Object* square = spawn_object(o, MODEL_BITDW_SQUARE_PLATFORM, bhvSquarishPathMoving);
square->oPosX = o->oPosX + offset;
square->oPosY = o->oPosY;
square->oPosZ = o->oPosZ + offset;
square->oAction = action;
network_init_object_field(o, &square->oMoveAngleYaw);
network_init_object_field(o, &square->oForwardVel);
network_init_object_field(o, &square->oPosX);
network_init_object_field(o, &square->oPosY);
network_init_object_field(o, &square->oPosZ);
network_init_object_field(o, &square->oVelX);
network_init_object_field(o, &square->oVelY);
network_init_object_field(o, &square->oVelZ);
network_init_object_field(o, &square->oAction);
network_init_object_field(o, &square->oPrevAction);
network_init_object_field(o, &square->oTimer);
}
}
void bhv_squarish_path_parent_loop(void) { }
s32 square_plat_set_yaw_until_timer(u16 yaw, s32 a) {
o->oMoveAngleYaw = yaw;
if (a < o->oTimer)