Skip to content

Commit cfe93ae

Browse files
committed
Merge branch 'development' into browncoat-mission
2 parents 3801e7e + 40864dc commit cfe93ae

File tree

80 files changed

+1801
-840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1801
-840
lines changed

.gitignore

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
*.vs
88
*.APS
99
*.user
10-
10+
# IDE files
1111
/.idea
1212

1313
compile_commands.json
14-
/.ccls-cache
14+
**/.ccls-cache
1515

16-
/build*
16+
**/build*
1717

1818
/enc_temp_folder
1919

20+
.vs/
2021
/.idea
2122
/_Bin
2223
/NATPunchServer/Server/NATCompleteServer/Debug
@@ -72,6 +73,7 @@ luac.out
7273
*.bat
7374
CortexCommand
7475
CortexCommand_debug
76+
CortexCommand.AppImage
7577

7678
# Debug databases
7779
*.pdb
@@ -84,10 +86,10 @@ CortexCommand_debug
8486
# MacOS stuff
8587
.DS_Store
8688

87-
.vs/
88-
Screenshots/
89+
# CortexCommand user files
90+
Screen[sS]hots/
8991
Mods/
90-
Userdata/
92+
User[dD]ata/
9193

9294
allegro.log
9395
AbortScreen.*

CHANGELOG.md

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

77
## [Unreleased]
88

9+
<details><summary><b>Added</b></summary>
10+
11+
- New music system, including a dynamic horizontal sequencing system, under the new music manager `MusicMan`.
12+
`PlayDynamicSong(string songName, string songSectionName, bool playImmediately, bool playTransition, bool smoothFade)` to play a new DynamicSong.
13+
`SetNextDynamicSongSection(string songSectionName, bool playImmediately, bool playTransition, bool smoothFade)` to queue a new DynamicSongSection for the currently playing song.
14+
`PlayInterruptingMusic(SoundContainer soundContainer)` to start an interrupting piece of music which will pause any playing DynamicSong. Note that pause menu music happily overrides this currently.
15+
`EndInterruptingMusic()` to end any playing interrupting music, and resume any paused DynamicSongs.
16+
`EndDynamicMusic(bool fadeOut)` to end any currently playing dynamic music, optionally immediately fading it out. If not fading it out, the currently playing piece will play to completion.
17+
`ResetMusicState()` to immediately end all music and return the MusicMan to a blank state.
18+
19+
- New entities `DynamicSongSection` and `DynamicSong` which are used for organizing music to play using the new system.
20+
`DynamicSongSection` is made up of TransitionSoundContainers, SoundContainers, a string SectionType, and either randomnorepeat or shuffle SoundContainerSelectionCycleMode.
21+
`DynamicSong` is a simple container of DynamicSongSections. It can have one DefaultSongSection and as many added sections as needed.
22+
23+
- New `SoundContainer` features.
24+
Lua property `Paused` (R/W) to pause or unpause all sounds of a SoundContainer. Newly played sounds will not begin playback until unpaused.
25+
Lua function `GetAudibleVolume` to get the real audible volume of a SoundContainer's sounds as a float from 0 to 1. This accounts for literally everything, including game volume.
26+
27+
</details>
28+
929
<details><summary><b>Changed</b></summary>
1030

1131
- Conquest activities will once again fall-back to using base dropships and rockets if a random selection of the selected tech's craft can't find one capable of carrying passengers and/or cargo.
1232

33+
- ALl music-related functionality from AudioMan has been removed due to the addition of the MusicMan. Generic DynamicSongs have been put in to use instead.
34+
Mod activities that used to queue up all the vanilla music should now instead call, for example, `MusicMan:PlayDynamicSong("Generic Battle Music")`
35+
36+
</details>
37+
38+
<details><summary><b>Fixed</b></summary>
39+
40+
- Fixed an issue where palette index 255 was incorrectly showing as black.
41+
42+
- Fixed instances of `CameraMan:GetScrollTarget()` and `CameraMan:SetScrollTarget()` supplying a player index instead of a screen index. This could prevent the functions from working properly, or at all, when playing as a player other than 1, potentially screwing up camera effects.
43+
44+
- Fixed a bug in Decision Day that could cause an error when trying to set the camera's scroll target, in addition to the previous issue.
45+
1346
</details>
1447

1548
## [Release v6.2.2] - 2024/02/24

