Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 973eb24

Browse files
authored
Merge pull request #505 from cortex-command-community/4zk-content-source
Source fixes for pre-release 5.1
2 parents f612dec + 07b10e4 commit 973eb24

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

Entities/AHuman.cpp

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ bool AHuman::UnequipBGArm() {
12981298
if (m_pBGArm) {
12991299
if (HeldDevice *heldDevice = m_pBGArm->GetHeldDevice()) {
13001300
heldDevice->Deactivate();
1301-
AddToInventoryBack(m_pBGArm->RemoveAttachable(heldDevice));
1301+
AddToInventoryFront(m_pBGArm->RemoveAttachable(heldDevice));
13021302
m_pBGArm->SetHandPos(m_Pos + RotateOffset(m_HolsterOffset));
13031303
return true;
13041304
}
@@ -3151,7 +3151,10 @@ void AHuman::Update()
31513151
}
31523152
}
31533153
// Disengage the prone state as soon as crouch is released.
3154-
if (!crouching) { m_ProneState = NOTPRONE; }
3154+
if (!crouching && m_ProneState != NOTPRONE) {
3155+
EquipShieldInBGArm();
3156+
m_ProneState = NOTPRONE;
3157+
}
31553158
}
31563159

31573160
////////////////////////////////////
@@ -3303,6 +3306,8 @@ void AHuman::Update()
33033306
if (deviceAsFirearm->FiredOnce()) {
33043307
m_CanActivateBGItem = true;
33053308
m_TriggerPulled = true;
3309+
} else {
3310+
m_CanActivateBGItem = !deviceAsFirearm->CanFire();
33063311
}
33073312
}
33083313
}
@@ -3399,6 +3404,8 @@ void AHuman::Update()
33993404
if (deviceAsFirearm->FiredOnce()) {
34003405
m_CanActivateBGItem = false;
34013406
m_TriggerPulled = true;
3407+
} else {
3408+
m_CanActivateBGItem = deviceAsFirearm->CanFire();
34023409
}
34033410
}
34043411
} else {
@@ -3448,27 +3455,31 @@ void AHuman::Update()
34483455
// Item dropping logic
34493456

34503457
if (m_Controller.IsState(WEAPON_DROP) && m_Status != INACTIVE) {
3451-
bool anyDropped = false;
3458+
Arm *dropperArm = nullptr;
34523459
for (Arm *arm : { m_pFGArm, m_pBGArm }) {
3453-
if (!anyDropped && arm && arm->GetHeldDevice()) {
3460+
if (arm && arm->GetHeldDevice()) {
34543461
HeldDevice *heldDevice = arm->GetHeldDevice();
34553462
arm->RemoveAttachable(heldDevice, true, false);
3463+
if (dropperArm) {
3464+
if (heldDevice) {
3465+
dropperArm->SetHeldDevice(heldDevice);
3466+
arm->SetHandPos(dropperArm->GetPos());
3467+
}
3468+
} else {
3469+
heldDevice->SetPos(arm->GetJointPos() + Vector(arm->GetMaxLength() * GetFlipFactor(), 0).RadRotate(adjustedAimAngle));
3470+
Vector tossVec(1.0F + std::sqrt(std::abs(arm->GetThrowStrength()) / std::sqrt(std::abs(heldDevice->GetMass()) + 1.0F)), RandomNormalNum());
3471+
heldDevice->SetVel(heldDevice->GetVel() * 0.5F + tossVec.RadRotate(m_AimAngle).GetXFlipped(m_HFlipped));
3472+
heldDevice->SetAngularVel(heldDevice->GetAngularVel() + m_AngularVel * 0.5F + 3.0F * RandomNormalNum());
34563473

3457-
heldDevice->SetPos(arm->GetJointPos() + Vector(arm->GetMaxLength() * GetFlipFactor(), 0).RadRotate(adjustedAimAngle));
3458-
Vector tossVec(1.0F + std::sqrt(std::abs(arm->GetThrowStrength()) / std::sqrt(std::abs(heldDevice->GetMass()) + 1.0F)), RandomNormalNum());
3459-
heldDevice->SetVel(heldDevice->GetVel() * 0.5F + tossVec.RadRotate(m_AimAngle).GetXFlipped(m_HFlipped));
3460-
heldDevice->SetAngularVel(heldDevice->GetAngularVel() + m_AngularVel * 0.5F + 3.0F * RandomNormalNum());
3461-
3462-
arm->SetHandPos(heldDevice->GetPos());
3463-
if (!m_Inventory.empty()) {
3464-
arm->SetHeldDevice(dynamic_cast<HeldDevice *>(SwapNextInventory()));
3465-
arm->SetHandPos(m_Pos + RotateOffset(m_HolsterOffset));
3474+
arm->SetHandPos(heldDevice->GetPos());
34663475
}
3467-
anyDropped = true;
3468-
break;
3476+
dropperArm = arm;
3477+
} else if (dropperArm && !m_Inventory.empty()) {
3478+
dropperArm->SetHeldDevice(dynamic_cast<HeldDevice*>(SwapNextInventory()));
3479+
dropperArm->SetHandPos(m_Pos + RotateOffset(m_HolsterOffset));
34693480
}
34703481
}
3471-
if (!anyDropped && !m_Inventory.empty() && !m_pFGArm) {
3482+
if (!dropperArm && !m_Inventory.empty() && !m_pFGArm) {
34723483
DropAllInventory();
34733484
if (m_pBGArm) {
34743485
m_pBGArm->SetHandPos(m_Pos + RotateOffset(m_HolsterOffset));

Entities/Actor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ void Actor::Update()
15401540
////////////////////////////////
15411541
// Death logic
15421542

1543-
if (m_Status != DYING && m_Status != DEAD && std::round(m_Health) <= 0) {
1543+
if (m_Status != DYING && m_Status != DEAD && m_Health <= 0) {
15441544
if (m_DeathSound) { m_DeathSound->Play(m_Pos); }
15451545
m_Controller.SetDisabled(true);
15461546
DropAllInventory();
@@ -1803,7 +1803,7 @@ void Actor::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
18031803
pSymbolFont->DrawAligned(&bitmapInt, drawPos.m_X - 11, drawPos.m_Y + m_HUDStack, str, GUIFont::Left);
18041804
}
18051805
*/
1806-
std::snprintf(str, sizeof(str), "%.0f", m_Health);
1806+
std::snprintf(str, sizeof(str), "%.0f", std::ceil(m_Health));
18071807
pSymbolFont->DrawAligned(&bitmapInt, drawPos.m_X - 0, drawPos.m_Y + m_HUDStack, str, GUIFont::Left);
18081808

18091809
m_HUDStack += -12;

Entities/HDFirearm.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,14 +1172,12 @@ void HDFirearm::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whic
11721172
}
11731173

11741174
float sharpLength = std::max(m_MaxSharpLength * m_SharpAim, 20.0F);
1175-
int glowStrength;
1175+
int glowStrength = RandomNum(95, 159);
11761176
int pointCount;
11771177
if (playerControlled && sharpLength > 20.0F) {
11781178
pointCount = m_SharpAim > 0.5F ? 4 : 3;
1179-
glowStrength = RandomNum(127, 255);
11801179
} else {
11811180
pointCount = 2;
1182-
glowStrength = RandomNum(63, 127);
11831181
}
11841182
int pointSpacing = 10 - pointCount;
11851183
sharpLength -= static_cast<float>(pointSpacing * pointCount) * 0.5F;

Entities/HDFirearm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ AddScriptFunctionNames(HeldDevice, "OnFire", "OnReload");
821821
/// Gets whether this HDFirearm is ready to be fired.
822822
/// </summary>
823823
/// <returns>Whether this HDFirearm is ready to pop another Round.</returns>
824-
bool CanFire() const { return m_ActivationTimer.IsPastSimMS(GetMSPerRound()); }
824+
bool CanFire() const { return m_LastFireTmr.IsPastSimMS(GetMSPerRound()); }
825825

826826
/// <summary>
827827
/// Gets whether this HDFirearm is halfway to be fired. Used for evenly spacing out dual-wielded fire.

0 commit comments

Comments
 (0)