Mech phase 2: reconstruct HUD (: PowerWatcher) -- Mech hudSubsystem
Head-up display / targeting reticle subsystem, full named member set (reticle/ compass/lock/flicker/torso-readout state). Ctor chains PowerWatcher + inits per the binary (visible/blinkState True, vectors zeroed, resource flicker/horizontal copied); statusAlarm.Initialize(2). Added AlarmIndicator::Initialize(levels). statics/dtor/test real; HudSimulation staged. BT: 29 ok. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
//===========================================================================//
|
||||
// File: hud.cpp //
|
||||
// Project: BattleTech Brick: Mech subsystems //
|
||||
// Contents: HUD -- head-up display / targeting reticle //
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
||||
// All Rights reserved worldwide //
|
||||
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
||||
//===========================================================================//
|
||||
|
||||
#include <bt.hpp>
|
||||
#pragma hdrstop
|
||||
|
||||
#if !defined(HUD_HPP)
|
||||
# include <hud.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(MECH_HPP)
|
||||
# include <mech.hpp>
|
||||
#endif
|
||||
|
||||
static const Point3D HudZeroVector(0.0f, 0.0f, 0.0f);
|
||||
|
||||
Derivation
|
||||
HUD::ClassDerivations(
|
||||
PowerWatcher::ClassDerivations,
|
||||
"HUD"
|
||||
);
|
||||
|
||||
HUD::SharedData
|
||||
HUD::DefaultData(
|
||||
HUD::ClassDerivations,
|
||||
Subsystem::MessageHandlers,
|
||||
Subsystem::AttributeIndex,
|
||||
Subsystem::StateCount
|
||||
);
|
||||
|
||||
HUD::HUD(
|
||||
Mech *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem_resource,
|
||||
SharedData &shared_data
|
||||
):
|
||||
PowerWatcher(owner, subsystem_ID, subsystem_resource, shared_data)
|
||||
{
|
||||
Check(owner);
|
||||
Check_Pointer(subsystem_resource);
|
||||
|
||||
flickerRate = 0.0f;
|
||||
rotationOfTorsoHorizontal = 0.0f;
|
||||
torsoLimitRight = 0.0f;
|
||||
torsoLimitLeft = 0.0f;
|
||||
torsoSpeed = 0.0f;
|
||||
rangeToTarget = 0.0f;
|
||||
scratch1F0 = 0;
|
||||
visible = True;
|
||||
lockFlag = False;
|
||||
hotBoxVector = HudZeroVector;
|
||||
threatVector = HudZeroVector;
|
||||
compassHeading = 0.0f;
|
||||
blinkTimer = 0.0f;
|
||||
flickerTimer = 0.0f;
|
||||
blinkState = True;
|
||||
transitionFlag = False;
|
||||
previousHorizontal = 0.0f;
|
||||
|
||||
statusAlarm.Initialize(2);
|
||||
|
||||
freeAimSlew = 0.0f;
|
||||
scratch290 = 0.0f;
|
||||
horizontalTorsoOffset = 0.0f;
|
||||
|
||||
flickerRate = subsystem_resource->flickerRate;
|
||||
horizontalMovementPerSecond = subsystem_resource->horizontalMovementPerSecond;
|
||||
horizontalLimit = subsystem_resource->horizontalLimit;
|
||||
|
||||
//
|
||||
// The torso-orientation source is a Mech link not yet live at
|
||||
// construction time; HudSimulation refreshes these per-frame.
|
||||
//
|
||||
linkedEntity = 0;
|
||||
flickerActive = 0;
|
||||
|
||||
Check_Fpu();
|
||||
}
|
||||
|
||||
HUD::~HUD()
|
||||
{
|
||||
}
|
||||
|
||||
Logical
|
||||
HUD::TestClass(Mech &)
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
Logical
|
||||
HUD::TestInstance() const
|
||||
{
|
||||
return IsDerivedFrom(ClassDerivations);
|
||||
}
|
||||
|
||||
//
|
||||
// Per-frame reticle / compass / lock-ring update. Not yet reconstructed.
|
||||
//
|
||||
void
|
||||
HUD::HudSimulation(Scalar)
|
||||
{
|
||||
Fail("HUD::HudSimulation -- hud.cpp not yet reconstructed");
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//===========================================================================//
|
||||
// File: hud.hpp //
|
||||
// Project: BattleTech Brick: Mech subsystems //
|
||||
// Contents: HUD -- the head-up display / targeting reticle subsystem //
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
||||
// All Rights reserved worldwide //
|
||||
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
||||
//===========================================================================//
|
||||
|
||||
#if !defined(HUD_HPP)
|
||||
# define HUD_HPP
|
||||
|
||||
# if !defined(POWERSUB_HPP)
|
||||
# include <powersub.hpp>
|
||||
# endif
|
||||
|
||||
//##################### Forward Class Declarations #######################
|
||||
class Mech;
|
||||
|
||||
//###########################################################################
|
||||
//###################### HUD Model Resource ############################
|
||||
//###########################################################################
|
||||
|
||||
struct HUD__SubsystemResource:
|
||||
public PowerWatcher::SubsystemResource
|
||||
{
|
||||
Scalar flickerRate;
|
||||
int segmentPageIndex;
|
||||
Scalar horizontalMovementPerSecond;
|
||||
Scalar horizontalLimit;
|
||||
};
|
||||
|
||||
//###########################################################################
|
||||
//################################ HUD #################################
|
||||
//###########################################################################
|
||||
|
||||
class HUD:
|
||||
public PowerWatcher
|
||||
{
|
||||
public:
|
||||
static Derivation ClassDerivations;
|
||||
static SharedData DefaultData;
|
||||
|
||||
typedef void
|
||||
(HUD::*Performance)(Scalar time_slice);
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
static Logical
|
||||
TestClass(Mech &);
|
||||
Logical
|
||||
TestInstance() const;
|
||||
void
|
||||
HudSimulation(Scalar time_slice);
|
||||
|
||||
public:
|
||||
typedef HUD__SubsystemResource SubsystemResource;
|
||||
|
||||
HUD(
|
||||
Mech *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem_resource,
|
||||
SharedData &shared_data = DefaultData
|
||||
);
|
||||
~HUD();
|
||||
|
||||
protected:
|
||||
Scalar flickerRate;
|
||||
Scalar rotationOfTorsoHorizontal;
|
||||
Scalar torsoLimitRight;
|
||||
Scalar torsoLimitLeft;
|
||||
Scalar torsoSpeed;
|
||||
Scalar rangeToTarget;
|
||||
int scratch1F0;
|
||||
int visible;
|
||||
int lockFlag;
|
||||
Point3D hotBoxVector;
|
||||
Point3D threatVector;
|
||||
Scalar compassHeading;
|
||||
Scalar blinkTimer;
|
||||
Scalar flickerTimer;
|
||||
int blinkState;
|
||||
int transitionFlag;
|
||||
Scalar previousHorizontal;
|
||||
int linkedEntity;
|
||||
Scalar freeAimSlew;
|
||||
Scalar scratch290;
|
||||
Scalar horizontalTorsoOffset;
|
||||
Scalar horizontalMovementPerSecond;
|
||||
Scalar horizontalLimit;
|
||||
int flickerActive;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -28,6 +28,9 @@
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Initialize(unsigned level_count)
|
||||
{Check(this); stateCount = level_count; SetState(0);}
|
||||
void
|
||||
SetLevel(unsigned level)
|
||||
{Check(this); SetState(level);}
|
||||
|
||||
Reference in New Issue
Block a user