The BT keyframe-animation player embedded in the Mech as legAnimation/ bodyAnimation. Struct field layout (from BT411's binary-offset map), default ctor, dtor, and Init(Mech*) reconstructed and compile-verified; Init is ctor-time (Mech ctor calls legAnimation.Init(this)/bodyAnimation.Init(this)) so it's real (binds owner + caches owner->GetJointSubsystem()). The per-frame gait engine (SelectSequence/Advance/Reset) is staged with Fail bodies -- it fires only once the mech is ticking, past the current ctor frontier. BT stage 23 ok; full tree still links clean. Evidence + real/staged split in SEQCTL.NOTES.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
87 lines
2.3 KiB
C++
87 lines
2.3 KiB
C++
#if !defined(SEQCTL_HPP)
|
|
# define SEQCTL_HPP
|
|
|
|
//##################### Forward Class Declarations #######################
|
|
class Mech;
|
|
class JointSubsystem;
|
|
|
|
//##########################################################################
|
|
//###################### SequenceController ##########################
|
|
//##########################################################################
|
|
//
|
|
// The BT keyframe-animation player embedded in the Mech as legAnimation and
|
|
// bodyAnimation. It plays a gait clip: walks the clip's keyframes,
|
|
// interpolates each animated joint's rotation, writes it through the joint
|
|
// subsystem, and returns the root-translation distance advanced this step.
|
|
//
|
|
// Reconstructed from the shipped binary (ctor/Init @00427768, SelectSequence
|
|
// @004277a8, Advance @0042790c, Reset @004283b8). Not in the surviving 4.10
|
|
// archive nor the RP engine. See SEQCTL.NOTES.md.
|
|
//
|
|
class SequenceController
|
|
{
|
|
public:
|
|
//
|
|
// One root-translation entry (per keyframe); ".stride" is the forward
|
|
// (local Z) distance the gait reads.
|
|
//
|
|
struct Keyframe
|
|
{
|
|
Scalar x, y, stride;
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction / Destruction
|
|
//
|
|
public:
|
|
SequenceController();
|
|
~SequenceController();
|
|
|
|
void
|
|
Init(Mech *owner_mech);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Playback
|
|
//
|
|
public:
|
|
void
|
|
SelectSequence(
|
|
int clip_id,
|
|
void *finished_callback,
|
|
unsigned callback_arg2,
|
|
unsigned callback_arg3
|
|
);
|
|
Scalar
|
|
Advance(Scalar time_slice, int move_joints);
|
|
void
|
|
Reset(int loop);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Clip data (parsed by SelectSequence; keyframe accessors read by the gait)
|
|
//
|
|
public:
|
|
int keyframeCount;
|
|
int jointCount;
|
|
Scalar *footStepThreshold;
|
|
int *jointIndices;
|
|
Scalar *keyframeTimes;
|
|
void *keyframeBase;
|
|
void *keyframeCursor;
|
|
Keyframe *keyframeData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Runtime state / links
|
|
//
|
|
public:
|
|
int currentFrame;
|
|
Scalar currentTime;
|
|
JointSubsystem *jointSubsystem;
|
|
Mech *owner;
|
|
void *clipResource;
|
|
void *finishedCallback;
|
|
unsigned callbackArg2;
|
|
unsigned callbackArg3;
|
|
};
|
|
|
|
#endif
|