Data/Base.rte/Activities/BrainVsBrain.lua

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ function BrainvsBrain:StartActivity(isNewGame)
4242
if self.CPUTeam ~= Activity.NOTEAM then
4343
self.CPUTechID = PresetMan:GetModuleID(self.TechName[self.CPUTeam]);
4444
end
45+
46+
MusicMan:PlayDynamicSong("Generic Battle Music");
4547

4648
if isNewGame then
4749
self:StartNewGame();
@@ -311,16 +313,11 @@ function BrainvsBrain:EndActivity()
311313
if not self:IsPaused() then
312314
-- Play sad music if no humans are left
313315
if self:HumanBrainCount() == 0 then
314-
AudioMan:ClearMusicQueue();
315-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/udiedfinal.ogg", 2, -1.0);
316-
AudioMan:QueueSilence(10);
317-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
316+
MusicMan:PlayDynamicSong("Generic Defeat Music", "Default", true);
317+
MusicMan:PlayDynamicSong("Generic Ambient Music");
318318
else
319-
-- But if humans are left, then play happy music!
320-
AudioMan:ClearMusicQueue();
321-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/uwinfinal.ogg", 2, -1.0);
322-
AudioMan:QueueSilence(10);
323-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
319+
MusicMan:PlayDynamicSong("Generic Victory Music", "Default", true);
320+
MusicMan:PlayDynamicSong("Generic Ambient Music");
324321
end
325322
end
326323
end
@@ -410,8 +407,9 @@ function BrainvsBrain:UpdateActivity()
410407
end
411408
else
412409
self:ResetMessageTimer(player);
413-
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
414-
FrameMan:SetScreenText("Your brain has been destroyed!", self:ScreenOfPlayer(player), 2000, -1, false);
410+
local screen = self:ScreenOfPlayer(player);
411+
FrameMan:ClearScreenText(screen);
412+
FrameMan:SetScreenText("Your brain has been destroyed!", screen, 2000, -1, false);
415413
end
416414
end
417415
end

Data/Base.rte/Activities/BunkerBreach.lua

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ function BunkerBreach:StartActivity(isNewGame)
253253
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
254254
end
255255
end
256+
257+
MusicMan:PlayDynamicSong("Generic Battle Music");
256258

257259
if isNewGame then
258260
-- Because of game oddities, we need to set funds to match starting gold manually.
@@ -326,15 +328,11 @@ function BunkerBreach:EndActivity()
326328
-- Temp fix so music doesn't start playing if ending the Activity when changing resolution through the ingame settings.
327329
if not self:IsPaused() then
328330
if self.WinnerTeam == self.CPUTeam then
329-
AudioMan:ClearMusicQueue();
330-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/udiedfinal.ogg", 2, -1.0);
331-
AudioMan:QueueSilence(10);
332-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
331+
MusicMan:PlayDynamicSong("Generic Defeat Music", "Default", true);
332+
MusicMan:PlayDynamicSong("Generic Ambient Music");
333333
else
334-
AudioMan:ClearMusicQueue();
335-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/uwinfinal.ogg", 2, -1.0);
336-
AudioMan:QueueSilence(10);
337-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
334+
MusicMan:PlayDynamicSong("Generic Victory Music", "Default", true);
335+
MusicMan:PlayDynamicSong("Generic Ambient Music");
338336
end
339337
end
340338
end

