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

Commit e6e4416

Browse files
authored
Merge pull request #69 from cortex-command-community/FMOD
Fmod Reimplementation
2 parents 4dc4188 + 54f3ae1 commit e6e4416

File tree

158 files changed

+2481
-41946
lines changed

Some content is hidden

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

158 files changed

+2481
-41946
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ MemCleanupInfo.txt
4747
/_Allegro-4.2.3.1-Custom/Allegro/lib
4848
/_Allegro-4.2.3.1-Custom/Allegro/obj
4949
Doxygen/Output/
50+
51+
/external/include/fmod
52+
/external/lib/win/fmodvc.lib
53+
/external/lib/win/fmod.dll

Activities/BaseEditor.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -262,26 +262,6 @@ int BaseEditor::Start()
262262
m_TeamDeaths[team] = 0;
263263
}
264264

265-
// Init sounds
266-
if (m_FundsChangedSound.GetSampleCount() < 1)
267-
{
268-
// Interface sounds should not be pitched, to reinforce the impression of time decoupling between simulation and UI
269-
m_FundsChangedSound.Create("Base.rte/Sounds/GUIs/FundsChanged1.wav", false);
270-
m_FundsChangedSound.AddSample("Base.rte/Sounds/GUIs/FundsChanged2.wav");
271-
m_FundsChangedSound.AddSample("Base.rte/Sounds/GUIs/FundsChanged3.wav");
272-
m_FundsChangedSound.AddSample("Base.rte/Sounds/GUIs/FundsChanged4.wav");
273-
m_FundsChangedSound.AddSample("Base.rte/Sounds/GUIs/FundsChanged5.wav");
274-
m_FundsChangedSound.AddSample("Base.rte/Sounds/GUIs/FundsChanged6.wav");
275-
m_ActorSwitchSound.Create("Base.rte/Sounds/GUIs/ActorSwitch.wav", false);
276-
m_BrainSwitchSound.Create("Base.rte/Sounds/GUIs/BrainSwitch.wav", false);
277-
m_CameraTravelSound.Create("Base.rte/Sounds/GUIs/CameraTravel1.wav", false);
278-
m_CameraTravelSound.AddSample("Base.rte/Sounds/GUIs/CameraTravel2.wav");
279-
m_CameraTravelSound.AddSample("Base.rte/Sounds/GUIs/CameraTravel3.wav");
280-
m_ConfirmSound.Create("Base.rte/Sounds/GUIs/MenuExit2.wav", false);
281-
m_SelectionChangeSound.Create("Base.rte/Sounds/GUIs/SelectionChange.wav", false);
282-
m_UserErrorSound.Create("Base.rte/Sounds/GUIs/UserError.wav", false);
283-
}
284-
285265
// Move any brains resident in the Scene to the MovableMan
286266
// Nope - these are manipulated by the SceneEditorGUI directly where they are in the resident lists
287267
// g_SceneMan.GetScene()->PlaceResidentBrains(*this);

Activities/EditorActivity.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//////////////////////////////////////////////////////////////////////////////////////////
1515
// Inclusions of header files
1616

17+
#include "GUISound.h"
1718
#include "DDTTools.h"
1819
#include "ActivityMan.h"
1920

Activities/GameActivity.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ bool GameActivity::CreateDelivery(int player, int mode, Vector &waypoint, Actor
786786

787787
// Go 'ding!', but only if player is human, or it may be confusing
788788
if (PlayerHuman(player))
789-
m_ConfirmSound.Play(0, player);
789+
g_GUISound.ConfirmSound().Play(0, player);
790790

791791
// Clear out the override purchase list, whether anything was in there or not, it should not override twice.
792792
m_PurchaseOverride[player].clear();
@@ -1472,7 +1472,7 @@ void GameActivity::Update()
14721472
// Switch back to normal view
14731473
m_ViewState[player] = NORMAL;
14741474
// Play err sound to indicate cancellation
1475-
m_UserErrorSound.Play(0, player);
1475+
g_GUISound.UserErrorSound().Play(0, player);
14761476
// Flash the same actor, jsut to show the control went back to him
14771477
m_pPieMenu[player]->DisableAnim();
14781478
}
@@ -1488,7 +1488,7 @@ void GameActivity::Update()
14881488
SwitchToActor(pMarkedActor, player, team);
14891489
// If not, boop
14901490
else
1491-
m_UserErrorSound.Play(0, player);
1491+
g_GUISound.UserErrorSound().Play(0, player);
14921492

