Skip to content

Commit 0c4bb8d

Browse files
authored
Merge branch 'development' into inventory-management
2 parents c7c5e85 + b6e5c5d commit 0c4bb8d

File tree

7 files changed

+52
-24
lines changed

7 files changed

+52
-24
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
125125

126126
- `Scene` Lua functions `AddNavigatableArea(areaName)` and `ClearNavigatableAreas()` have been renamed/corrected to `AddNavigableArea(areaName)` and `ClearNavigableAreas()`, respectively.
127127

128+
- `MOSRotating` Lua function `AddWound` now additionally accepts the format `MOSRotating:AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet, bool checkGibWoundLimit, bool isEntryWound, bool isExitWound)`, allowing modders to specify added wounds as entry- or exit wounds, for the purpose of not playing multiple burst sounds on the same frame. These new arguments are optional.
129+
128130
</details>
129131

130132
<details><summary><b>Fixed</b></summary>

Source/Entities/AEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,9 @@ void AEmitter::Update() {
397397
float throttleFactor = GetThrottleFactor();
398398
m_FlashScale = throttleFactor;
399399
// Check burst triggering against whether the spacing is fulfilled
400-
if (m_PlayBurstSound && m_BurstTriggered && CanTriggerBurst()) {
400+
if (m_BurstTriggered && CanTriggerBurst()) {
401401
// Play burst sound
402-
if (m_BurstSound) {
402+
if (m_BurstSound && m_PlayBurstSound) {
403403
m_BurstSound->Play(m_Pos);
404404
}
405405
// Start timing until next burst

Source/Entities/MOSRotating.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ void MOSRotating::Clear() {
5656
m_RecoilForce.Reset();
5757
m_RecoilOffset.Reset();
5858
m_Wounds.clear();
59-
m_WoundBurstSoundPlayedThisFrame = false;
59+
m_EntryWoundBurstSoundPlayedThisFrame = false;
60+
m_ExitWoundBurstSoundPlayedThisFrame = false;
6061
m_Attachables.clear();
6162
m_ReferenceHardcodedAttachableUniqueIDs.clear();
6263
m_HardcodedAttachableUniqueIDsAndSetters.clear();
@@ -443,7 +444,7 @@ void MOSRotating::DetachAttachablesFromImpulse(Vector& impulseVector) {
443444
impulseVector.SetMagnitude(impulseRemainder);
444445
}
445446

446-
void MOSRotating::AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet, bool checkGibWoundLimit) {
447+
void MOSRotating::AddWoundExt(AEmitter* woundToAdd, const Vector& parentOffsetToSet, bool checkGibWoundLimit, bool isEntryWound, bool isExitWound) {
447448
if (woundToAdd && !m_ToDelete) {
448449
if (checkGibWoundLimit && m_GibWoundLimit > 0 && m_Wounds.size() + 1 >= m_GibWoundLimit) {
449450
// Find and detach an attachable near the new wound before gibbing the object itself. TODO: Perhaps move this to Actor, since it's more relevant there?
@@ -462,10 +463,21 @@ void MOSRotating::AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet
462463
woundToAdd->SetParent(this);
463464
woundToAdd->SetIsWound(true);
464465
if (woundToAdd->GetBurstSound()) {
465-
if (m_WoundBurstSoundPlayedThisFrame) {
466-
woundToAdd->SetPlayBurstSound(false);
466+
if (isEntryWound) {
467+
if (m_EntryWoundBurstSoundPlayedThisFrame) {
468+
woundToAdd->SetPlayBurstSound(false);
469+
} else {
470+
m_EntryWoundBurstSoundPlayedThisFrame = true;
471+
}
472+
}
473+
474+
if (isExitWound) {
475+
if (m_ExitWoundBurstSoundPlayedThisFrame) {
476+
woundToAdd->SetPlayBurstSound(false);
477+
} else {
478+
m_ExitWoundBurstSoundPlayedThisFrame = true;
479+
}
467480
}
468-
m_WoundBurstSoundPlayedThisFrame = true;
469481
}
470482
if (woundToAdd->HasNoSetDamageMultiplier()) {
471483
woundToAdd->SetDamageMultiplier(1.0F);
@@ -475,6 +487,10 @@ void MOSRotating::AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet
475487
}
476488
}
477489

490+
void MOSRotating::AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet, bool checkGibWoundLimit) {
491+
AddWoundExt(woundToAdd, parentOffsetToSet, checkGibWoundLimit, false, false);
492+
}
493+
478494
float MOSRotating::RemoveWounds(int numberOfWoundsToRemove, bool includePositiveDamageAttachables, bool includeNegativeDamageAttachables, bool includeNoDamageAttachables) {
479495
float damage = 0;
480496
int woundCount = GetWoundCount(includePositiveDamageAttachables, includeNegativeDamageAttachables, includeNoDamageAttachables);
@@ -812,7 +828,7 @@ bool MOSRotating::ParticlePenetration(HitData& hd) {
812828
pEntryWound->SetDamageMultiplier(damageMultiplier * hd.Body[HITOR]->WoundDamageMultiplier());
813829
// Adjust position so that it looks like the hole is actually *on* the Hitee.
814830
entryPos[dom] += increment[dom] * (pEntryWound->GetSpriteWidth() / 2);
815-
AddWound(pEntryWound, entryPos + m_SpriteOffset);
831+
AddWoundExt(pEntryWound, entryPos + m_SpriteOffset, true, true, false);
816832
pEntryWound = 0;
817833
}
818834

@@ -828,7 +844,7 @@ bool MOSRotating::ParticlePenetration(HitData& hd) {
828844
pExitWound->SetInheritedRotAngleOffset(dir.GetAbsRadAngle());
829845
float damageMultiplier = pExitWound->HasNoSetDamageMultiplier() ? 1.0F : pExitWound->GetDamageMultiplier();
830846
pExitWound->SetDamageMultiplier(damageMultiplier * hd.Body[HITOR]->WoundDamageMultiplier());
831-
AddWound(pExitWound, exitPos + m_SpriteOffset);
847+
AddWoundExt(pExitWound, exitPos + m_SpriteOffset, true, false, true);
832848
pExitWound = 0;
833849
}
834850

@@ -1366,7 +1382,8 @@ void MOSRotating::Update() {
13661382
m_Rotation += radsToGo * m_OrientToVel * velInfluence;
13671383
}
13681384

1369-
m_WoundBurstSoundPlayedThisFrame = false;
1385+
m_EntryWoundBurstSoundPlayedThisFrame = false;
1386+
m_ExitWoundBurstSoundPlayedThisFrame = false;
13701387

13711388
for (auto woundItr = m_Wounds.begin(); woundItr != m_Wounds.end();) {
13721389
AEmitter* wound = *woundItr;

Source/Entities/MOSRotating.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ namespace RTE {
416416
/// @param checkGibWoundLimit Whether to gib this MOSRotating if adding this wound raises its wound count past its gib wound limit. Defaults to true.
417417
virtual void AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet, bool checkGibWoundLimit = true);
418418

419+
/// Adds the passed in wound AEmitter to the list of wounds and changes its parent offset to the passed in Vector.
420+
/// @param woundToAdd The wound AEmitter to add.
421+
/// @param parentOffsetToSet The vector to set as the wound AEmitter's parent offset.
422+
/// @param checkGibWoundLimit Whether to gib this MOSRotating if adding this wound raises its wound count past its gib wound limit. Defaults to true.
423+
virtual void AddWoundExt(AEmitter* woundToAdd, const Vector& parentOffsetToSet, bool checkGibWoundLimit = true, bool isEntryWound = false, bool isExitWound = false);
424+
419425
/// Removes the specified number of wounds from this MOSRotating, and returns damage caused by these removed wounds.
420426
/// Includes any Attachables (and their Attachables, etc.) that have a positive damage multiplier.
421427
/// @param numberOfWoundsToRemove The number of wounds that should be removed.
@@ -540,8 +546,10 @@ namespace RTE {
540546
Vector m_RecoilOffset;
541547
// The list of wound AEmitters currently attached to this MOSRotating, and owned here as well.
542548
std::vector<AEmitter*> m_Wounds;
543-
// Whether we added a wound with a BurstSound this frame or not, so we can disable further ones to avoid audio spam.
544-
bool m_WoundBurstSoundPlayedThisFrame;
549+
// Whether we added an entry wound with a BurstSound this frame or not, so we can disable further ones to avoid audio spam.
550+
bool m_EntryWoundBurstSoundPlayedThisFrame;
551+
// Whether we added an exit wound with a BurstSound this frame or not.
552+
bool m_ExitWoundBurstSoundPlayedThisFrame;
545553
// The list of Attachables currently attached and Owned by this.
546554
std::list<Attachable*> m_Attachables;
547555
std::unordered_set<unsigned long> m_ReferenceHardcodedAttachableUniqueIDs; //!< An unordered set is filled with the Unique IDs of all of the reference object's hardcoded Attachables when using the copy Create.

Source/Lua/LuaBindingsEntities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, MOSRotating) {
886886
.def("GetWounds", &LuaAdaptersMOSRotating::GetWounds1, luabind::adopt(luabind::return_value) + luabind::return_stl_iterator)
887887
.def("GetWounds", &LuaAdaptersMOSRotating::GetWounds2, luabind::adopt(luabind::return_value) + luabind::return_stl_iterator)
888888
.def("AddWound", &MOSRotating::AddWound, luabind::adopt(_2))
889+
.def("AddWound", &MOSRotating::AddWoundExt, luabind::adopt(_2))
889890
.def("RemoveWounds", (float(MOSRotating::*)(int numberOfWoundsToRemove)) & MOSRotating::RemoveWounds)
890891
.def("RemoveWounds", (float(MOSRotating::*)(int numberOfWoundsToRemove, bool positiveDamage, bool negativeDamage, bool noDamage)) & MOSRotating::RemoveWounds)
891892
.def("IsOnScenePoint", &MOSRotating::IsOnScenePoint)

Source/System/DataModule.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,26 +492,30 @@ bool DataModule::AddToTypeMap(Entity* entityToAdd) {
492492
}
493493

494494
void DataModule::CheckSupportedGameVersion() const {
495+
static const std::string contactAuthor = "Please contact the mod author or ask for help in the CCCP discord server.";
496+
497+
RTEAssert(m_SupportedGameVersion, m_FileName + " does not specify a supported Cortex Command version, so it is not compatible with this version of Cortex Command (" + c_GameVersion.str() + ")\n\n" + contactAuthor);
498+
499+
if (!m_SupportedGameVersion) {
500+
return;
501+
}
502+
495503
if (*m_SupportedGameVersion == c_GameVersion) {
496504
return;
497505
}
498506

499-
static const std::string contactAuthor = "Please contact the mod author or ask for help in the CCCP discord server.";
500-
501-
RTEAssert(m_SupportedGameVersion, m_FileName + " does not specify a supported Cortex Command version, so it is not compatible with this version of Cortex Command (" + c_GameVersion.str() + ").\n\n" + contactAuthor);
502-
503507
bool modulePrereleaseVersionMismatch = !m_SupportedGameVersion->prerelease().empty();
504508
bool moduleBuildVersionMismatch = !m_SupportedGameVersion->build().empty();
505-
RTEAssert(!modulePrereleaseVersionMismatch && !moduleBuildVersionMismatch, m_FileName + " was developed for pre-release build of Cortex Command v" + m_SupportedGameVersion->str() + ", this game version (v" + c_GameVersion.str() + ") is incompatible.\n\nMods developed on a pre-release must match the game version exactly.\n" + contactAuthor);
509+
RTEAssert(!modulePrereleaseVersionMismatch && !moduleBuildVersionMismatch, m_FileName + " was developed for pre-release build of Cortex Command v" + m_SupportedGameVersion->str() + ", so this game version (v" + c_GameVersion.str() + ") may not support it.\n\n" + contactAuthor);
506510

507511
bool gamePrereleaseVersionMismatch = !c_GameVersion.prerelease().empty();
508512
bool gameBuildVersionMismatch = !c_GameVersion.build().empty();
509-
RTEAssert(!gamePrereleaseVersionMismatch && !gameBuildVersionMismatch, m_FileName + " was developed for Cortex Command v" + m_SupportedGameVersion->str() + ", this pre-release version of the game (v" + c_GameVersion.str() + ") may not support it.\n\nMods must match the game version exactly to use pre-release builds.\n" + contactAuthor);
513+
RTEAssert(!gamePrereleaseVersionMismatch && !gameBuildVersionMismatch, m_FileName + " was developed for Cortex Command v" + m_SupportedGameVersion->str() + ", so this pre-release version of the game (v" + c_GameVersion.str() + ") may not support it.\n\n" + contactAuthor);
510514

511515
// Game engine is the same major version as the Module
512516
bool majorVersionMatch = c_GameVersion.major() == m_SupportedGameVersion->major();
513517
// Game engine is at least the minor version the Module requires (allow patch mismatch)
514518
bool minorVersionInRange = m_SupportedGameVersion->inc_minor() <= c_GameVersion.inc_minor();
515519

516-
RTEAssert(majorVersionMatch && minorVersionInRange, m_FileName + " was developed for Cortex Command v" + m_SupportedGameVersion->str() + ", so this version of Cortex Command (v" + c_GameVersion.str() + ") may not support it.\n" + contactAuthor);
520+
RTEAssert(majorVersionMatch && minorVersionInRange, m_FileName + " was developed for Cortex Command v" + m_SupportedGameVersion->str() + ", so this version of Cortex Command (v" + c_GameVersion.str() + ") may not support it.\n\n" + contactAuthor);
517521
}

external/sources/luabind-0.7.1/meson.build

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ elif cxx.get_argument_syntax() == 'msvc'
2020
cpp_options = ['cpp_std=vc++20']
2121
endif
2222

23-
if (not get_option('debug')) or get_option('debug_type') == 'release'
24-
luabind_args += ['-DLUABIND_NO_ERROR_CHECKING=1']
25-
endif
26-
2723
luabind = static_library('luabind071', luabind_src, dependencies: luabind_dependencies, include_directories:luabind_include, cpp_args:cpp_args+ luabind_args, override_options: ['warning_level=0']+ cpp_options)
2824

2925
luabind_dep = declare_dependency(link_with: luabind, dependencies: deps, include_directories: luabind_include, compile_args: luabind_args)
3026

31-
meson.override_dependency('luabind', luabind_dep)
27+
meson.override_dependency('luabind', luabind_dep)

0 commit comments

Comments
 (0)