Data/Base.rte/Activities/Harvester.lua

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function Harvester:StartNewGame()
6060
self.randomSpawnTime = 5000;
6161
elseif self.Difficulty <= GameActivity.NUTSDIFFICULTY then
6262
self.goldNeeded = 7500;
63-
self.goldDisplay = "sevent thousand five hundred";
63+
self.goldDisplay = "seven thousand five hundred";
6464
self.baseSpawnTime = 8000;
6565
self.randomSpawnTime = 4500;
6666
elseif self.Difficulty <= GameActivity.MAXDIFFICULTY then
@@ -82,9 +82,9 @@ function Harvester:SetupHumanPlayerBrains()
8282
-- If we can't find an unassigned brain in the scene to give each player, then force to go into editing mode to place one
8383
if not foundBrain then
8484
self.ActivityState = Activity.EDITING;
85-
AudioMan:ClearMusicQueue();
86-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/ccambient4.ogg", -1, -1);
85+
MusicMan:PlayDynamicSong("Generic Ambient Music");
8786
else
87+
MusicMan:PlayDynamicSong("Generic Battle Music");
8888
-- Set the found brain to be the selected actor at start
8989
self:SetPlayerBrain(foundBrain, player);
9090
self:SwitchToActor(foundBrain, player, self:GetTeamOfPlayer(player));
@@ -132,34 +132,35 @@ function Harvester:EndActivity()
132132
if not self:IsPaused() then
133133
-- Play sad music if no humans are left
134134
if self:HumanBrainCount() == 0 then
135-
AudioMan:ClearMusicQueue();
136-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/udiedfinal.ogg", 2, -1.0);
137-
AudioMan:QueueSilence(10);
138-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
135+
MusicMan:PlayDynamicSong("Generic Defeat Music", "Default", true);
136+
MusicMan:PlayDynamicSong("Generic Ambient Music");
139137
else
140138
-- But if humans are left, then play happy music!
141-
AudioMan:ClearMusicQueue();
142-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/uwinfinal.ogg", 2, -1.0);
143-
AudioMan:QueueSilence(10);
144-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
139+
MusicMan:PlayDynamicSong("Generic Victory Music", "Default", true);
140+
MusicMan:PlayDynamicSong("Generic Ambient Music");
145141
end
146142
end
147143
end
148144

149145
function Harvester:UpdateActivity()
150146
if self.ActivityState ~= Activity.OVER and self.ActivityState ~= Activity.EDITING then
147+
if not self.musicStarted then
148+
self.musicStarted = true;
149+
MusicMan:PlayDynamicSong("Generic Battle Music", "Default", true);
150+
end
151151
--Determine how much gold the players started with.
152152
if self.humanTeamFundsAfterInitialEditingPhase == -1 then
153153
self.humanTeamFundsAfterInitialEditingPhase = self:GetTeamFunds(Activity.TEAM_1);
154154
end
155155

156156
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
157157
if self:PlayerActive(player) and self:PlayerHuman(player) then
158+
local screen = self:ScreenOfPlayer(player);
158159
--Display messages.
159160
if self.startMessageTimer:IsPastSimMS(3000) then
160-
FrameMan:SetScreenText(self.goldNeeded - (math.ceil(self:GetTeamFunds(Activity.TEAM_1)) - self.humanTeamFundsAfterInitialEditingPhase) .. " oz of gold left", self:ScreenOfPlayer(player), 0, 1000, false);
161+
FrameMan:SetScreenText(self.goldNeeded - (math.ceil(self:GetTeamFunds(Activity.TEAM_1)) - self.humanTeamFundsAfterInitialEditingPhase) .. " oz of gold left", screen, 0, 1000, false);
161162
else
162-
FrameMan:SetScreenText("Dig up " .. self.goldDisplay .. " oz of gold!", self:ScreenOfPlayer(player), 333, 5000, true);
163+
FrameMan:SetScreenText("Dig up " .. self.goldDisplay .. " oz of gold!", screen, 333, 5000, true);
163164
end
164165

165166
-- The current player's team
@@ -179,8 +180,8 @@ function Harvester:UpdateActivity()
179180
if not MovableMan:IsActor(self:GetPlayerBrain(player)) then
180181
self:SetPlayerBrain(nil, player);
181182
self:ResetMessageTimer(player);
182-
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
183-
FrameMan:SetScreenText("Your brain has been destroyed!", self:ScreenOfPlayer(player), 333, -1, false);
183+
FrameMan:ClearScreenText(screen);
184+
FrameMan:SetScreenText("Your brain has been destroyed!", screen, 333, -1, false);
184185
-- Now see if all brains of self player's team are dead, and if so, end the game
185186
if not MovableMan:GetFirstBrainActor(team) then
186187
self.WinnerTeam = self:OtherTeam(team);
@@ -191,8 +192,8 @@ function Harvester:UpdateActivity()
191192
--Check if the player has won.
192193
if self:GetTeamFunds(Activity.TEAM_1) - self.humanTeamFundsAfterInitialEditingPhase > self.goldNeeded then
193194
self:ResetMessageTimer(player);
194-
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
195-
FrameMan:SetScreenText("You dug up all the gold!", self:ScreenOfPlayer(player), 333, -1, false);
195+
FrameMan:ClearScreenText(screen);
196+
FrameMan:SetScreenText("You dug up all the gold!", screen, 333, -1, false);
196197

197198
self.WinnerTeam = Activity.TEAM_1;
198199