14931493
// Switch back to normal view
14941494
m_ViewState[player] = NORMAL;
@@ -1734,18 +1734,18 @@ void GameActivity::Update()
17341734
if (m_PlayerController[player].IsState(PRESS_DOWN))// || m_PlayerController[player].IsState(PRESS_SECONDARY))
17351735
{
17361736
if (m_AIReturnCraft[player])
1737-
m_SelectionChangeSound.Play(0, player);
1737+
g_GUISound.SelectionChangeSound().Play(0, player);
17381738
else
1739-
m_UserErrorSound.Play(0, player);
1739+
g_GUISound.UserErrorSound().Play(0, player);
17401740

17411741
m_AIReturnCraft[player] = false;
17421742
}
17431743
else if (m_PlayerController[player].IsState(PRESS_UP))// || m_PlayerController[player].IsState(PRESS_SECONDARY))
17441744
{
17451745
if (!m_AIReturnCraft[player])
1746-
m_SelectionChangeSound.Play(0, player);
1746+
g_GUISound.SelectionChangeSound().Play(0, player);
17471747
else
1748-
m_UserErrorSound.Play(0, player);
1748+
g_GUISound.UserErrorSound().Play(0, player);
17491749

17501750
m_AIReturnCraft[player] = true;
17511751
}
@@ -1756,9 +1756,9 @@ void GameActivity::Update()
17561756
// Switch back to normal view
17571757
m_ViewState[player] = NORMAL;
17581758
// Play err sound to indicate cancellation
1759-
g_FrameMan.SetScreenText("Order cancelled!", ScreenOfPlayer(player), 333);
1759+
g_FrameMan.SetScreenText("Order canceled!", ScreenOfPlayer(player), 333);
17601760
m_MsgTimer[player].Reset();
1761-
m_UserErrorSound.Play(0, player);
1761+
g_GUISound.UserErrorSound().Play(0, player);
17621762
// Flash the same actor, jsut to show the control went back to him
17631763
m_pPieMenu[player]->DisableAnim();
17641764
}

Activities/GameActivity.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//////////////////////////////////////////////////////////////////////////////////////////
1515
// Inclusions of header files
1616

17+
#include "GUISound.h"
1718
#include "DDTTools.h"
1819
#include "ActivityMan.h"
1920
#include "Scene.h"

Activities/MultiplayerGame.cpp

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,6 @@ namespace RTE {
8282

8383
m_LastMusic = "";
8484
m_LastMusicPos = 0;
85-
86-
// Sounds
87-
m_EnterMenuSound.Reset();
88-
m_ExitMenuSound.Reset();
89-
m_FocusChangeSound.Reset();
90-
m_SelectionChangeSound.Reset();
91-
m_ButtonPressSound.Reset();
92-
m_BackButtonPressSound.Reset();
93-
m_ItemChangeSound.Reset();
94-
m_TestSound.Reset();
95-
m_UserErrorSound.Reset();
9685
}
9786

