@@ -3486,89 +3486,75 @@ void AHuman::Update()
3486
3486
// Fire/Activate held devices
3487
3487
3488
3488
ThrownDevice *pThrown = nullptr ;
3489
- if (m_pFGArm && m_pFGArm->IsAttached ())
3490
- {
3491
- // DOn't reach toward anything
3492
- m_pFGArm->ReachToward (Vector ());
3493
-
3494
- // Activate held device, if it's not a thrown device.
3495
- if (m_pFGArm->HoldsHeldDevice () && !m_pFGArm->HoldsThrownDevice ())
3496
- {
3497
- m_pFGArm->GetHeldDevice ()->SetSharpAim (m_SharpAimProgress);
3498
- if (m_Controller.IsState (WEAPON_FIRE))
3499
- m_pFGArm->GetHeldDevice ()->Activate ();
3500
- else
3501
- m_pFGArm->GetHeldDevice ()->Deactivate ();
3502
- }
3503
- // Throw whatever is held if it's a thrown device
3504
- else if (m_pFGArm->GetHeldMO ())
3505
- {
3506
- pThrown = dynamic_cast <ThrownDevice *>(m_pFGArm->GetHeldMO ());
3507
- if (pThrown)
3508
- {
3509
- if (m_Controller.IsState (WEAPON_FIRE))
3510
- {
3511
- if (m_ArmsState != THROWING_PREP/* || m_ThrowTmr.GetElapsedSimTimeMS() > m_ThrowPrepTime*/ )
3512
- {
3513
- m_ThrowTmr.Reset ();
3489
+ if (m_pFGArm && m_pFGArm->IsAttached ()) {
3490
+ // DOn't reach toward anything
3491
+ m_pFGArm->ReachToward (Vector ());
3492
+
3493
+ // Activate held device, if it's not a thrown device.
3494
+ if (m_pFGArm->HoldsHeldDevice () && !m_pFGArm->HoldsThrownDevice ()) {
3495
+ m_pFGArm->GetHeldDevice ()->SetSharpAim (m_SharpAimProgress);
3496
+ if (m_Controller.IsState (WEAPON_FIRE)) {
3497
+ m_pFGArm->GetHeldDevice ()->Activate ();
3498
+ } else {
3499
+ m_pFGArm->GetHeldDevice ()->Deactivate ();
3500
+ }
3501
+ }
3502
+ // Throw whatever is held if it's a thrown device
3503
+ else if (m_pFGArm->GetHeldMO ()) {
3504
+ pThrown = dynamic_cast <ThrownDevice *>(m_pFGArm->GetHeldMO ());
3505
+ if (pThrown) {
3506
+ if (m_Controller.IsState (WEAPON_FIRE)) {
3507
+ if (m_ArmsState != THROWING_PREP/* || m_ThrowTmr.GetElapsedSimTimeMS() > m_ThrowPrepTime*/ ) {
3508
+ m_ThrowTmr.Reset ();
3514
3509
if (!pThrown->ActivatesWhenReleased ()) {
3515
3510
pThrown->Activate ();
3516
3511
}
3517
- }
3518
- m_ArmsState = THROWING_PREP;
3519
- m_pFGArm->ReachToward (m_Pos + pThrown->GetStartThrowOffset ().GetXFlipped (m_HFlipped));
3520
- }
3521
- else if (m_ArmsState == THROWING_PREP)
3522
- {
3523
- m_ArmsState = THROWING_RELEASE;
3524
-
3525
- m_pFGArm->SetHandPos (m_Pos + pThrown->GetEndThrowOffset ().GetXFlipped (m_HFlipped));
3512
+ }
3513
+ m_ArmsState = THROWING_PREP;
3514
+ m_pFGArm->ReachToward (m_Pos + pThrown->GetStartThrowOffset ().GetXFlipped (m_HFlipped));
3515
+ } else if (m_ArmsState == THROWING_PREP) {
3516
+ m_ArmsState = THROWING_RELEASE;
3517
+
3518
+ m_pFGArm->SetHandPos (m_Pos + pThrown->GetEndThrowOffset ().GetXFlipped (m_HFlipped));
3526
3519
3527
- MovableObject *pMO = m_pFGArm->ReleaseHeldMO ();
3520
+ MovableObject *pMO = m_pFGArm->ReleaseHeldMO ();
3528
3521
3529
3522
if (pThrown->ActivatesWhenReleased ()) {
3530
3523
pThrown->Activate ();
3531
3524
}
3532
- if (pMO)
3533
- {
3534
- pMO->SetPos (m_Pos + m_pFGArm->GetParentOffset ().GetXFlipped (m_HFlipped) + Vector (m_HFlipped ? -15 : 15 , -8 ));
3535
- float throwScalar = (float )MIN (m_ThrowTmr.GetElapsedSimTimeMS (), m_ThrowPrepTime) / (float )m_ThrowPrepTime;
3536
- Vector tossVec (pThrown->GetMinThrowVel () + ((pThrown->GetMaxThrowVel () - pThrown->GetMinThrowVel ()) * throwScalar), 0 .5F * RandomNormalNum ());
3537
- tossVec.RadRotate (m_AimAngle);
3538
- pMO->SetVel (tossVec.GetXFlipped (m_HFlipped) * m_Rotation);
3539
- pMO->SetAngularVel (5 .0F * RandomNormalNum ());
3540
-
3541
- if (pMO->IsHeldDevice ())
3542
- {
3543
- // Set the grenade or whatever to ignore hits with same team
3544
- pMO->SetTeam (m_Team);
3545
- pMO->SetIgnoresTeamHits (true );
3546
- g_MovableMan.AddItem (pMO);
3547
- }
3548
- else
3549
- {
3550
- if (pMO->IsGold ())
3551
- {
3552
- m_GoldInInventoryChunk = 0 ;
3553
- ChunkGold ();
3554
- }
3555
- g_MovableMan.AddParticle (pMO);
3556
- }
3557
- pMO = 0 ;
3558
- }
3559
- m_ThrowTmr.Reset ();
3560
- }
3561
- }
3562
- }
3563
- else if (m_ArmsState == THROWING_RELEASE && m_ThrowTmr.GetElapsedSimTimeMS () > 100 )
3564
- {
3565
- m_pFGArm->SetHeldMO (SwapNextInventory ());
3566
- m_pFGArm->SetHandPos (m_Pos + m_HolsterOffset.GetXFlipped (m_HFlipped));
3567
- m_ArmsState = WEAPON_READY;
3568
- }
3569
- else if (m_ArmsState == THROWING_RELEASE)
3570
- m_pFGArm->SetHandPos (m_Pos + (m_HolsterOffset + Vector (15 , -15 )).GetXFlipped (m_HFlipped));
3571
- }
3525
+ if (pMO) {
3526
+ pMO->SetPos (m_Pos + m_pFGArm->GetParentOffset ().GetXFlipped (m_HFlipped) + Vector (m_HFlipped ? -15 : 15 , -8 ));
3527
+ float throwScalar = (float )MIN (m_ThrowTmr.GetElapsedSimTimeMS (), m_ThrowPrepTime) / (float )m_ThrowPrepTime;
3528
+ Vector tossVec (pThrown->GetMinThrowVel () + ((pThrown->GetMaxThrowVel () - pThrown->GetMinThrowVel ()) * throwScalar), 0 .5F * RandomNormalNum ());
3529
+ tossVec.RadRotate (m_AimAngle);
3530
+ pMO->SetVel (tossVec.GetXFlipped (m_HFlipped) * m_Rotation);
3531
+ pMO->SetAngularVel (5 .0F * RandomNormalNum ());
3532
+
3533
+ if (pMO->IsHeldDevice ()) {
3534
+ // Set the grenade or whatever to ignore hits with same team
3535
+ pMO->SetTeam (m_Team);
3536
+ pMO->SetIgnoresTeamHits (true );
3537
+ g_MovableMan.AddItem (pMO);
3538
+ } else {
3539
+ if (pMO->IsGold ()) {
3540
+ m_GoldInInventoryChunk = 0 ;
3541
+ ChunkGold ();
3542
+ }
3543
+ g_MovableMan.AddParticle (pMO);
3544
+ }
3545
+ pMO = 0 ;
3546
+ }
3547
+ m_ThrowTmr.Reset ();
3548
+ }
3549
+ }
3550
+ } else if (m_ArmsState == THROWING_RELEASE && m_ThrowTmr.GetElapsedSimTimeMS () > 100 ) {
3551
+ m_pFGArm->SetHeldMO (SwapNextInventory ());
3552
+ m_pFGArm->SetHandPos (m_Pos + m_HolsterOffset.GetXFlipped (m_HFlipped));
3553
+ m_ArmsState = WEAPON_READY;
3554
+ } else if (m_ArmsState == THROWING_RELEASE) {
3555
+ m_pFGArm->SetHandPos (m_Pos + (m_HolsterOffset + Vector (15 , -15 )).GetXFlipped (m_HFlipped));
3556
+ }
3557
+ }
3572
3558
3573
3559
if (!pThrown && m_ArmsState == THROWING_PREP) {
3574
3560
m_ArmsState = WEAPON_READY;
@@ -4673,23 +4659,23 @@ void AHuman::Draw(BITMAP *pTargetBitmap,
4673
4659
m_Paths[m_HFlipped][CLIMB].Draw (pTargetBitmap, targetPos, 165 );
4674
4660
}
4675
4661
4676
- if (mode == g_DrawColor && !onlyPhysical)
4677
- {
4678
- acquire_bitmap (pTargetBitmap);
4679
- putpixel (pTargetBitmap, std::floor (m_Pos.m_X ),
4680
- std::floor (m_Pos.m_Y ),
4681
- 64 );
4682
- putpixel (pTargetBitmap, std::floor (m_Pos.m_X ),
4683
- std::floor (m_Pos.m_Y ),
4684
- 64 );
4685
- release_bitmap (pTargetBitmap);
4686
-
4687
- // m_pAtomGroup->Draw(pTargetBitmap, targetPos, false, 122);
4688
- m_pFGFootGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4689
- m_pBGFootGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4690
- m_pFGHandGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4691
- m_pBGHandGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4692
- }
4662
+ if (mode == g_DrawColor && !onlyPhysical)
4663
+ {
4664
+ acquire_bitmap (pTargetBitmap);
4665
+ putpixel (pTargetBitmap, std::floor (m_Pos.m_X ),
4666
+ std::floor (m_Pos.m_Y ),
4667
+ 64 );
4668
+ putpixel (pTargetBitmap, std::floor (m_Pos.m_X ),
4669
+ std::floor (m_Pos.m_Y ),
4670
+ 64 );
4671
+ release_bitmap (pTargetBitmap);
4672
+
4673
+ // m_pAtomGroup->Draw(pTargetBitmap, targetPos, false, 122);
4674
+ m_pFGFootGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4675
+ m_pBGFootGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4676
+ m_pFGHandGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4677
+ m_pBGHandGroup->Draw (pTargetBitmap, targetPos, true , 13 );
4678
+ }
4693
4679
#endif
4694
4680
}
4695
4681
@@ -4700,71 +4686,69 @@ void AHuman::Draw(BITMAP *pTargetBitmap,
4700
4686
// Description: Draws this Actor's current graphical HUD overlay representation to a
4701
4687
// BITMAP of choice.
4702
4688
4703
- void AHuman::DrawHUD (BITMAP *pTargetBitmap, const Vector &targetPos, int whichScreen, bool playerControlled)
4704
- {
4705
- if (!m_HUDVisible)
4706
- return ;
4689
+ void AHuman::DrawHUD (BITMAP *pTargetBitmap, const Vector &targetPos, int whichScreen, bool playerControlled) {
4690
+ if (!m_HUDVisible)
4691
+ return ;
4707
4692
4708
- // Only do HUD if on a team
4709
- if (m_Team < 0 )
4710
- return ;
4693
+ // Only do HUD if on a team
4694
+ if (m_Team < 0 )
4695
+ return ;
4711
4696
4712
- // Only draw if the team viewing this is on the same team OR has seen the space where this is located
4713
- int viewingTeam = g_ActivityMan.GetActivity ()->GetTeamOfPlayer (g_ActivityMan.GetActivity ()->PlayerOfScreen (whichScreen));
4714
- if (viewingTeam != m_Team && viewingTeam != Activity::NoTeam)
4715
- {
4716
- if (g_SceneMan.IsUnseen (m_Pos.m_X , m_Pos.m_Y , viewingTeam))
4717
- return ;
4718
- }
4697
+ // Only draw if the team viewing this is on the same team OR has seen the space where this is located
4698
+ int viewingTeam = g_ActivityMan.GetActivity ()->GetTeamOfPlayer (g_ActivityMan.GetActivity ()->PlayerOfScreen (whichScreen));
4699
+ if (viewingTeam != m_Team && viewingTeam != Activity::NoTeam)
4700
+ {
4701
+ if (g_SceneMan.IsUnseen (m_Pos.m_X , m_Pos.m_Y , viewingTeam))
4702
+ return ;
4703
+ }
4719
4704
4720
- Actor::DrawHUD (pTargetBitmap, targetPos, whichScreen);
4705
+ Actor::DrawHUD (pTargetBitmap, targetPos, whichScreen);
4721
4706
4722
4707
#ifdef DEBUG_BUILD
4723
- // Limbpath debug drawing
4724
- m_Paths[FGROUND][WALK].Draw (pTargetBitmap, targetPos, 122 );
4725
- m_Paths[FGROUND][CRAWL].Draw (pTargetBitmap, targetPos, 122 );
4726
- m_Paths[FGROUND][ARMCRAWL].Draw (pTargetBitmap, targetPos, 13 );
4727
- m_Paths[FGROUND][CLIMB].Draw (pTargetBitmap, targetPos, 98 );
4728
-
4729
- m_Paths[BGROUND][WALK].Draw (pTargetBitmap, targetPos, 122 );
4730
- m_Paths[BGROUND][CRAWL].Draw (pTargetBitmap, targetPos, 122 );
4731
- m_Paths[BGROUND][ARMCRAWL].Draw (pTargetBitmap, targetPos, 13 );
4732
- m_Paths[BGROUND][CLIMB].Draw (pTargetBitmap, targetPos, 98 );
4733
-
4734
- // Draw the AI paths
4735
- list<Vector>::iterator last = m_MovePath.begin ();
4736
- Vector waypoint, lastPoint, lineVec;
4737
- for (list<Vector>::iterator lItr = m_MovePath.begin (); lItr != m_MovePath.end (); ++lItr)
4738
- {
4739
- lastPoint = (*last) - targetPos;
4740
- waypoint = lastPoint + g_SceneMan.ShortestDistance (lastPoint, (*lItr) - targetPos);
4741
- line (pTargetBitmap, lastPoint.m_X , lastPoint.m_Y , waypoint.m_X , waypoint.m_Y , g_RedColor);
4742
- last = lItr;
4743
- }
4744
- waypoint = m_MoveTarget - targetPos;
4745
- circlefill (pTargetBitmap, waypoint.m_X , waypoint.m_Y , 3 , g_RedColor);
4746
- lastPoint = m_PrevPathTarget - targetPos;
4747
- circlefill (pTargetBitmap, lastPoint.m_X , lastPoint.m_Y , 2 , g_YellowGlowColor);
4748
- lastPoint = m_DigTunnelEndPos - targetPos;
4749
- circlefill (pTargetBitmap, lastPoint.m_X , lastPoint.m_Y , 2 , g_YellowGlowColor);
4750
- // Raidus
4708
+ // Limbpath debug drawing
4709
+ m_Paths[FGROUND][WALK].Draw (pTargetBitmap, targetPos, 122 );
4710
+ m_Paths[FGROUND][CRAWL].Draw (pTargetBitmap, targetPos, 122 );
4711
+ m_Paths[FGROUND][ARMCRAWL].Draw (pTargetBitmap, targetPos, 13 );
4712
+ m_Paths[FGROUND][CLIMB].Draw (pTargetBitmap, targetPos, 98 );
4713
+
4714
+ m_Paths[BGROUND][WALK].Draw (pTargetBitmap, targetPos, 122 );
4715
+ m_Paths[BGROUND][CRAWL].Draw (pTargetBitmap, targetPos, 122 );
4716
+ m_Paths[BGROUND][ARMCRAWL].Draw (pTargetBitmap, targetPos, 13 );
4717
+ m_Paths[BGROUND][CLIMB].Draw (pTargetBitmap, targetPos, 98 );
4718
+
4719
+ // Draw the AI paths
4720
+ list<Vector>::iterator last = m_MovePath.begin ();
4721
+ Vector waypoint, lastPoint, lineVec;
4722
+ for (list<Vector>::iterator lItr = m_MovePath.begin (); lItr != m_MovePath.end (); ++lItr)
4723
+ {
4724
+ lastPoint = (*last) - targetPos;
4725
+ waypoint = lastPoint + g_SceneMan.ShortestDistance (lastPoint, (*lItr) - targetPos);
4726
+ line (pTargetBitmap, lastPoint.m_X , lastPoint.m_Y , waypoint.m_X , waypoint.m_Y , g_RedColor);
4727
+ last = lItr;
4728
+ }
4729
+ waypoint = m_MoveTarget - targetPos;
4730
+ circlefill (pTargetBitmap, waypoint.m_X , waypoint.m_Y , 3 , g_RedColor);
4731
+ lastPoint = m_PrevPathTarget - targetPos;
4732
+ circlefill (pTargetBitmap, lastPoint.m_X , lastPoint.m_Y , 2 , g_YellowGlowColor);
4733
+ lastPoint = m_DigTunnelEndPos - targetPos;
4734
+ circlefill (pTargetBitmap, lastPoint.m_X , lastPoint.m_Y , 2 , g_YellowGlowColor);
4735
+ // Raidus
4751
4736
// waypoint = m_Pos - targetPos;
4752
4737
// circle(pTargetBitmap, waypoint.m_X, waypoint.m_Y, m_MoveProximityLimit, g_RedColor);
4753
4738
#endif
4754
4739
4755
- // Player AI drawing
4740
+ // Player AI drawing
4741
+
4742
+ // Device aiming reticule
4743
+ if (m_Controller.IsState (AIM_SHARP) && m_pFGArm && m_pFGArm->IsAttached () && m_pFGArm->HoldsHeldDevice ()) {
4744
+ m_pFGArm->GetHeldDevice ()->DrawHUD (pTargetBitmap, targetPos, whichScreen, m_Controller.IsPlayerControlled ());
4745
+ }
4756
4746
4757
- // Device aiming reticule
4758
- if (m_Controller.IsState (AIM_SHARP) &&
4759
- m_pFGArm && m_pFGArm->IsAttached () && m_pFGArm->HoldsHeldDevice ())
4760
- m_pFGArm->GetHeldDevice ()->DrawHUD (pTargetBitmap, targetPos, whichScreen, m_Controller.IsPlayerControlled ());
4761
-
4762
4747
4763
- // Throwing reticule
4764
- if (m_ArmsState == THROWING_PREP)
4765
- DrawThrowingReticule (pTargetBitmap,
4766
- targetPos,
4767
- MIN ((float )m_ThrowTmr.GetElapsedSimTimeMS () / (float )m_ThrowPrepTime, 1.0 ));
4748
+ // Throwing reticule
4749
+ if (m_ArmsState == THROWING_PREP) {
4750
+ DrawThrowingReticule (pTargetBitmap, targetPos, std::min (static_cast <float >(m_ThrowTmr.GetElapsedSimTimeMS () / m_ThrowPrepTime), 1 .0F ));
4751
+ }
4768
4752
4769
4753
// ////////////////////////////////////
4770
4754
// Draw stat info HUD
0 commit comments