MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SwitchToFire

Method SwitchToFire

engine/Poseidon/UI/InGame/InGameUIMenuSim.cpp:1519–1552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1517 _mouseDown = false;
1518 }
1519}
1520
1521void InGameUI::SwitchToFire(EntityAI* vehicle)
1522{
1523 if (ModeIsStrategy(_mode))
1524 {
1525 _modeAuto = _mode = UIFire;
1526 // set cursor to current weapon direction
1527 int weapon = vehicle->SelectedWeapon();
1528 weapon = ValidateWeapon(vehicle, weapon);
1529
1530 if (vehicle)
1531 {
1532 AIUnit* unit = GWorld->FocusOn();
1533 bool isObserver = unit && unit == vehicle->ObserverUnit();
1534 bool isGunner = unit && unit == vehicle->GunnerUnit();
1535
1536 if (isObserver)
1537 {
1538 SetCursorDirection(vehicle->GetEyeDirection());
1539 }
1540 else if (isGunner && weapon >= 0)
1541 {
1542 SetCursorDirection(vehicle->GetWeaponDirection(weapon));
1543 }
1544 else
1545 {
1546 SetCursorDirection(vehicle->Direction());
1547 }
1548 _worldCursorTime = Glob.uiTime;
1549 }
1550
1551 _dragging = false;
1552 _mouseDown = false;
1553 }
1554}
1555

Callers

nothing calls this directly

Calls 8

ValidateWeaponFunction · 0.85
SelectedWeaponMethod · 0.80
FocusOnMethod · 0.80
ObserverUnitMethod · 0.45
GunnerUnitMethod · 0.45
GetEyeDirectionMethod · 0.45
GetWeaponDirectionMethod · 0.45
DirectionMethod · 0.45

Tested by

no test coverage detected