VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtGunnerControlLogic Class Reference

Detailed Description

DtGunnerControlLogic provides input handling and simulation logic for gunner roles, including weapon control, turret movement, firing, aiming modes, and commander override capabilities. It manages weapon selection, zoom levels, sensor types, and slew-to-cue functionality for targeting systems.

#include <gunnerControlLogic.h>

Inheritance diagram for makVre::DtGunnerControlLogic:
[legend]

Public Member Functions

 DtGunnerControlLogic ()
 
virtual ~DtGunnerControlLogic () override
 
virtual bool initialize (DtPlayerStation *player, DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual void fire (double val)
 
virtual void azimuth (double val)
 
virtual void elevation (double val)
 
virtual void stabilize (double val)
 
virtual void nextWeapon (double val)
 
virtual void previousWeapon (double val)
 
virtual void zoomIn (double val)
 
virtual void zoomOut (double val)
 
virtual void nextSensor (double val)
 
virtual void cycleAimingMode ()
 
virtual void slewToCue (bool onoff)
 
virtual void switchToAltRole ()
 
virtual void handleSlewToCue (float val)
 
virtual void handleSwitchToAltRole (float val)
 
virtual void turretUp (float val)
 
virtual void turretDown (float val)
 
virtual void turretRight (float val)
 
virtual void turretLeft (float val)
 
virtual void zoom (float val)
 
virtual void missileX (double val)
 
virtual void missileY (double val)
 
virtual void toggleArmed ()
 
virtual makVre::DtVreMessageResult handleMenuMessage (makVre::DtVreMessage *msg)
 
- Public Member Functions inherited from makVre::DtEntityControlLogic
 DtEntityControlLogic ()
 
virtual ~DtEntityControlLogic () override
 
virtual void setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId())
 
virtual void setMouseControlEnabled (bool enabled)
 
virtual bool isMouseControlEnabled ()
 
virtual bool isMouseControlSupportAllowed () const
 
virtual void setMouseControlSupportAllowed (bool enable)
 
virtual const std::vector< std::string > & joystickGroups () const
 
