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

Commit f5f9187

Browse files
committed
Merge branch 'development' into vector-update
2 parents 71e8a3a + 8615bb1 commit f5f9187

File tree

14 files changed

+92
-46
lines changed

14 files changed

+92
-46
lines changed

Activities/GAScripted.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ int GAScripted::Create(const GAScripted &reference)
107107

108108
int GAScripted::ReadProperty(std::string propName, Reader &reader)
109109
{
110-
if (propName == "ScriptFile")
111-
reader >> m_ScriptPath;
112-
else if (propName == "LuaClassName")
110+
if (propName == "ScriptFile") {
111+
reader >> m_ScriptPath;
112+
CorrectBackslashesInPaths(m_ScriptPath);
113+
} else if (propName == "LuaClassName")
113114
reader >> m_LuaClassName;
114115
else if (propName == "AddPieSlice")
115116
{

CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
137137

138138
- GUI sliders (like for music volume) can now be adjusted with the mouse scroll wheel.
139139

140-
- Exposed PEmitter to lua. Bindings are identical to AEmitter's bindings, except that damage-related bindings don't exist for PEmitter.
140+
- Exposed `PEmitter` to lua. Bindings are identical to `AEmitter` bindings, except that damage-related bindings don't exist for `PEmitter`.
141+
142+
- `FLAC` audio files can now be loaded through lua and ini.
141143

142144
### Changed
143145

@@ -221,17 +223,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
221223

222224
**Note:** Changing the game window resolution while an Activity is active requires ending the Activity. A dialog box will appear asking to confirm the change.
223225

224-
- Moved from C-style random number generation to C++ standard. This includes usage of an mt19937 random number generator.
225-
For C++ coders the functions SelectRand, PosRand and RangeRand have been replaced by the function template RandomNum() and its overload RandomNum(T min, T max). The function NormalRand has been replaced by the function template RandomNormalNum(). For lua coders there is no change.
226+
- Moved from C-style random number generation to C++ standard. This includes usage of a `mt19937` random number generator.
226227

227228
- Resolution validation changed to support multiple screens. Incompatible/bad resolution settings will be overridden at startup with messages explaining the issue.
228229
**Note:** For multi-screen to work properly, the left-most screen MUST be set as primary. Screens having different resolutions does not actually matter but different heights will still be warned about and overridden due to the likeliness of GUI elementes being cropped on the shortest screen.
229230
Resolution validation can be disabled for multi-screen setups with `Settings.ini` property `DisableMultiScreenResolutionValidation`. Bad settings are likely to crash, use at own risk.
230231
For setups with more than 3 screens `DisableMultiScreenResolutionValidation` must be set true.
231232

232-
- Damage to actors from impulses is now relative to their max health instead of being on a scale from 0 to 100.
233+
- Damage to `Actors` from impulses is now relative to their max health instead of being on a scale from 0 to 100.
233234

234-
- Scenes with a PresetName containing the strings "Test", "Editor" and "Tutorial" are no longer excluded from the scenarios screen and from the metagame.
235+
- `Scenes` with a `PresetName` containing the strings "Test", "Editor" and "Tutorial" are no longer excluded from the scenarios screen and from the MetaGame.
235236

236237
### Fixed
237238

Entities/GlobalScript.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ int GlobalScript::Create(const GlobalScript &reference)
6161

6262
int GlobalScript::ReadProperty(std::string propName, Reader &reader)
6363
{
64-
if (propName == "ScriptPath")
65-
reader >> m_ScriptPath;
66-
else if (propName == "LuaClassName")
64+
if (propName == "ScriptPath") {
65+
reader >> m_ScriptPath;
66+
CorrectBackslashesInPaths(m_ScriptPath);
67+
} else if (propName == "LuaClassName")
6768
reader >> m_LuaClassName;
6869
else if (propName == "LateUpdate")
6970
reader >> m_LateUpdate;

Entities/MovableObject.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,11 @@ int MovableObject::ReadProperty(std::string propName, Reader &reader)
331331
reader >> newSlice;
332332
PieMenuGUI::AddAvailableSlice(newSlice);
333333
}
334-
else if (propName == "ScriptPath")
335-
{
336-
std::string scriptPath = reader.ReadPropValue();
337-
if (LoadScript(scriptPath) == -2) { reader.ReportError("Duplicate script path " + scriptPath); }
338-
}
339-
else if (propName == "ScreenEffect")
340-
{
334+
else if (propName == "ScriptPath") {
335+
std::string scriptPath = reader.ReadPropValue();
336+
CorrectBackslashesInPaths(scriptPath);
337+
if (LoadScript(scriptPath) == -2) { reader.ReportError("Duplicate script path " + scriptPath); }
338+
} else if (propName == "ScreenEffect") {
341339
reader >> m_ScreenEffectFile;
342340
m_pScreenEffect = m_ScreenEffectFile.GetAsBitmap();
343341
m_ScreenEffectHash = m_ScreenEffectFile.GetHash();

Main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ void ReinitMainMenu() {
186186
g_pScenarioGUI->Destroy();
187187
g_MetaMan.GetGUI()->Destroy();
188188

189+
g_ConsoleMan.Destroy();
190+
g_ConsoleMan.Create();
191+
189192
InitMainMenu();
190193
g_FrameMan.DestroyTempBackBuffers();
191194
g_HadResolutionChange = true;

Managers/ConsoleMan.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace RTE {
3333
m_InputLogPosition = m_InputLog.begin();
3434
m_LastInputString.clear();
3535
m_LastLogMove = 0;
36+
m_ConsoleTextBackup.clear();
3637
}
3738

3839
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -65,24 +66,40 @@ namespace RTE {
6566
m_ParentBox->SetEnabled(false);
6667
m_ParentBox->SetVisible(false);
6768

68-
m_ConsoleText->SetText("- RTE Lua Console -\nSee the Data Realms Wiki for commands: http://www.datarealms.com/wiki/\nPress F1 for a list of helpful shortcuts\n-------------------------------------");
69+
if (!g_FrameMan.ResolutionChanged()) {
70+
m_ConsoleText->SetText("- RTE Lua Console -\nSee the Data Realms Wiki for commands: http://www.datarealms.com/wiki/\nPress F1 for a list of helpful shortcuts\n-------------------------------------");
6971

70-
m_InputLogPosition = m_InputLog.begin();
71-
m_LastLogMove = 0;
72+
m_InputLogPosition = m_InputLog.begin();
73+
m_LastLogMove = 0;
74+
} else {
75+
m_ConsoleText->SetText(m_ConsoleTextBackup);
76+
m_ConsoleTextBackup.clear();
77+
}
7278

7379
return 0;
7480
}
7581

7682
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7783

7884
void ConsoleMan::Destroy() {
79-
SaveAllText("LogConsole.txt");
85+
if (g_FrameMan.ResolutionChanged()) {
86+
m_ConsoleTextBackup = m_ConsoleText->GetText();
87+
} else {
88+
SaveAllText("LogConsole.txt");
89+
}
8090

8191
delete m_GUIControlManager;
8292
delete m_GUIInput;
8393
delete m_GUIScreen;
8494

85-
Clear();
95+
if (g_FrameMan.ResolutionChanged()) {
96+
m_GUIScreen = nullptr;
97+
m_GUIInput = nullptr;
98+
m_GUIControlManager = nullptr;
99+
m_ParentBox = nullptr;
100+
} else {
101+
Clear();
102+
}
86103
}
87104

88105
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Managers/ConsoleMan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ namespace RTE {
176176
std::string m_LastInputString; //!< Place to save the last worked on input string before deactivating the console.
177177
short m_LastLogMove; //!< The last direction the log marker was moved. Needed so that changing directions won't need double tapping.
178178

179+
std::string m_ConsoleTextBackup; //!< A copy of the whole console text at the time of destruction. Used to restore console text when ConsoleMan is re-created after a resolution change.
180+
179181
private:
180182

181183
/// <summary>

Managers/SceneMan.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ void SceneMan::Destroy()
437437

438438
Vector SceneMan::GetSceneDim() const
439439
{
440-
if (m_pCurrentScene)
441-
RTEAssert(m_pCurrentScene->GetTerrain() && m_pCurrentScene->GetTerrain()->GetBitmap(), "Trying to get terrain info before there is a scene or terrain!");
442-
return m_pCurrentScene->GetDimensions();
440+
if (m_pCurrentScene) {
441+
RTEAssert(m_pCurrentScene->GetTerrain() && m_pCurrentScene->GetTerrain()->GetBitmap(), "Trying to get terrain info before there is a scene or terrain!");
442+
return m_pCurrentScene->GetDimensions();
443+
}
443444
return Vector();
444445
}
445446

Menus/PieMenuGUI.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ int PieMenuGUI::Slice::ReadProperty(std::string propName, Reader &reader)
191191
reader >> m_Icon;
192192
else if (propName == "Direction")
193193
reader >> m_Direction;
194-
else if (propName == "ScriptPath")
195-
reader >> m_ScriptPath;
196-
else if (propName == "FunctionName")
194+
else if (propName == "ScriptPath") {
195+
reader >> m_ScriptPath;
196+
CorrectBackslashesInPaths(m_ScriptPath);
197+
} else if (propName == "FunctionName")
197198
reader >> m_FunctionName;
198199
else
199200
return Serializable::ReadProperty(propName, reader);

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The Linux build uses the meson build system, and builds against system libraries
3939

4040
Dependencies:
4141

42-
* `g++>=8.1` (needs to support c++17)
42+
* `g++>=8.1` (needs to support c++17 filesystem)
4343
* `allegro4`
4444
* `loadpng`
4545
* `flac`
@@ -48,41 +48,44 @@ Dependencies:
4848
* `lz4`
4949
* `libpng`
5050
* `libX11`
51-
* `meson>=0.49`
51+
* `meson>=0.43`
5252
* `boost>=1.55`
5353
* `xorg-misc-fonts`
5454

5555
Building:
5656

5757
1. Install Dependencies (see below for some distro-specific instructions)
5858

59-
2. Clone this Source Repository and the [Data Respository](https://github.com/cortex-command-community/Cortex-Command-Community-Project-Data), folder structure doesn't really matter here
59+
2. Clone this Source Repository and the [Data Respository](https://github.com/cortex-command-community/Cortex-Command-Community-Project-Data)
6060

6161
3. open a terminal in the Source Repository
6262

6363
4. `meson builddir`
6464

6565
5. `cd builddir`
6666

67-
6. `meson compile` or `meson [-j<num of threads>] compile CCCP` if you want a release build
68-
If the build fails because of memory shortage you may need to reduce the number of build threads (meson will use all available threads by default) using the `-j<number of threads>` option
67+
For `meson` versions `>=0.54` (check `meson --version`):
68+
69+
6. `meson compile` for debug build, or `meson compile CCCP` for a release build. If the build fails because of memory shortage you may need to reduce the number of build threads (meson will use all available threads by default) using the `-j<number of threads>` option, if this doesn't help increase your swap size to at least 6Gb
70+
71+
For `meson` versions `<0.54`
72+
73+
6. `ninja` for debug builds, or `ninja CCCP.x86_64` for release builds. Using the `-j<number of threads>` option will also work here.
6974

7075

7176
Running:
7277

73-
1. Copy (or link, preferable for quick debug builds) `builddir/CCCP_debug.x86_64` or `builddir/CCCP.x86_64` (depending on if you made a release build) into the **Data Repository**
78+
1. Copy (or link, might be preferable for testing builds) `builddir/CCCP_debug.x86_64` or `builddir/CCCP.x86_64` (depending on if you made a release build) into the **Data Repository**
7479

7580
2. Copy `Scenes.rte` and `Metagames.rte` from your purchased copy of Cortex Command into **Data Repository**
7681

77-
3. Copy (or link) `libfmod.so.11` from `<Source Repository Root>/external/lib/linux/x86_64` into the **Data Repository**
78-
79-
4. Run `env LD_LIBRARY_PATH=. ./CCCP.x86_64` or `./CCCP_debug.x86_64` in the **Data Repository**
82+
3. Run `./CCCP.x86_64` or `./CCCP_debug.x86_64` in the **Data Repository**
8083

8184
### Arch Linux ###
8285
`# pacman -S allegro4 flac luajit minizip lz4 libpng libx11 meson xorg-fonts-misc`
8386

8487
### Ubuntu ###
85-
`# apt-get install liballegro4.4 libloadpng4-dev libflac++-dev luajit-5.1-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev meson`
88+
`# apt-get install liballegro4-dev libloadpng4-dev libflac++-dev luajit-5.1-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev meson`
8689

8790
### Troubleshooting ###
8891
Until borderless windows are implemented, you might seem get stuck in fullscreen mode. Try Alt-Return, or if that doesn't work kill CC with ctrl-alt-end.

0 commit comments

Comments
 (0)