9887
//////////////////////////////////////////////////////////////////////////////////////////
@@ -104,17 +93,6 @@ namespace RTE {
10493
{
10594
if (Activity::Create() < 0)
10695
return -1;
107-
108-
// Load pie menu sounds so they could be played when their network events arrive
109-
// We don't care about the sound object, only the underlying FileContent objects it loads during creation
110-
Sound s;
111-
s.Create("Base.rte/Sounds/GUIs/PieMenuEnter.wav", false);
112-
s.Create("Base.rte/Sounds/GUIs/PieMenuExit.wav", false);
113-
s.Create("Base.rte/Sounds/GUIs/SelectionChange.wav", false);
114-
s.Create("Base.rte/Sounds/GUIs/PlacementBlip.wav", false);
115-
s.Create("Base.rte/Sounds/GUIs/SlicePicked.wav", false);
116-
s.Create("Base.rte/Sounds/GUIs/PieMenuExit.wav", false);
117-
11896
return 0;
11997
}
12098

@@ -237,18 +215,6 @@ namespace RTE {
237215
m_pNATServerNameTextBox->SetText(g_SettingsMan.GetNATServerName());
238216
m_pNATServerPasswordTextBox->SetText(g_SettingsMan.GetNATServerPassword());
239217

240-
241-
m_EnterMenuSound.Create("Base.rte/Sounds/GUIs/MenuEnter.wav", false);
242-
m_ExitMenuSound.Create("Base.rte/Sounds/GUIs/MenuExit1.wav", false);
243-
m_ExitMenuSound.AddSample("Base.rte/Sounds/GUIs/MenuExit2.wav");
244-
m_FocusChangeSound.Create("Base.rte/Sounds/GUIs/FocusChange.wav", false);
245-
m_SelectionChangeSound.Create("Base.rte/Sounds/GUIs/SelectionChange.wav", false);
246-
m_ButtonPressSound.Create("Base.rte/Sounds/GUIs/ButtonPress.wav", false);
247-
m_BackButtonPressSound.Create("Base.rte/Sounds/GUIs/BackButtonPress.wav", false);
248-
m_ItemChangeSound.Create("Base.rte/Sounds/GUIs/ItemChange.wav", false);
249-
m_TestSound.Create("Base.rte/Sounds/GUIs/Test.wav", false);
250-
m_UserErrorSound.Create("Base.rte/Sounds/GUIs/UserError.wav", false);
251-
252218
return error;
253219
}
254220

@@ -373,7 +339,7 @@ namespace RTE {
373339
m_pGUIController->EnableMouse(false);
374340
m_Mode = CONNECTION;
375341
m_ConnectionWaitTimer.Reset();
376-
m_ButtonPressSound.Play();
342+
g_GUISound.ButtonPressSound().Play();
377343
}
378344

379345

@@ -437,7 +403,7 @@ namespace RTE {
437403
m_pGUIController->EnableMouse(false);
438404
m_Mode = CONNECTION;
439405
m_ConnectionWaitTimer.Reset();
440-
m_ButtonPressSound.Play();
406+
g_GUISound.ButtonPressSound().Play();
441407
}
442408
}
443409
// Notifications

Activities/MultiplayerGame.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -287,24 +287,6 @@ namespace RTE
287287
// Position of music being played, used to recover playback state after pause
288288
double m_LastMusicPos;
289289

290-
// Sound for enabling and disabling menu
291-
Sound m_EnterMenuSound;
292-
Sound m_ExitMenuSound;
293-
// Sound for changing focus
294-
Sound m_FocusChangeSound;
295-
// Sound for selecting items in list, etc.
296-
Sound m_SelectionChangeSound;
297-
// Sound for button press
298-
Sound m_ButtonPressSound;
299-
// Sound for button press of going back button
300-
Sound m_BackButtonPressSound;
301-
// Sound for adding or deleting items in list.
302-
Sound m_ItemChangeSound;
303-
// Sound for testing sound volume
304-
Sound m_TestSound;
305-
// Sound for erroneus input
306-
Sound m_UserErrorSound;
307-
308290

309291
//////////////////////////////////////////////////////////////////////////////////////////
310292
// Private member variable and method declarations