virtual makVre::DtVreMessageResult handleSimState (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleStateMessages (makVre::DtVreMessage *message)
 
virtual makVre::DtVreMessageResult handleReset (makVre::DtVreMessage *message)
 
virtual void reset (float val)
 
virtual void resetInPlace (float val)
 
virtual void toggleMouseControl (float val)
 
virtual void enableMouseControl (float val)
 
virtual makVre::DtVreMessageResult handleFocusMessage (makVre::DtVreMessage *message)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual bool aimWithObserver () const
 
virtual void setCommanderOverrideActive (bool active) const
 
void sendJoystickMessage (const std::string &func, const double val)
 
virtual void aimMissile (double x, double y)
 
virtual bool canFire ()
 
- Protected Member Functions inherited from makVre::DtEntityControlLogic
virtual void takeControlOfPlayerEntity ()
 
virtual void releaseControlOfPlayerEntity ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

std::string myPreviousMunitionType
 
std::string myMainControlGroup
 
DtInputLogic myInputLogic
 
std::string mySystemName
 
DtWeaponResourceLogicmyResourceLogic
 
std::vector< double > myZoomLevels
 
int myZoomIndex
 
makVre::DtInitTable myExtendedWeaponSystems
 
makVre::DtInitTable myCurrentExtendedSystem
 
DtVector myTargetLocation
 
makVrv::DtElementID myTargetElement
 
std::string mySlewToCueTargetSystem
 
bool mySlewToCueActive
 
double mySlewToCueUpdateRate
 
double mySlewToCueTimer
 
double mySlewToCueUpdateDeltaThreshold
 
DtVector mySlewToCueLastSentVector
 
std::string myAltRole
 
bool myIsOverrideRole
 
std::string myOverrideSystem
 
bool myCycleWeaponFlag
 
double myDelayedCycleWeaponTimer
 
std::string myForceResourceType
 
DtAttributeHandle myResourceHandle
 
DtAttributeHandle myMunitionHandle
 
double myMissileX
 
double myMissileY
 
double myMinRange
 
double myMaxRange
 
bool myPreviousMissileInFlight
 
double myMinGunAzimuth
 
double myMaxGunAzimuth
 
std::string myAzimuthStateAttribute
 
std::string myArmedStateProperty
 
- Protected Attributes inherited from makVre::DtEntityControlLogic
std::vector< std::string > myJoystickFunctionGroups
 
DtInputLogic myCommonInputLogic
 
std::string myInputConfigFile
 
bool myMouseControlEnabled
 
bool myMouseControlSupportAllowed
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtGunnerControlLogic()

makVre::DtGunnerControlLogic::DtGunnerControlLogic ( )

Constructor for DtGunnerControlLogic.

Initializes component state and checks out required VRE_GROUND license

◆ ~DtGunnerControlLogic()

virtual makVre::DtGunnerControlLogic::~DtGunnerControlLogic ( )
overridevirtual

Destructor for DtGunnerControlLogic.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtGunnerControlLogic::initialize ( DtPlayerStation * player,
DtInitTable & config )
overridevirtual

Initializes the gunner control logic component.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing gunner settings
Returns
True if initialization succeeded, false otherwise

Sets up joystick controls, input handlers, state attributes, zoom levels, and configures extended weapon systems and slew-to-cue functionality

Reimplemented from makVre::DtEntityControlLogic.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtGunnerControlLogic::postInitialize ( )
overridevirtual

Performs post-initialization after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Locates and establishes connection with the DtWeaponResourceLogic component

Reimplemented from makVre::DtEntityControlLogic.

◆ tick()

virtual void makVre::DtGunnerControlLogic::tick ( double dt)
overridevirtual

Called every frame to update gunner control logic.

Parameters
dtDelta time since the last frame in seconds

Updates weapon system state, handles extended weapon system targeting, manages slew-to-cue functionality, and sends firing position updates

Reimplemented from makVre::DtEntityControlLogic.

◆ shutdown()

virtual void makVre::DtGunnerControlLogic::shutdown ( )
overridevirtual

Shuts down the gunner control logic component.

Cleans up input handlers, message handlers, and disables commander override if active

Reimplemented from makVre::DtEntityControlLogic.

◆ type()

virtual const char * makVre::DtGunnerControlLogic::type ( ) const
overridevirtual

Returns the component type identifier.

Returns
The component type string

Reimplemented from makVre::DtEntityControlLogic.

◆ fire()

virtual void makVre::DtGunnerControlLogic::fire ( double val)
virtual

Input functions mapped to particular action strings in configuration.

Handles weapon firing input

Parameters
valInput value (1.0 = fire, 0.0 = stop firing)

◆ azimuth()

virtual void makVre::DtGunnerControlLogic::azimuth ( double val)
virtual

Controls turret azimuth (horizontal rotation)

Parameters
valInput value for azimuth rate (-1.0 to 1.0)

◆ elevation()

virtual void makVre::DtGunnerControlLogic::elevation ( double val)
virtual

Controls turret elevation (vertical angle)

Parameters
valInput value for elevation rate (-1.0 to 1.0)

◆ stabilize()

virtual void makVre::DtGunnerControlLogic::stabilize ( double val)
virtual

Controls weapon stabilization system.

Parameters
valInput value (1.0 = enable, 0.0 = disable)

◆ nextWeapon()

virtual void makVre::DtGunnerControlLogic::nextWeapon ( double val)
virtual

Selects the next available weapon.

Parameters
valInput value (1.0 = select next weapon)

◆ previousWeapon()

virtual void makVre::DtGunnerControlLogic::previousWeapon ( double val)
virtual

Selects the previous available weapon.

Parameters
valInput value (1.0 = select previous weapon)

◆ zoomIn()

virtual void makVre::DtGunnerControlLogic::zoomIn ( double val)
virtual

Increases the sight magnification level.

Parameters
valInput value (1.0 = zoom in one level)

◆ zoomOut()

virtual void makVre::DtGunnerControlLogic::zoomOut ( double val)
virtual

Decreases the sight magnification level.

Parameters
valInput value (1.0 = zoom out one level)

◆ nextSensor()

virtual void makVre::DtGunnerControlLogic::nextSensor ( double val)
virtual

Cycles to the next available sensor type (visual, NVG, thermal)

Parameters
valInput value (1.0 = select next sensor)

◆ cycleAimingMode()

virtual void makVre::DtGunnerControlLogic::cycleAimingMode ( )
virtual

Cycles between available aiming modes.

◆ slewToCue()

virtual void makVre::DtGunnerControlLogic::slewToCue ( bool onoff)
virtual

Activates or deactivates slew-to-cue functionality.

Parameters
onoffTrue to activate slew-to-cue, false to deactivate

◆ switchToAltRole()

virtual void makVre::DtGunnerControlLogic::switchToAltRole ( )
virtual

Switches between gunner and alternate role (e.g., commander RWS)

◆ handleSlewToCue()

virtual void makVre::DtGunnerControlLogic::handleSlewToCue ( float val)
virtual

Handles input for slew-to-cue activation.

Parameters
valInput value (1.0 = activate, 0.0 = deactivate)

◆ handleSwitchToAltRole()

virtual void makVre::DtGunnerControlLogic::handleSwitchToAltRole ( float val)
virtual

Handles input for switching to alternate role.

Parameters
valInput value (1.0 = switch role)

◆ turretUp()

virtual void makVre::DtGunnerControlLogic::turretUp ( float val)
virtual

Moves turret upward (direct control)

Parameters
valInput value (0.0 to 1.0 for speed)

◆ turretDown()

virtual void makVre::DtGunnerControlLogic::turretDown ( float val)
virtual

Moves turret downward (direct control)

Parameters
valInput value (0.0 to 1.0 for speed)

◆ turretRight()

virtual void makVre::DtGunnerControlLogic::turretRight ( float val)
virtual

Moves turret to the right (direct control)

Parameters
valInput value (0.0 to 1.0 for speed)

◆ turretLeft()

virtual void makVre::DtGunnerControlLogic::turretLeft ( float val)
virtual

Moves turret to the left (direct control)

Parameters
valInput value (0.0 to 1.0 for speed)

◆ zoom()

virtual void makVre::DtGunnerControlLogic::zoom ( float val)
virtual

Controls continuous zoom level directly.

Parameters
valInput value (-1.0 to 1.0) for zoom direction and speed

◆ missileX()

virtual void makVre::DtGunnerControlLogic::missileX ( double val)
virtual

Set x and y inputs for manual missile aiming.

◆ missileY()

virtual void makVre::DtGunnerControlLogic::missileY ( double val)
virtual

◆ toggleArmed()

virtual void makVre::DtGunnerControlLogic::toggleArmed ( )
virtual

Toggles armed state for a weapon that requires arming (weapons don't by default).

◆ handleMenuMessage()

virtual makVre::DtVreMessageResult makVre::DtGunnerControlLogic::handleMenuMessage ( makVre::DtVreMessage * msg)
virtual

Handles action menu messages for the gunner role.

Parameters
msgThe message to handle
Returns
Message handling result indicating if the message was handled

Processes menu actions like cycling weapons, sensors, aiming modes, and role switching

◆ aimWithObserver()

virtual bool makVre::DtGunnerControlLogic::aimWithObserver ( ) const
protectedvirtual

Determines if aiming should use the observer's view.

Returns
True if aiming should use the observer's view, false otherwise

◆ setCommanderOverrideActive()

virtual void makVre::DtGunnerControlLogic::setCommanderOverrideActive ( bool active) const
protectedvirtual

Sets the commander override active state.

Parameters
activeTrue to activate commander override, false to deactivate

◆ sendJoystickMessage()

void makVre::DtGunnerControlLogic::sendJoystickMessage ( const std::string & func,
const double val )
protected

Sends a joystick message to the entity.

Parameters
funcFunction name to trigger on the entity
valValue to send with the function (typically -1.0 to 1.0)

◆ aimMissile()

virtual void makVre::DtGunnerControlLogic::aimMissile ( double x,
double y )
protectedvirtual

Update missile's target point based on the x and y input. Called any time x and y are not 0.

◆ canFire()

virtual bool makVre::DtGunnerControlLogic::canFire ( )
protectedvirtual

Returns true if the weapon can fire. Checks for range, azimuth and isArmed.

Member Data Documentation

◆ myPreviousMunitionType

std::string makVre::DtGunnerControlLogic::myPreviousMunitionType
protected

Previously used munition name, used to detect changes.

◆ myMainControlGroup

std::string makVre::DtGunnerControlLogic::myMainControlGroup
protected

Primary control group name for this gunner station.

◆ myInputLogic

DtInputLogic makVre::DtGunnerControlLogic::myInputLogic
protected

Input logic that handles mapping of input actions to functions.

◆ mySystemName

std::string makVre::DtGunnerControlLogic::mySystemName
protected

Name of the weapon system controlled by this gunner.

◆ myResourceLogic

DtWeaponResourceLogic* makVre::DtGunnerControlLogic::myResourceLogic
protected

Pointer to the weapon resource logic component.

◆ myZoomLevels

std::vector<double> makVre::DtGunnerControlLogic::myZoomLevels
protected

Available zoom magnification levels.

◆ myZoomIndex

int makVre::DtGunnerControlLogic::myZoomIndex
protected

Current index into the zoom levels array.

◆ myExtendedWeaponSystems

makVre::DtInitTable makVre::DtGunnerControlLogic::myExtendedWeaponSystems
protected

Configuration table for extended weapon systems.

◆ myCurrentExtendedSystem

makVre::DtInitTable makVre::DtGunnerControlLogic::myCurrentExtendedSystem
protected

Configuration for the currently active extended weapon system.

◆ myTargetLocation

DtVector makVre::DtGunnerControlLogic::myTargetLocation
protected

Current target location for extended weapon systems.

◆ myTargetElement

makVrv::DtElementID makVre::DtGunnerControlLogic::myTargetElement
protected

Element ID of the current target.

◆ mySlewToCueTargetSystem

std::string makVre::DtGunnerControlLogic::mySlewToCueTargetSystem
protected

Name of the target system for slew-to-cue functionality.

◆ mySlewToCueActive

bool makVre::DtGunnerControlLogic::mySlewToCueActive
protected

Flag indicating if slew-to-cue is currently active.

◆ mySlewToCueUpdateRate

double makVre::DtGunnerControlLogic::mySlewToCueUpdateRate
protected

Rate at which to send slew-to-cue updates (seconds)

◆ mySlewToCueTimer

double makVre::DtGunnerControlLogic::mySlewToCueTimer
protected

Timer for tracking when to send the next slew-to-cue update.

◆ mySlewToCueUpdateDeltaThreshold

double makVre::DtGunnerControlLogic::mySlewToCueUpdateDeltaThreshold
protected

Threshold for determining when to send updates based on angle change.

◆ mySlewToCueLastSentVector

DtVector makVre::DtGunnerControlLogic::mySlewToCueLastSentVector
protected

Last direction vector sent in a slew-to-cue message.

◆ myAltRole

std::string makVre::DtGunnerControlLogic::myAltRole
protected

Name of the alternate role to switch to.

◆ myIsOverrideRole

bool makVre::DtGunnerControlLogic::myIsOverrideRole
protected

Flag indicating if this gunner is in override mode.

◆ myOverrideSystem

std::string makVre::DtGunnerControlLogic::myOverrideSystem
protected

Name of the system to override.

◆ myCycleWeaponFlag

bool makVre::DtGunnerControlLogic::myCycleWeaponFlag
protected

Flag indicating if a weapon cycle operation is in progress.

◆ myDelayedCycleWeaponTimer

double makVre::DtGunnerControlLogic::myDelayedCycleWeaponTimer
protected

Timer for delaying weapon cycling operations.

◆ myForceResourceType

std::string makVre::DtGunnerControlLogic::myForceResourceType
protected

Allow the configuration to specify a resource name directly.

◆ myResourceHandle

DtAttributeHandle makVre::DtGunnerControlLogic::myResourceHandle
protected

◆ myMunitionHandle

DtAttributeHandle makVre::DtGunnerControlLogic::myMunitionHandle
protected

◆ myMissileX

double makVre::DtGunnerControlLogic::myMissileX
protected

◆ myMissileY

double makVre::DtGunnerControlLogic::myMissileY
protected

◆ myMinRange

double makVre::DtGunnerControlLogic::myMinRange
protected

◆ myMaxRange

double makVre::DtGunnerControlLogic::myMaxRange
protected

◆ myPreviousMissileInFlight

bool makVre::DtGunnerControlLogic::myPreviousMissileInFlight
protected

◆ myMinGunAzimuth

double makVre::DtGunnerControlLogic::myMinGunAzimuth
protected

◆ myMaxGunAzimuth

double makVre::DtGunnerControlLogic::myMaxGunAzimuth
protected

◆ myAzimuthStateAttribute

std::string makVre::DtGunnerControlLogic::myAzimuthStateAttribute
protected

◆ myArmedStateProperty

std::string makVre::DtGunnerControlLogic::myArmedStateProperty
protected

The documentation for this class was generated from the following file: