summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml5
-rw-r--r--CMakeLists.txt51
m---------data0
-rw-r--r--debian/changelog2
-rw-r--r--lib/gmock/CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt16
-rw-r--r--src/graphics/engine/modelmanager.cpp4
-rw-r--r--src/sound/oalsound/alsound.cpp70
-rw-r--r--src/sound/oalsound/alsound.h4
-rw-r--r--src/sound/oalsound/buffer.cpp4
-rw-r--r--src/sound/oalsound/channel.cpp45
-rw-r--r--src/sound/oalsound/channel.h7
-rw-r--r--src/sound/sound.h2
-rw-r--r--src/ui/maindialog.cpp51
14 files changed, 172 insertions, 91 deletions
diff --git a/.travis.yml b/.travis.yml
index ed7cf35..ad384f7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,15 @@
language: cpp
compiler:
- gcc
+ - clang
script: debuild -b -us -uc --lintian-opts "-ivI"
before_install:
- git submodule update --init --recursive
+ - sudo add-apt-repository ppa:mapnik/boost -y
- sudo apt-get update -qq
- sudo apt-get install -qq --no-install-recommends devscripts dpkg-dev lintian equivs
- mk-build-deps --root-cmd sudo --tool "apt-get -qq --no-install-recommends" --install --remove
- dch -v 0~git$(date +%Y%m%d%H%M)00-1~travis0 -m "Automated test-build."
+ - sudo apt-get install -qq --no-install-recommends libgl1-mesa-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libpng12-dev libglew-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev google-mock libgtest-dev doxygen graphviz po4a librsvg2-bin
+notifications:
+ email: false
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 339e633..2e309d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,11 +46,33 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE debug)
endif()
+# Compiler detection
+if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ execute_process(
+ COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+ if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
+ message(STATUS "Detected GCC version 4.7+")
+ set(CXX11_FLAGS "-std=c++11")
+ elseif (GCC_VERSION VERSION_GREATER 4.6 OR GCC_VERSION VERSION_EQUAL 4.6)
+ message(STATUS "Detected GCC version 4.6+")
+ set(CXX11_FLAGS "-std=c++0x")
+ else()
+ message(FATAL_ERROR "${PROJECT_NAME} requires GCC 4.6 or greater.")
+ endif()
+elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ message(STATUS "Detected Clang compiler")
+ set(CXX11_FLAGS "-std=c++11")
+else()
+ message(FATAL_ERROR "Your C++ compiler doesn't seem to support C++11.\n"
+ "Supported compilers at this time are GCC 4.6+ and clang.")
+endif()
+
# Global compile flags
-# These are specific to GCC/MinGW; for other compilers, change as necessary
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=c++11")
-set(CMAKE_CXX_FLAGS_RELEASE "-O2")
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
+# These are specific to GCC/MinGW/clang; for other compilers, change as necessary
+# The flags are used throughout src/ subdir
+set(COLOBOT_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast ${CXX11_FLAGS}")
+set(COLOBOT_CXX_FLAGS_RELEASE "-O2")
+set(COLOBOT_CXX_FLAGS_DEBUG "-g -O0")
# Asserts can be enabled/disabled regardless of build type
option(ASSERTS "Enable assert()s" ON)
@@ -185,11 +207,11 @@ if(${TESTS})
endif()
# Installation paths defined before compiling sources
-set(COLOBOT_INSTALL_BIN_DIR games CACHE PATH "Colobot binary directory")
-set(COLOBOT_INSTALL_DATA_DIR share/games/colobot CACHE PATH "Colobot shared data directory")
-set(COLOBOT_INSTALL_LIB_DIR lib/colobot CACHE PATH "Colobot libraries directory")
-set(COLOBOT_INSTALL_DOC_DIR share/doc/colobot CACHE PATH "Colobot documentation directory")
-set(COLOBOT_INSTALL_I18N_DIR share/locale CACHE PATH "Colobot translations directory")
+set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/games CACHE PATH "Colobot binary directory")
+set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/games/colobot CACHE PATH "Colobot shared data directory")
+set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/colobot CACHE PATH "Colobot libraries directory")
+set(COLOBOT_INSTALL_DOC_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/colobot CACHE PATH "Colobot documentation directory")
+set(COLOBOT_INSTALL_I18N_DIR ${CMAKE_INSTALL_PREFIX}/share/locale CACHE PATH "Colobot translations directory")
# Subdirectory with sources
add_subdirectory(src bin)
@@ -199,10 +221,13 @@ add_subdirectory(src bin)
# Installation
##
-file(GLOB DATA_FILES "data/*")
-
-# Data
-install(DIRECTORY data/ DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
+# Data: check if the submodule handles its own installation
+if(EXISTS "${CMAKE_SOURCE_DIR}/data/CMakeLists.txt")
+ message(STATUS "Data directory will install itself.")
+ add_subdirectory(data)
+else()
+ message(WARNING "Data directory is not available; make sure colobot-data is installed in ${COLOBOT_INSTALL_DATA_DIR}.")
+endif()
# Documentation
if(INSTALL_DOCS AND DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
diff --git a/data b/data
-Subproject 52e119b5f97a1347e257de082a3c6dc2588454b
+Subproject 5a991a77eb5f476d29b4d4f976be48fdf74a053
diff --git a/debian/changelog b/debian/changelog
index 0069124..a744226 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-colobot (0.1.0~pre-alpha-git-dev~r5a6b3f0-1~OdyX0) UNRELEASED; urgency=low
+colobot (0.1.0~pre-alpha-git-dev~r35faf62-1~OdyX0) UNRELEASED; urgency=low
* Initial release. (Closes: #695829)
diff --git a/lib/gmock/CMakeLists.txt b/lib/gmock/CMakeLists.txt
index 3fec0d3..e7ff803 100644
--- a/lib/gmock/CMakeLists.txt
+++ b/lib/gmock/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 2.8)
+set(CMAKE_CXX_FLAGS "${${ORIGINAL_CXX_FLAGS}}")
+
include_directories(. include ${GTEST_INCLUDE_DIR})
# gmock-all.cc includes all other sources
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c00d347..a90b735 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,13 @@
-# CBot library is built separately
+# Compile flags as defined in global CMakeLists
+set(CMAKE_CXX_FLAGS ${COLOBOT_CXX_FLAGS})
+set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
+set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})
+
+
+# Subdirectories
+
add_subdirectory(CBot)
-# Tools directory is built separately
add_subdirectory(tools)
add_subdirectory(po)
@@ -196,10 +202,16 @@ ${OPTIONAL_LIBS}
${PLATFORM_LIBS}
)
+# Local
include_directories(
.
..
${CMAKE_CURRENT_BINARY_DIR}
+)
+
+# System
+include_directories(
+SYSTEM
${SDL_INCLUDE_DIR}
${SDLIMAGE_INCLUDE_DIR}
${SDLTTF_INCLUDE_DIR}
diff --git a/src/graphics/engine/modelmanager.cpp b/src/graphics/engine/modelmanager.cpp
index afaa718..5b17769 100644
--- a/src/graphics/engine/modelmanager.cpp
+++ b/src/graphics/engine/modelmanager.cpp
@@ -8,9 +8,9 @@
#include <cstdio>
-namespace Gfx {
+template<> Gfx::CModelManager* CSingleton<Gfx::CModelManager>::mInstance = nullptr;
-template<> CModelManager* CSingleton<CModelManager>::mInstance = nullptr;
+namespace Gfx {
CModelManager::CModelManager(CEngine* engine)
{
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index b8dbcda..80e8fe6 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -20,14 +20,13 @@
#include "alsound.h"
-
#define MIN(a, b) (a > b ? b : a)
ALSound::ALSound()
{
mEnabled = false;
m3D = false;
- mAudioVolume = MAXVOLUME;
+ mAudioVolume = 1.0f;
mMute = false;
auto pointer = CInstanceManager::GetInstancePointer();
if (pointer != nullptr)
@@ -105,7 +104,7 @@ bool ALSound::GetSound3DCap()
}
-bool ALSound::RetEnable()
+bool ALSound::GetEnable()
{
return mEnabled;
}
@@ -113,8 +112,8 @@ bool ALSound::RetEnable()
void ALSound::SetAudioVolume(int volume)
{
- alListenerf(AL_GAIN, MIN(volume, MAXVOLUME) * 0.01f);
- mAudioVolume = MIN(volume, MAXVOLUME);
+ alListenerf(AL_GAIN, MIN(static_cast<float>(volume) / MAXVOLUME, 1.0f));
+ mAudioVolume = MIN(static_cast<float>(volume) / MAXVOLUME, 1.0f);
}
@@ -291,18 +290,14 @@ int ALSound::Play(Sound sound, float amplitude, float frequency, bool bLoop)
int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequency, bool bLoop)
{
- if (!mEnabled)
- return -1;
-
- if (mAudioVolume <= 0.0f)
+ if (!mEnabled) {
return -1;
+ }
if (mSounds.find(sound) == mSounds.end()) {
GetLogger()->Warn("Sound %d was not loaded!\n", sound);
return -1;
}
-
- GetLogger()->Trace("ALSound::Play sound: %d volume: %f frequency: %f\n", sound, amplitude, frequency);
int channel;
bool bAlreadyLoaded;
@@ -312,7 +307,7 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc
bAlreadyLoaded = false;
if (!bAlreadyLoaded) {
if (!mChannels[channel]->SetBuffer(mSounds[sound])) {
- GetLogger()->Trace("ALSound::Play SetBuffer failed\n");
+ mChannels[channel]->SetBuffer(nullptr);
return -1;
}
}
@@ -320,12 +315,13 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc
Position(channel, pos);
// setting initial values
- mChannels[channel]->SetStartAmplitude(mAudioVolume);
+ mChannels[channel]->SetStartAmplitude(amplitude);
mChannels[channel]->SetStartFrequency(frequency);
mChannels[channel]->SetChangeFrequency(1.0f);
mChannels[channel]->ResetOper();
- mChannels[channel]->AdjustFrequency(frequency);
- mChannels[channel]->AdjustVolume(amplitude * mAudioVolume);
+ mChannels[channel]->SetFrequency(frequency * mChannels[channel]->GetFrequency());
+ mChannels[channel]->SetVolume(amplitude);
+ mChannels[channel]->SetLoop(bLoop);
mChannels[channel]->Play();
return channel;
}
@@ -350,15 +346,16 @@ bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float t
if (mChannels.find(channel) == mChannels.end()) {
return false;
}
-
+
SoundOper op;
op.finalAmplitude = amplitude;
op.finalFrequency = frequency;
op.totalTime = time;
op.nextOper = oper;
+ op.currentTime = 0.0f;
mChannels[channel]->AddOper(op);
- return false;
+ return true;
}
@@ -438,7 +435,6 @@ bool ALSound::MuteAll(bool bMute)
return true;
}
-
void ALSound::FrameMove(float delta)
{
if (!mEnabled)
@@ -447,36 +443,38 @@ void ALSound::FrameMove(float delta)
float progress;
float volume, frequency;
for (auto it : mChannels) {
- if (!it.second->IsPlaying())
+ if (!it.second->IsPlaying()) {
continue;
+ }
if (!it.second->HasEnvelope())
continue;
-
- //it.second->GetEnvelope().currentTime += delta;
- SoundOper oper = it.second->GetEnvelope();
- progress = it.second->GetCurrentTime() / oper.totalTime;
+
+ SoundOper &oper = it.second->GetEnvelope();
+ oper.currentTime += delta;
+ progress = oper.currentTime / oper.totalTime;
progress = MIN(progress, 1.0f);
// setting volume
- volume = progress * abs(oper.finalAmplitude - it.second->GetStartAmplitude());
- it.second->AdjustVolume(volume * mAudioVolume);
-
- // setting frequency
- frequency = progress * abs(oper.finalFrequency - it.second->GetStartFrequency()) * it.second->GetStartFrequency() * it.second->GetChangeFrequency();
+ volume = progress * (oper.finalAmplitude - it.second->GetStartAmplitude());
+ it.second->SetVolume(volume + it.second->GetStartAmplitude());
+
+ // setting frequency
+ frequency = progress * (oper.finalFrequency - it.second->GetStartFrequency()) * it.second->GetStartFrequency() * it.second->GetChangeFrequency() * it.second->GetInitFrequency();
it.second->AdjustFrequency(frequency);
- if (it.second->GetEnvelope().totalTime <= it.second->GetCurrentTime()) {
-
+ if (oper.totalTime <= oper.currentTime) {
if (oper.nextOper == SOPER_LOOP) {
- GetLogger()->Trace("ALSound::FrameMove oper: replay.\n");
- it.second->SetCurrentTime(0.0f);
+ oper.currentTime = 0.0f;
it.second->Play();
} else {
- GetLogger()->Trace("ALSound::FrameMove oper: next.\n");
- it.second->SetStartAmplitude(oper.finalAmplitude);
- it.second->SetStartFrequency(oper.finalFrequency);
- it.second->PopEnvelope();
+ it.second->SetStartAmplitude(oper.finalAmplitude);
+ it.second->SetStartFrequency(oper.finalFrequency);
+ if (oper.nextOper == SOPER_STOP) {
+ it.second->Stop();
+ }
+
+ it.second->PopEnvelope();
}
}
}
diff --git a/src/sound/oalsound/alsound.h b/src/sound/oalsound/alsound.h
index 7d24ba6..7aeec90 100644
--- a/src/sound/oalsound/alsound.h
+++ b/src/sound/oalsound/alsound.h
@@ -42,7 +42,7 @@ class ALSound : public CSoundInterface
bool Create(bool b3D);
bool Cache(Sound, std::string);
- bool RetEnable();
+ bool GetEnable();
void SetSound3D(bool bMode);
bool GetSound3D();
@@ -86,7 +86,7 @@ class ALSound : public CSoundInterface
bool mEnabled;
bool m3D;
bool mMute;
- int mAudioVolume;
+ float mAudioVolume;
ALCdevice* audioDevice;
ALCcontext* audioContext;
std::map<Sound, Buffer*> mSounds;
diff --git a/src/sound/oalsound/buffer.cpp b/src/sound/oalsound/buffer.cpp
index dbfdca2..27da848 100644
--- a/src/sound/oalsound/buffer.cpp
+++ b/src/sound/oalsound/buffer.cpp
@@ -20,7 +20,7 @@
Buffer::Buffer() {
mLoaded = false;
- mDuration = 0;
+ mDuration = 0.0f;
}
@@ -53,7 +53,7 @@ bool Buffer::LoadFromFile(std::string filename, Sound sound) {
alGetBufferi(mBuffer, AL_CHANNELS, &channels);
alGetBufferi(mBuffer, AL_FREQUENCY, &freq);
- mDuration = static_cast<ALfloat>(size) / channels / bits / 8 / static_cast<ALfloat>(freq);
+ mDuration = static_cast<ALfloat>(size) * 8 / channels / bits / static_cast<ALfloat>(freq);
mLoaded = true;
return true;
diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp
index e1bf202..4069313 100644
--- a/src/sound/oalsound/channel.cpp
+++ b/src/sound/oalsound/channel.cpp
@@ -18,6 +18,7 @@
#include "channel.h"
+#define MIN(a, b) (a > b ? b : a)
Channel::Channel() {
alGenSources(1, &mSource);
@@ -31,6 +32,8 @@ Channel::Channel() {
mPriority = 0;
mBuffer = nullptr;
+ mLoop = false;
+ mInitFrequency = 0.0f;
}
@@ -49,6 +52,7 @@ bool Channel::Play() {
if (!mReady || mBuffer == nullptr)
return false;
+ alSourcei(mSource, AL_LOOPING, static_cast<ALint>(mLoop));
alSourcePlay(mSource);
if (alCheck())
GetLogger()->Warn("Could not play audio sound source. Code: %d\n", alGetCode());
@@ -83,6 +87,15 @@ bool Channel::SetFrequency(float freq)
}
+bool Channel::AdjustFrequency(float freq)
+{
+ if (!mReady || mBuffer == nullptr)
+ return false;
+
+ return SetFrequency(mInitFrequency - freq);
+}
+
+
float Channel::GetFrequency()
{
ALfloat freq;
@@ -104,7 +117,7 @@ bool Channel::SetVolume(float vol)
if (!mReady || vol < 0 || mBuffer == nullptr)
return false;
- alSourcef(mSource, AL_GAIN, vol / MAXVOLUME);
+ alSourcef(mSource, AL_GAIN, MIN(vol, 1.0f));
if (alCheck()) {
GetLogger()->Warn("Could not set sound volume to '%f'. Code: %d\n", vol, alGetCode());
return false;
@@ -125,7 +138,7 @@ float Channel::GetVolume()
return 0;
}
- return vol * MAXVOLUME;
+ return vol;
}
@@ -144,6 +157,7 @@ void Channel::SetPriority(int pri)
void Channel::SetStartAmplitude(float gain)
{
mStartAmplitude = gain;
+ SetVolume(mStartAmplitude);
}
@@ -159,12 +173,6 @@ void Channel::SetChangeFrequency(float freq)
}
-void Channel::SetInitFrequency(float freq)
-{
- mInitFrequency = freq;
-}
-
-
float Channel::GetStartAmplitude()
{
return mStartAmplitude;
@@ -213,8 +221,12 @@ bool Channel::SetBuffer(Buffer *buffer) {
if (!mReady)
return false;
- assert(buffer);
mBuffer = buffer;
+ if (buffer == nullptr) {
+ alSourcei(mSource, AL_BUFFER, 0);
+ return true;
+ }
+
alSourcei(mSource, AL_BUFFER, buffer->GetBuffer());
if (alCheck()) {
GetLogger()->Warn("Could not set sound buffer. Code: %d\n", alGetCode());
@@ -225,16 +237,6 @@ bool Channel::SetBuffer(Buffer *buffer) {
}
-void Channel::AdjustFrequency(float freq) {
- SetFrequency(freq * mInitFrequency);
-}
-
-
-void Channel::AdjustVolume(float volume) {
- SetVolume(mStartAmplitude * volume);
-}
-
-
bool Channel::IsPlaying() {
ALint status;
if (!mReady || mBuffer == nullptr)
@@ -323,3 +325,8 @@ void Channel::PopEnvelope()
{
mOper.pop_front();
}
+
+
+void Channel::SetLoop(bool loop) {
+ mLoop = loop;
+} \ No newline at end of file
diff --git a/src/sound/oalsound/channel.h b/src/sound/oalsound/channel.h
index 5caf2b0..70307ef 100644
--- a/src/sound/oalsound/channel.h
+++ b/src/sound/oalsound/channel.h
@@ -35,6 +35,7 @@ struct SoundOper
float finalAmplitude;
float finalFrequency;
float totalTime;
+ float currentTime;
SoundNext nextOper;
};
@@ -51,6 +52,7 @@ class Channel
bool SetFrequency(float);
float GetFrequency();
+ bool AdjustFrequency(float);
float GetCurrentTime();
void SetCurrentTime(float);
@@ -73,7 +75,6 @@ class Channel
void SetStartAmplitude(float);
void SetStartFrequency(float);
void SetChangeFrequency(float);
- void SetInitFrequency(float);
float GetStartAmplitude();
float GetStartFrequency();
@@ -83,8 +84,7 @@ class Channel
void AddOper(SoundOper);
void ResetOper();
Sound GetSoundType();
- void AdjustFrequency(float);
- void AdjustVolume(float);
+ void SetLoop(bool);
private:
Buffer *mBuffer;
@@ -97,4 +97,5 @@ class Channel
float mInitFrequency;
std::deque<SoundOper> mOper;
bool mReady;
+ bool mLoop;
};
diff --git a/src/sound/sound.h b/src/sound/sound.h
index a09c587..c9ac349 100644
--- a/src/sound/sound.h
+++ b/src/sound/sound.h
@@ -37,7 +37,7 @@
/*!
* Maximum possible audio volume
*/
-#define MAXVOLUME 100
+#define MAXVOLUME 100.0f
/**
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 68e7854..bbba825 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -4277,6 +4277,7 @@ void CMainDialog::IOReadName()
CEdit* pe;
std::string filename;
char op[100];
+ char op_i18n[100];
char line[500];
char resume[100];
char name[100];
@@ -4290,6 +4291,9 @@ void CMainDialog::IOReadName()
sprintf(resume, "%s %d", m_sceneName, m_chap[m_index]+1);
BuildSceneName(filename, m_sceneName, (m_chap[m_index]+1)*100);
+ sprintf(op, "Title.E");
+ sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar() );
+
file = fopen(filename.c_str(), "r");
if ( file != NULL )
{
@@ -4305,11 +4309,13 @@ void CMainDialog::IOReadName()
}
}
- // TODO: Fallback to an non-localized entry
- sprintf(op, "Title.%c", m_app->GetLanguageChar() );
if ( Cmd(line, op) )
{
OpString(line, "resume", resume);
+ }
+ if ( Cmd(line, op_i18n) )
+ {
+ OpString(line, "resume", resume);
break;
}
}
@@ -4648,12 +4654,14 @@ void CMainDialog::UpdateSceneChap(int &chap)
//struct _finddata_t fileBuffer;
std::string fileName;
char op[100];
+ char op_i18n[100];
char line[500];
char name[100];
int i, j;
bool bPassed;
memset(op, 0, 100);
+ memset(op_i18n, 0, 100);
memset(line, 0, 500);
memset(name, 0, 100);
@@ -4689,6 +4697,9 @@ void CMainDialog::UpdateSceneChap(int &chap)
else
{
BuildResumeName(name, m_sceneName, j+1); // default name
+ sprintf(op, "Title.E");
+ sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar());
+
while ( fgets(line, 500, file) != NULL )
{
for ( i=0 ; i<500 ; i++ )
@@ -4701,11 +4712,13 @@ void CMainDialog::UpdateSceneChap(int &chap)
}
}
- // TODO: Fallback to an non-localized entry
- sprintf(op, "Title.%c", m_app->GetLanguageChar());
if ( Cmd(line, op) )
{
OpString(line, "text", name);
+ }
+ if ( Cmd(line, op_i18n) )
+ {
+ OpString(line, "text", name);
break;
}
}
@@ -4736,6 +4749,9 @@ void CMainDialog::UpdateSceneChap(int &chap)
if ( file == NULL ) break;
BuildResumeName(name, m_sceneName, j+1); // default name
+ sprintf(op, "Title.E");
+ sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar());
+
while ( fgets(line, 500, file) != NULL )
{
for ( i=0 ; i<500 ; i++ )
@@ -4748,11 +4764,13 @@ void CMainDialog::UpdateSceneChap(int &chap)
}
}
- // TODO: Fallback to an non-localized entry
- sprintf(op, "Title.%c", m_app->GetLanguageChar());
if ( Cmd(line, op) )
{
OpString(line, "text", name);
+ }
+ if ( Cmd(line, op_i18n) )
+ {
+ OpString(line, "text", name);
break;
}
}
@@ -4801,12 +4819,14 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
CList* pl;
std::string fileName;
char op[100];
+ char op_i18n[100];
char line[500];
char name[100];
int i, j;
bool bPassed;
memset(op, 0, 100);
+ memset(op_i18n, 0, 100);
memset(line, 0, 500);
memset(name, 0, 100);
@@ -4839,6 +4859,9 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
if ( file == NULL ) break;
BuildResumeName(name, m_sceneName, j+1); // default name
+ sprintf(op, "Title.E");
+ sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar());
+
while ( fgets(line, 500, file) != NULL )
{
for ( i=0 ; i<500 ; i++ )
@@ -4851,11 +4874,13 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
}
}
- // TODO: Fallback to an non-localized entry
- sprintf(op, "Title.%c", m_app->GetLanguageChar());
if ( Cmd(line, op) )
{
OpString(line, "text", name);
+ }
+ if ( Cmd(line, op_i18n) )
+ {
+ OpString(line, "text", name);
break;
}
}
@@ -4950,6 +4975,7 @@ void CMainDialog::UpdateSceneResume(int rank)
CCheck* pc;
std::string fileName;
char op[100];
+ char op_i18n[100];
char line[500];
char name[500];
int i, numTry;
@@ -4980,6 +5006,9 @@ void CMainDialog::UpdateSceneResume(int rank)
}
BuildSceneName(fileName, m_sceneName, rank);
+ sprintf(op, "Resume.E");
+ sprintf(op_i18n, "Resume.%c", m_app->GetLanguageChar());
+
file = fopen(fileName.c_str(), "r");
if ( file == NULL ) return;
@@ -4996,11 +5025,13 @@ void CMainDialog::UpdateSceneResume(int rank)
}
}
- // TODO: Fallback to an non-localized entry
- sprintf(op, "Resume.%c", m_app->GetLanguageChar());
if ( Cmd(line, op) )
{
OpString(line, "text", name);
+ }
+ if ( Cmd(line, op_i18n) )
+ {
+ OpString(line, "text", name);
break;
}
}