@@ -337,5 +338,6 @@ function Harvester:UpdateActivity()
337338
end
338339
else
339340
self.startMessageTimer:Reset();
341+
self.musicStarted = false;
340342
end
341343
end

Data/Base.rte/Activities/KeepieUppie.lua

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function KeepieUppie:StartNewGame()
6969
self.randomSpawnTime = 4000;
7070
end
7171
self.enemySpawnTimeLimit = 2000;
72+
73+
MusicMan:PlayDynamicSong("Generic Boss Fight Music");
7274

7375
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
7476
if self:PlayerActive(player) and self:PlayerHuman(player) then
@@ -120,16 +122,11 @@ function KeepieUppie:EndActivity()
120122
if not self:IsPaused() then
121123
-- Play sad music if no humans are left
122124
if self:HumanBrainCount() == 0 then
123-
AudioMan:ClearMusicQueue();
124-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/udiedfinal.ogg", 2, -1.0);
125-
AudioMan:QueueSilence(10);
126-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
125+
MusicMan:PlayDynamicSong("Generic Defeat Music", "Default", true);
126+
MusicMan:PlayDynamicSong("Generic Ambient Music");
127127
else
128-
-- But if humans are left, then play happy music!
129-
AudioMan:ClearMusicQueue();
130-
AudioMan:PlayMusic("Base.rte/Music/dBSoundworks/uwinfinal.ogg", 2, -1.0);
131-
AudioMan:QueueSilence(10);
132-
AudioMan:QueueMusicStream("Base.rte/Music/dBSoundworks/ccambient4.ogg");
128+
MusicMan:PlayDynamicSong("Generic Victory Music", "Default", true);
129+
MusicMan:PlayDynamicSong("Generic Ambient Music");
133130
end
134131
end
135132
end
@@ -141,13 +138,14 @@ function KeepieUppie:UpdateActivity()
141138
if self.ActivityState ~= Activity.OVER and self.ActivityState ~= Activity.EDITING then
142139
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
143140
if self:PlayerActive(player) and self:PlayerHuman(player) then
141+
local screen = self:ScreenOfPlayer(player);
144142
--Display messages.
145143
self:ResetMessageTimer(player);
146-
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
144+
FrameMan:ClearScreenText(screen);
147145
if self.startMessageTimer:IsPastSimMS(3000) then
148-
FrameMan:SetScreenText(math.floor(self.winTimer:LeftTillSimMS(self.timeLimit) / 1000) .. " seconds left", self:ScreenOfPlayer(player), 0, 1000, false);
146+
FrameMan:SetScreenText(math.floor(self.winTimer:LeftTillSimMS(self.timeLimit) / 1000) .. " seconds left", screen, 0, 1000, false);
149147
else
150-
FrameMan:SetScreenText("Keep the rocket alive for " .. self.timeDisplay .. "!", self:ScreenOfPlayer(player), 333, 5000, true);
148+
FrameMan:SetScreenText("Keep the rocket alive for " .. self.timeDisplay .. "!", screen, 333, 5000, true);
151149
end
152150

153151
-- The current player's team
@@ -156,8 +154,8 @@ function KeepieUppie:UpdateActivity()
156154
if not MovableMan:IsActor(self:GetPlayerBrain(player)) then
157155
self:SetPlayerBrain(nil, player);
158156
self:ResetMessageTimer(player);
159-
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
160-
FrameMan:SetScreenText("Your rocket has been destroyed!", self:ScreenOfPlayer(player), 333, -1, false);
157+
FrameMan:ClearScreenText(screen);
158+
FrameMan:SetScreenText("Your rocket has been destroyed!", screen, 333, -1, false);
161159
-- Now see if all brains of self player's team are dead, and if so, end the game
162160
if not MovableMan:GetFirstBrainActor(team) then
163161
self.WinnerTeam = self:OtherTeam(team);
@@ -170,8 +168,8 @@ function KeepieUppie:UpdateActivity()
170168
--Check if the player has won.
171169
if self.winTimer:IsPastSimMS(self.timeLimit) then
172170
self:ResetMessageTimer(player);
173-
FrameMan:ClearScreenText(self:ScreenOfPlayer(player));
174-
FrameMan:SetScreenText("You survived!", self:ScreenOfPlayer(player), 333, -1, false);
171+
FrameMan:ClearScreenText(screen);
172+
FrameMan:SetScreenText("You survived!", screen, 333, -1, false);
175173

176174
self.WinnerTeam = player;
177175

0 commit comments

Comments
 (0)