Activities/MultiplayerServerLobby.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ namespace RTE {
704704
// m_aapPlayerBoxes[PLAYER_CPU][TEAM_DISABLED]->SetDrawImage(new AllegroBitmap(pIcon->GetBitmaps8()[0]));
705705
}
706706
}
707-
//m_FocusChangeSound.Play();
707+
//g_GUISound.FocusChangeSound().Play();
708708

709709
//Check if we need to clear or set CPU disabled team icon
710710
bool noCPUs = true;
@@ -733,7 +733,7 @@ namespace RTE {
733733
else if (m_aapPlayerBoxes[player][team]->GetDrawColor() != c_PlayerSlotColorHovered)
734734
{
735735
m_aapPlayerBoxes[player][team]->SetDrawColor(c_PlayerSlotColorHovered);
736-
//m_SelectionChangeSound.Play();
736+
//g_GUISound.SelectionChangeSound().Play();
737737
}
738738
}
739739
// Un-highlight all other cells
@@ -938,7 +938,7 @@ namespace RTE {
938938
pGameActivity->SetFogOfWarEnabled(m_pFogOfWarCheckbox->GetCheck());
939939
pGameActivity->SetRequireClearPathToOrbit(m_pRequireClearPathToOrbitCheckbox->GetCheck());
940940

941-
for (int i = 0; i < MAX_CLIENTS; i++)
941+
for (int i = 0; i < c_MaxClients; i++)
942942
pGameActivity->SetNetworkPlayerName(i, g_NetworkServer.GetPlayerName(i));
943943

944944
// If gold slider is at it max value then the amount is 'infinite' and we must set some rediculously high value
@@ -1150,7 +1150,7 @@ namespace RTE {
11501150
{
11511151
Activity::Update();
11521152

1153-
for (int i = 0; i < MAX_CLIENTS; i++)
1153+
for (int i = 0; i < c_MaxClients; i++)
11541154
{
11551155
if (g_NetworkServer.IsPlayerConnected(i))
11561156
{
@@ -1240,10 +1240,10 @@ namespace RTE {
12401240
//HideAllScreens();
12411241
// m_MenuScreen = SCENESELECT;
12421242
// m_ScreenChange = true;
1243-
//m_ButtonPressSound.Play();
1243+
//g_GUISound.ButtonPressSound().Play();
12441244
}
12451245
else
1246-
m_UserErrorSound.Play();
1246+
g_GUISound.UserErrorSound().Play();
12471247
}
12481248
}
12491249

@@ -1282,7 +1282,7 @@ namespace RTE {
12821282

12831283
// Update the scene info box
12841284
//UpdateScenesBox();
1285-
//m_ItemChangeSound.Play();
1285+
//g_GUISound.ItemChangeSound().Play();
12861286
}
12871287
}
12881288

@@ -1328,7 +1328,7 @@ namespace RTE {
13281328
// We need to manually draw UI's to intermediate buffer first, then to the player's backbuffer to make it centered on each player's screen.
13291329
for (int i = 0; i < 4; i++)
13301330
{
1331-
if (i < MAX_CLIENTS)
1331+
if (i < c_MaxClients)
13321332
finalDestBitmap = g_FrameMan.GetNetworkBackBufferIntermediate8Current(i);
13331333
else
13341334
finalDestBitmap = pTargetBitmap;
@@ -1338,7 +1338,7 @@ namespace RTE {
13381338
//m_pGUIController->DrawMouse();
13391339

13401340
//Draw player icons
1341-
for (int j = 0; j < MAX_CLIENTS; j++)
1341+
for (int j = 0; j < c_MaxClients; j++)
13421342
draw_sprite(drawBitmap, m_apPlayerIcons[j]->GetBitmaps8()[0], m_apPlayerNameLabel[j]->GetXPos() - 32, m_apPlayerNameLabel[j]->GetYPos() - 5);
13431343

13441344
// Draw scene preview after GUI

Activities/MultiplayerServerLobby.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ namespace RTE
317317
GUICheckbox *m_pRequireClearPathToOrbitCheckbox;
318318
GUICheckbox *m_pDeployUnitsCheckbox;
319319

320-
const Icon *m_apPlayerIcons[MAX_CLIENTS];
320+
const Icon *m_apPlayerIcons[c_MaxClients];
321321

322-
GUILabel * m_apPlayerNameLabel[MAX_CLIENTS];
322+
GUILabel * m_apPlayerNameLabel[c_MaxClients];
323323

324324
BITMAP* m_pUIDrawBitmap;
325325

Constants.h

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,30 @@
33

44
namespace RTE {
55

6+
// Allegro defines these via define in astdint.h and Boost with stdlib go crazy so we need to undefine them manually.
7+
#undef int8_t
8+
#undef uint8_t
9+
#undef int16_t
10+
#undef uint16_t
11+
#undef int32_t
12+
#undef uint32_t
13+
#undef intptr_t
14+
#undef uintptr_t
15+
#undef LONG_LONG
16+
#undef int64_t
17+
#undef uint64_t
18+
619
#pragma region Buffer Constants
7-
constexpr static unsigned int c_MaxFileName = 256; ///! Maximum length of output file directory+name string.
8-
constexpr static unsigned int c_FileBufferSize = 8192; ///! Buffer to hold data read from the zip file.
9-
constexpr static unsigned int c_MaxUnzippedFileSize = 104857600; ///! Maximum size of single file being extracted from zip archive.
20+
static constexpr unsigned int c_MaxFileName = 256; //! Maximum length of output file directory+name string.
21+
static constexpr unsigned int c_FileBufferSize = 8192; //! Buffer to hold data read from the zip file.
22+
static constexpr unsigned int c_MaxUnzippedFileSize = 104857600; //! Maximum size of single file being extracted from zip archive.
1023
#pragma endregion
1124

1225
#pragma region Graphics Constants
13-
constexpr static unsigned int c_PaletteEntriesNumber = 256; ///! Number of indexes in the graphics palette.
14-
constexpr static unsigned int c_MOIDLayerBitDepth = 16; ///! Bit depth of MOID layer bitmap.
26+
static constexpr unsigned int c_PaletteEntriesNumber = 256; //! Number of indexes in the graphics palette.
27+
static constexpr unsigned int c_MOIDLayerBitDepth = 16; //! Bit depth of MOID layer bitmap.
1528

16-
constexpr static unsigned int c_GoldMaterialID = 2; ///! Index of gold material in the material palette.
29+
static constexpr unsigned int c_GoldMaterialID = 2; //! Index of gold material in the material palette.
1730

1831
// GUI colors
1932
#define c_GUIColorWhite makecol(255, 255, 255)
@@ -31,12 +44,16 @@ namespace RTE {
3144
#pragma endregion
3245

3346
#pragma region Math Constants
34-
constexpr static float c_TwoPI = 6.2831853;
35-
constexpr static float c_PI = 3.1415926;
36-
constexpr static float c_HalfPI = 1.5707963;
37-
constexpr static float c_QuarterPI = 0.7853982;
38-
constexpr static float c_EighthPI = 0.3926991;
39-
constexpr static float c_SixteenthPI = 0.1963495;
47+
static constexpr float c_TwoPI = 6.2831853;
48+
static constexpr float c_PI = 3.1415926;
49+
static constexpr float c_HalfPI = 1.5707963;
50+
static constexpr float c_QuarterPI = 0.7853982;
51+
static constexpr float c_EighthPI = 0.3926991;
52+
static constexpr float c_SixteenthPI = 0.1963495;
53+
#pragma endregion
54+
55+
#pragma region Network Constants
56+
static constexpr unsigned short int c_MaxClients = 4;
4057
#pragma endregion
4158
}
4259
#endif

0 commit comments

Comments
 (0)