Skip to content

Commit acf789d

Browse files
authored
Merge branch 'cortex-command-community:development' into separate-thread-module-loading
2 parents e2dbf62 + 91b919e commit acf789d

20 files changed

Lines changed: 176 additions & 112 deletions

File tree

.vscode/launch.json

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,28 @@
2020
}
2121
},
2222
{
23-
"name": "meson Debug (Release)",
23+
"name": "meson Configure Final & Launch",
2424
"type": "cppdbg",
2525
"osx": {
2626
"MIMode": "lldb"
2727
},
2828
"request": "launch",
29-
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/CortexCommand_debug",
29+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/CortexCommand",
30+
"cwd": "${workspaceFolder}",
31+
"preLaunchTask": "meson Build Release",
32+
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
33+
"presentation": {
34+
"group": "unix"
35+
}
36+
},
37+
{
38+
"name": "meson Configure Debug (Release) & Launch",
39+
"type": "cppdbg",
40+
"osx": {
41+
"MIMode": "lldb"
42+
},
43+
"request": "launch",
44+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/CortexCommand",
3045
"cwd": "${workspaceFolder}",
3146
"preLaunchTask": "meson Build Debug (Release)",
3247
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
@@ -35,13 +50,13 @@
3550
}
3651
},
3752
{
38-
"name": "meson Debug (Minimal)",
53+
"name": "meson Configure Debug (Minimal) & Launch",
3954
"type": "cppdbg",
4055
"osx": {
4156
"MIMode": "lldb"
4257
},
4358
"request": "launch",
44-
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/CortexCommand_debug",
59+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/CortexCommand",
4560
"cwd": "${workspaceFolder}",
4661
"preLaunchTask": "meson Build Debug (Minimal)",
4762
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
@@ -50,13 +65,13 @@
5065
}
5166
},
5267
{
53-
"name": "meson Debug (Full)",
68+
"name": "meson Configure Debug (Full) & Launch",
5469
"type": "cppdbg",
5570
"osx": {
5671
"MIMode": "lldb"
5772
},
5873
"request": "launch",
59-
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/CortexCommand_debug",
74+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/CortexCommand",
6075
"cwd": "${workspaceFolder}",
6176
"preLaunchTask": "meson Build Debug (Full)",
6277
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
@@ -116,17 +131,29 @@
116131
"request": "launch",
117132
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.exe",
118133
"cwd": "${workspaceFolder}",
134+
"preLaunchTask": "Meson: Build all targets",
135+
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
136+
"presentation": {
137+
"group": "windows"
138+
}
139+
},
140+
{
141+
"name": "meson Configure Final & Launch [Windows]",
142+
"type": "cppvsdbg",
143+
"request": "launch",
144+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.exe",
145+
"cwd": "${workspaceFolder}",
119146
"preLaunchTask": "meson Build Release",
120147
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
121148
"presentation": {
122149
"group": "windows"
123150
}
124151
},
125152
{
126-
"name": "meson Debug (Release) [Windows]",
153+
"name": "meson Configure Debug (Release) & Launch [Windows]",
127154
"type": "cppvsdbg",
128155
"request": "launch",
129-
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.debug.release.exe",
156+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.exe",
130157
"cwd": "${workspaceFolder}",
131158
"preLaunchTask": "meson Build Debug (Release)",
132159
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
@@ -135,10 +162,10 @@
135162
}
136163
},
137164
{
138-
"name": "meson Debug (Minimal) [Windows]",
165+
"name": "meson Configure Debug (Minimal) & Launch [Windows]",
139166
"type": "cppvsdbg",
140167
"request": "launch",
141-
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.debug.minimal.exe",
168+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.exe",
142169
"cwd": "${workspaceFolder}",
143170
"preLaunchTask": "meson Build Debug (Minimal)",
144171
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",
@@ -147,10 +174,10 @@
147174
}
148175
},
149176
{
150-
"name": "meson Debug (Full) [Windows]",
177+
"name": "meson Configure Debug (Full) & Launch [Windows]",
151178
"type": "cppvsdbg",
152179
"request": "launch",
153-
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.debug.full.exe",
180+
"program": "${workspaceFolder}/${config:mesonbuild.buildFolder}/Cortex Command.exe",
154181
"cwd": "${workspaceFolder}",
155182
"preLaunchTask": "meson Build Debug (Full)",
156183
"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env",

Data/Base.rte/Activities/BunkerBreach.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ function BunkerBreach:SetupDefenderActors()
142142
local crabToHumanSpawnRatio = self:GetCrabToHumanSpawnRatio(techID);
143143

144144
local loadoutNames = {"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"};
145-
145+
146146
local hasSpawnAreas = false;
147147
for _, loadoutName in pairs(loadoutNames) do
148148
if SceneMan.Scene:HasArea(loadoutName .. " Defenders") then
149149
hasSpawnAreas = true;
150150
end
151151
end
152-
152+
153153
for actor in MovableMan.AddedActors do
154-
if not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems") then
154+
if not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems") and not IsADoor(actor) then
155155
if hasSpawnAreas then
156156
actor.ToDelete = true;
157157
elseif actor.Team ~= self.defenderTeam then
@@ -162,7 +162,7 @@ function BunkerBreach:SetupDefenderActors()
162162
actor.Team = self.defenderTeam;
163163
end
164164
end
165-
165+
166166
if hasSpawnAreas then
167167
for _, loadoutName in pairs({"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"}) do
168168
if SceneMan.Scene:HasArea(loadoutName .. " Defenders") then
@@ -261,7 +261,7 @@ function BunkerBreach:StartActivity(isNewGame)
261261
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
262262
end
263263
end
264-
264+
265265
MusicMan:PlayDynamicSong("Generic Battle Music");
266266

267267
if isNewGame then
@@ -675,7 +675,7 @@ function BunkerBreach:CreateInternalReinforcements(loadout, numberOfReinforcemen
675675
numberOfInternalReinforcementsToCreateAtPosition = 3;
676676
end
677677
end
678-
678+
679679
for i = 1, numberOfInternalReinforcementsToCreateAtPosition do
680680
local internalReinforcement;
681681
if loadout then

Data/Base.rte/Craft/Shared/AttachableTurret.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function Update(self)
5656
PrimitiveMan:DrawCirclePrimitive(self.Team, aimPos, (self.searchRange * 0.5), 13);
5757
end
5858
local aimTarget = MovableMan:GetClosestEnemyActor(self.Team, aimPos, (self.searchRange * 0.5), Vector());
59-
if aimTarget and aimTarget.Status < Actor.INACTIVE then
59+
if aimTarget and aimTarget.Status < Actor.INACTIVE and aimTarget.GetsHitByMOs then
6060
--Debug: visualize search trace
6161
if self.showAim then
6262
PrimitiveMan:DrawLinePrimitive(self.Team, aimPos, aimTarget.Pos, 13);
@@ -89,7 +89,7 @@ function Update(self)
8989
end
9090

9191
local color = 13; --Debug trace color: red
92-
if target and IsActor(target) and ToActor(target).Status < Actor.INACTIVE then
92+
if target and IsActor(target) and ToActor(target).Status < Actor.INACTIVE and target.GetsHitByMOs then
9393
self:EnableEmission(true);
9494
self:TriggerBurst();
9595
self.fireTimer:Reset();
@@ -106,7 +106,7 @@ function Update(self)
106106
end
107107
end
108108
end
109-
109+
110110
if self.fireTimer:IsPastSimTimeLimit() then
111111
self:EnableEmission(false);
112112
end
-12 Bytes
Loading

Data/Base.rte/GUIs/Title/Moon.png

-3.37 KB
Loading
89.9 KB
Loading

Data/Browncoats.rte/Devices/Weapons/Flash/Flash.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
function Create(self)
22
self.fireVel = 17;
33
self.spread = math.rad(self.ShakeRange);
4-
4+
55
self.searchRange = 100 + FrameMan.PlayerScreenWidth * 0.3;
66
self.searchTimer = Timer();
77
self.searchTimer:SetSimTimeLimitMS(250);
88
self.lockThreshold = 2;
9-
9+
1010
self.targets = {};
11-
11+
1212
self.targetLockSound = CreateSoundContainer("Mine Activate", "Base.rte");
1313
end
1414

@@ -45,16 +45,16 @@ function ThreadedUpdate(self)
4545
end
4646
if self.Magazine.RoundCount > 0 then
4747
if controller:IsState(Controller.AIM_SHARP) then
48-
48+
4949
if self.searchTimer:IsPastSimTimeLimit() then
5050
self.searchTimer:Reset();
51-
51+
5252
local searchPos = parent.ViewPoint;
5353
local lastTargetCount = #self.targets;
5454
self.targets = {};
5555

5656
for actor in MovableMan.Actors do
57-
if #self.targets < self.RoundInMagCapacity and actor.Team ~= self.Team then
57+
if #self.targets < self.RoundInMagCapacity and actor.Team ~= self.Team and actor.GetsHitByMOs then
5858

5959
if (SceneMan:ShortestDistance(searchPos, actor.Pos, SceneMan.SceneWrapsX).Magnitude - actor.Radius) < self.searchRange
6060
and (actor.Vel.Magnitude + math.abs(actor.AngularVel) + 1)/math.sqrt(actor.Radius) < self.lockThreshold
@@ -99,7 +99,7 @@ function ThreadedUpdate(self)
9999
if target.actor and target.actor.ID ~= rte.NoMOID then
100100
local screen = ActivityMan:GetActivity():ScreenOfPlayer(ToActor(parent):GetController().Player);
101101
PrimitiveMan:DrawBoxPrimitive(screen, target.actor.Pos + target.topLeft, target.actor.Pos + target.bottomRight, 149);
102-
102+
103103
if self.RoundInMagCount == 0 then
104104
target.topLeft = target.topLeft * 0.9;
105105
target.bottomRight = target.bottomRight * 0.9;

Data/Coalition.rte/Devices/Weapons/MissileLauncher/MissileLauncher.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function ThreadedUpdate(self)
4343
local moCheck = SceneMan:GetMOIDPixel(hitPos.X, hitPos.Y);
4444
if moCheck ~= rte.NoMOID then
4545
local mo = ToMOSRotating(MovableMan:GetMOFromID(MovableMan:GetMOFromID(moCheck).RootID));
46-
if mo and mo.ClassName ~= "ADoor" and mo.Team ~= parent.Team then
46+
if mo and mo.ClassName ~= "ADoor" and mo.Team ~= parent.Team and mo.GetsHitByMOs then
4747
local movement = (mo.Vel.Magnitude + math.abs(mo.AngularVel) + 0.1) * math.sqrt(mo.Radius);
4848
if movement > self.lockThreshold then
4949

Data/Techion.rte/Devices/Weapons/NucleoSwarm/NucleoSwarmShot.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Create(self)
2121
local moCheck = SceneMan:GetMOIDPixel(checkPos.X, checkPos.Y);
2222
if moCheck ~= rte.NoMOID then
2323
local actor = MovableMan:GetMOFromID(MovableMan:GetMOFromID(moCheck).RootID);
24-
if actor and actor.Team ~= self.Team then
24+
if actor and actor.Team ~= self.Team and actor.GetsHitByMOs then
2525
self.target = actor;
2626
break;
2727
end
@@ -66,7 +66,7 @@ function Update(self)
6666
self.seekerTimer:Reset();
6767
self.seekerDelay = 1000 - math.random(1000);
6868
for actor in MovableMan.Actors do
69-
if actor.Team ~= self.Team then
69+
if actor.Team ~= self.Team and actor.GetsHitByMOs then
7070
self.potentialtargetdist = SceneMan:ShortestDistance(self.Pos, actor.Pos, SceneMan.SceneWrapsX);
7171
if (self.lastdist == nil or (self.lastdist ~= nil and self.potentialtargetdist:MagnitudeIsLessThan(self.lastdist))) and not self.potentialtargetdist:MagnitudeIsGreaterThan(500) and SceneMan:CastStrengthRay(self.Pos, self.potentialtargetdist:SetMagnitude(self.potentialtargetdist.Magnitude - actor.Radius), 0, Vector(), 5, rte.airID, SceneMan.SceneWrapsX) == false then
7272
self.lastdist = self.potentialtargetdist.Magnitude;
@@ -81,7 +81,7 @@ function Update(self)
8181
if self.lifeTimer:IsPastSimMS(8000) then
8282
self:GibThis();
8383
end
84-
84+
8585
--TODO: Add wounds through Lua like the other disintegrator weapons
8686
if SceneMan:GetTerrMatter(self.Pos.X, self.Pos.Y) == rte.airID then
8787
local moCheck = SceneMan:GetMOIDPixel(self.Pos.X, self.Pos.Y);

Source/Entities/AEmitter.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -278,29 +278,26 @@ float AEmitter::EstimateImpulse(bool burst) {
278278
if (emission->PushesEmitter()) {
279279
// TODO: we're not checking emission start/stop times here, so this will always calculate the impulse as if the emission was active.
280280
// There's not really an easy way to do this, since the emission rate is not necessarily constant over time.
281+
float emissionsPerFrame = (emission->GetRate() / 60.0f) * g_TimerMan.GetDeltaTimeSecs();
282+
float scale = 1.0F;
281283

282-
// TODO: burst emissions shouldn't be affected by delta time, but they were.
283-
// However our values were tuned for 60hz, so hack in constant 60Hz deltatime in milliseconds.
284-
float deltaTimeSecs = burst ? 1.0f / 60.0f : g_TimerMan.GetDeltaTimeSecs();
284+
// Get all the particles emitted this frame
285+
emissionsPerFrame *= emission->GetParticleCount();
285286

286-
float emissions = (emission->GetRate() / 60.0f) * deltaTimeSecs;
287-
float scale = 1.0F;
287+
// When bursting, add on all the bursted emissions
288+
// We also use m_BurstScale on ALL emissions, not just the extra bursted ones
289+
// This is a bit funky but consistent with the code that applies the impulse
288290
if (burst) {
289-
emissions *= emission->GetBurstSize();
291+
emissionsPerFrame += emission->GetBurstSize();
290292
scale = m_BurstScale;
291293
}
292294

293-
if (emissions > 0) {
294-
int extraEmissions = emission->GetParticleCount() - 1;
295-
emissions += extraEmissions;
296-
}
297-
298295
float velMin = emission->GetMinVelocity() * scale;
299-
float velRange = (emission->GetMaxVelocity() - emission->GetMinVelocity()) * scale * 0.5f;
300-
float spread = (std::max(static_cast<float>(c_PI) - (emission->GetSpread() * scale), 0.0F) / c_PI); // A large spread will cause the forces to cancel eachother out
296+
float velRange = (emission->GetMaxVelocity() - emission->GetMinVelocity()) * scale * 0.5f;
297+
float spread = (std::max(static_cast<float>(c_PI) - (emission->GetSpread() * scale), 0.0F) / c_PI); // A large spread will cause the forces to cancel eachother out
301298

302299
// Add to accumulative recoil impulse generated, F = m * a.
303-
impulse += (velMin + velRange) * spread * emission->m_pEmission->GetMass() * emissions;
300+
impulse += (velMin + velRange) * spread * emission->m_pEmission->GetMass() * emissionsPerFrame;
304301
}
305302
}
306303

@@ -458,17 +455,18 @@ void AEmitter::Update() {
458455
} else {
459456
emission->m_Accumulator = 0;
460457
}
458+
461459
float scale = 1.0F;
462460
// Add extra emissions if bursting.
463461
if (m_BurstTriggered) {
464462
emissionCount += emission->GetBurstSize();
465463
scale = m_BurstScale;
466464
}
465+
466+
// We don't consider extra particles for our emission count, so add prior to multiply
467467
emissionCountTotal += emissionCount;
468-
if (emissionCount > 0) {
469-
int extraEmissions = emission->GetParticleCount() - 1;
470-
emissionCount += extraEmissions;
471-
}
468+
emissionCount *= emission->GetParticleCount();
469+
472470
pParticle = 0;
473471
emitVel.Reset();
474472
parentVel = pRootParent->GetVel() * emission->InheritsVelocity();

0 commit comments

Comments
 (0)