Merge remote-tracking branch 'upstream/master'

pull/21/head
Roman Melnik 13 years ago
commit cabf7ff8ba

@ -186,6 +186,11 @@ endif (APPLE)
# Dependencies # Dependencies
# Fix for not visible pthreads functions for linker with glibc 2.15
if (UNIX AND NOT APPLE)
find_package (Threads)
endif()
find_package(OGRE REQUIRED) find_package(OGRE REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem program_options thread) find_package(Boost REQUIRED COMPONENTS system filesystem program_options thread)
find_package(OIS REQUIRED) find_package(OIS REQUIRED)
@ -322,7 +327,7 @@ if(DPKG_PROGRAM)
SET(CPACK_DEBIAN_PACKAGE_NAME "openmw") SET(CPACK_DEBIAN_PACKAGE_NAME "openmw")
SET(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_STRING}") SET(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_STRING}")
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW esmtool;Esmtool omwlauncher;OMWLauncher") SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW esmtool;Esmtool omwlauncher;OMWLauncher")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libogre-1.7.3 (>= 1.7.3), libbullet0 (>= 2.77), libboost-filesystem1.46.1 (>= 1.46.1), libboost-program-options1.46.1 (>= 1.46.1), libboost-system1.46.1 (>= 1.46.1), libboost-thread1.46.1 (>= 1.46.1), libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libois-1.3.0 (>= 1.3.0), libopenal1 (>= 1:1.12.854), libsndfile1 (>= 1.0.23), libstdc++6 (>= 4.4.5), libuuid1 (>= 2.17.2), libqtgui4 (>= 4.7.0)") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "nvidia-cg-toolkit (>= 2.1), libboost-filesystem1.46.1 (>= 1.46.1), libboost-program-options1.46.1 (>= 1.46.1), libboost-system1.46.1 (>= 1.46.1), libboost-thread1.46.1 (>= 1.46.1), libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libois-1.3.0 (>= 1.3.0), libopenal1 (>= 1:1.12.854), libsndfile1 (>= 1.0.23), libstdc++6 (>= 4.4.5), libuuid1 (>= 2.17.2), libqtgui4 (>= 4.7.0)")
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games") SET(CPACK_DEBIAN_PACKAGE_SECTION "Games")
@ -342,6 +347,7 @@ if(WIN32)
FILE(GLOB files "${OpenMW_BINARY_DIR}/Release/*.*") FILE(GLOB files "${OpenMW_BINARY_DIR}/Release/*.*")
INSTALL(FILES ${files} DESTINATION ".") INSTALL(FILES ${files} DESTINATION ".")
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg") INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg")
INSTALL(FILES "${OpenMW_SOURCE_DIR}/readme.txt" DESTINATION ".")
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".") INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".")
SET(CPACK_GENERATOR "NSIS") SET(CPACK_GENERATOR "NSIS")
@ -352,6 +358,7 @@ if(WIN32)
SET(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) SET(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO})
SET(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) SET(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE})
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW;esmtool;Esmtool;omwlauncher;OpenMW Launcher") SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW;esmtool;Esmtool;omwlauncher;OpenMW Launcher")
set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Readme.lnk' '\$INSTDIR\\\\readme.txt'")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenMW_SOURCE_DIR}/readme.txt") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenMW_SOURCE_DIR}/readme.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${OpenMW_SOURCE_DIR}/GPL3.txt") SET(CPACK_RESOURCE_FILE_LICENSE "${OpenMW_SOURCE_DIR}/GPL3.txt")
SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
@ -494,6 +501,7 @@ if (APPLE)
install(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" RENAME "openmw.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) install(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" RENAME "openmw.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
install(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) install(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
install(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
set(CPACK_GENERATOR "DragNDrop") set(CPACK_GENERATOR "DragNDrop")
set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION})

@ -222,10 +222,10 @@ void DataFilesPage::setupDataFiles()
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setWindowTitle("Error detecting Morrowind installation"); msgBox.setWindowTitle("Error detecting Morrowind installation");
msgBox.setIcon(QMessageBox::Critical); msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Cancel); msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.setText(tr("<br><b>Could not find the Data Files location</b><br><br> \ msgBox.setText(tr("<br><b>Could not find the Data Files location</b><br><br> \
The directory containing the Data Files was not found.<br><br> \ The directory containing the data files was not found.<br><br> \
Press \"Browse...\" to specify the location manually.<br>")); Press \"Browse...\" to specify the location manually.<br>"));
QAbstractButton *dirSelectButton = QAbstractButton *dirSelectButton =
@ -279,72 +279,79 @@ void DataFilesPage::setupDataFiles()
const Files::MultiDirCollection &esp = fileCollections.getCollection(".esp"); const Files::MultiDirCollection &esp = fileCollections.getCollection(".esp");
for (Files::MultiDirCollection::TIter iter(esp.begin()); iter!=esp.end(); ++iter) { for (Files::MultiDirCollection::TIter iter(esp.begin()); iter!=esp.end(); ++iter) {
ESMReader fileReader;
QStringList availableMasters; // Will contain all found masters
fileReader.setEncoding(variables["encoding"].as<std::string>()); try {
fileReader.open(iter->second.string()); ESMReader fileReader;
QStringList availableMasters; // Will contain all found masters
fileReader.setEncoding(variables["encoding"].as<std::string>());
fileReader.open(iter->second.string());
// First we fill the availableMasters and the mMastersWidget // First we fill the availableMasters and the mMastersWidget
ESMReader::MasterList mlist = fileReader.getMasters(); ESMReader::MasterList mlist = fileReader.getMasters();
for (unsigned int i = 0; i < mlist.size(); ++i) { for (unsigned int i = 0; i < mlist.size(); ++i) {
const QString currentMaster = QString::fromStdString(mlist[i].name); const QString currentMaster = QString::fromStdString(mlist[i].name);
availableMasters.append(currentMaster); availableMasters.append(currentMaster);
const QList<QTableWidgetItem*> itemList = mMastersWidget->findItems(currentMaster, Qt::MatchExactly); const QList<QTableWidgetItem*> itemList = mMastersWidget->findItems(currentMaster, Qt::MatchExactly);
if (itemList.isEmpty()) { // Master is not yet in the widget if (itemList.isEmpty()) { // Master is not yet in the widget
mMastersWidget->insertRow(i); mMastersWidget->insertRow(i);
QTableWidgetItem *item = new QTableWidgetItem(currentMaster); QTableWidgetItem *item = new QTableWidgetItem(currentMaster);
item->setForeground(Qt::red); item->setForeground(Qt::red);
item->setFlags(item->flags() & ~(Qt::ItemIsSelectable)); item->setFlags(item->flags() & ~(Qt::ItemIsSelectable));
mMastersWidget->setItem(i, 0, item); mMastersWidget->setItem(i, 0, item);
}
} }
}
availableMasters.sort(); // Sort the masters alphabetically availableMasters.sort(); // Sort the masters alphabetically
// Now we put the current plugin in the mDataFilesModel under its masters // Now we put the current plugin in the mDataFilesModel under its masters
QStandardItem *parent = new QStandardItem(availableMasters.join(",")); QStandardItem *parent = new QStandardItem(availableMasters.join(","));
QString fileName = QString::fromStdString(boost::filesystem::path (iter->second.filename()).string()); QString fileName = QString::fromStdString(boost::filesystem::path (iter->second.filename()).string());
QStandardItem *child = new QStandardItem(fileName); QStandardItem *child = new QStandardItem(fileName);
// Tooltip information // Tooltip information
QString author = QString::fromStdString(fileReader.getAuthor()); QString author = QString::fromStdString(fileReader.getAuthor());
float version = fileReader.getFVer(); float version = fileReader.getFVer();
QString description = QString::fromStdString(fileReader.getDesc()); QString description = QString::fromStdString(fileReader.getDesc());
// For the date created/modified // For the date created/modified
QFileInfo fi(QString::fromStdString(iter->second.string())); QFileInfo fi(QString::fromStdString(iter->second.string()));
QString toolTip= QString("<b>Author:</b> %1<br/> \ QString toolTip= QString("<b>Author:</b> %1<br/> \
<b>Version:</b> %2<br/><br/> \ <b>Version:</b> %2<br/><br/> \
<b>Description:</b><br/> \ <b>Description:</b><br/> \
%3<br/><br/> \ %3<br/><br/> \
<b>Created on:</b> %4<br/> \ <b>Created on:</b> %4<br/> \
<b>Last modified:</b> %5") <b>Last modified:</b> %5")
.arg(author) .arg(author)
.arg(version) .arg(version)
.arg(description) .arg(description)
.arg(fi.created().toString(Qt::TextDate)) .arg(fi.created().toString(Qt::TextDate))
.arg(fi.lastModified().toString(Qt::TextDate)); .arg(fi.lastModified().toString(Qt::TextDate));
child->setToolTip(toolTip); child->setToolTip(toolTip);
const QList<QStandardItem*> masterList = mDataFilesModel->findItems(availableMasters.join(",")); const QList<QStandardItem*> masterList = mDataFilesModel->findItems(availableMasters.join(","));
if (masterList.isEmpty()) { // Masters node not yet in the mDataFilesModel if (masterList.isEmpty()) { // Masters node not yet in the mDataFilesModel
parent->appendRow(child); parent->appendRow(child);
mDataFilesModel->appendRow(parent); mDataFilesModel->appendRow(parent);
} else { } else {
// Masters node exists, append current plugin // Masters node exists, append current plugin
foreach (QStandardItem *currentItem, masterList) { foreach (QStandardItem *currentItem, masterList) {
currentItem->appendRow(child); currentItem->appendRow(child);
}
} }
} catch(std::runtime_error &e) {
// An error occurred while reading the .esp
continue;
} }
} }
@ -1050,16 +1057,8 @@ void DataFilesPage::writeConfig(QString profile)
return; return;
} }
// Prepare the OpenMW config // Open the OpenMW config as a QFile
QString config = QString::fromStdString((mCfgMgr.getLocalPath() / "openmw.cfg").string()); QFile file(QString::fromStdString((mCfgMgr.getUserPath() / "openmw.cfg").string()));
QFile file(config);
if (!file.exists()) {
config = QString::fromStdString((mCfgMgr.getUserPath() / "openmw.cfg").string());
}
// Open the config as a QFile
file.setFileName(config);
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) { if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
// File cannot be opened or created // File cannot be opened or created

@ -81,7 +81,7 @@ add_definitions(${SOUND_DEFINE})
target_link_libraries(openmw target_link_libraries(openmw
${OGRE_LIBRARIES} ${OGRE_LIBRARIES}
${OGRE_STATIC_PLUGINS} ${OGRE_STATIC_PLUGINS}
${OIS_LIBRARIES} ${OIS_LIBRARIES}
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${OPENAL_LIBRARY} ${OPENAL_LIBRARY}
@ -92,6 +92,11 @@ target_link_libraries(openmw
MyGUIOgrePlatform MyGUIOgrePlatform
) )
# Fix for not visible pthreads functions for linker with glibc 2.15
if (UNIX AND NOT APPLE)
target_link_libraries(openmw ${CMAKE_THREAD_LIBS_INIT})
endif()
if(APPLE) if(APPLE)
find_library(CARBON_FRAMEWORK Carbon) find_library(CARBON_FRAMEWORK Carbon)
target_link_libraries(openmw ${CARBON_FRAMEWORK}) target_link_libraries(openmw ${CARBON_FRAMEWORK})

@ -145,8 +145,6 @@ namespace MWDialogue
bool DialogueManager::functionFilter(const MWWorld::Ptr& actor, const ESM::DialInfo& info,bool choice) bool DialogueManager::functionFilter(const MWWorld::Ptr& actor, const ESM::DialInfo& info,bool choice)
{ {
bool isAChoice = false;//is there any choice in the filters?
bool isFunction = false;
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin()); for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin());
iter != info.selects.end(); ++iter) iter != info.selects.end(); ++iter)
{ {
@ -154,7 +152,6 @@ namespace MWDialogue
char type = select.selectRule[1]; char type = select.selectRule[1];
if(type == '1') if(type == '1')
{ {
isFunction = true;
char comp = select.selectRule[4]; char comp = select.selectRule[4];
std::string name = select.selectRule.substr (5); std::string name = select.selectRule.substr (5);
std::string function = select.selectRule.substr(2,2); std::string function = select.selectRule.substr(2,2);
@ -193,7 +190,7 @@ namespace MWDialogue
break; break;
case 50://choice case 50://choice
isAChoice = true;
if(choice) if(choice)
{ {
if(!selectCompare<int,int>(comp,mChoice,select.i)) return false; if(!selectCompare<int,int>(comp,mChoice,select.i)) return false;
@ -516,7 +513,6 @@ namespace MWDialogue
return false; return false;
// TODO check DATAstruct // TODO check DATAstruct
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin()); for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin());
iter != info.selects.end(); ++iter) iter != info.selects.end(); ++iter)
if (!isMatching (actor, *iter)) if (!isMatching (actor, *iter))
@ -680,7 +676,8 @@ namespace MWDialogue
void DialogueManager::updateTopics() void DialogueManager::updateTopics()
{ {
std::list<std::string> keywordList; std::list<std::string> keywordList;
int choice = mChoice;
mChoice = -1;
actorKnownTopics.clear(); actorKnownTopics.clear();
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list; ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
@ -692,7 +689,7 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
iter!=it->second.mInfo.end(); ++iter) iter!=it->second.mInfo.end(); ++iter)
{ {
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,false)) if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
{ {
actorKnownTopics.push_back(it->first); actorKnownTopics.push_back(it->first);
//does the player know the topic? //does the player know the topic?
@ -706,6 +703,7 @@ namespace MWDialogue
} }
} }
win->setKeywords(keywordList); win->setKeywords(keywordList);
mChoice = choice;
} }
void DialogueManager::keywordSelected(std::string keyword) void DialogueManager::keywordSelected(std::string keyword)
@ -715,10 +713,9 @@ namespace MWDialogue
if(mDialogueMap.find(keyword) != mDialogueMap.end()) if(mDialogueMap.find(keyword) != mDialogueMap.end())
{ {
ESM::Dialogue ndialogue = mDialogueMap[keyword]; ESM::Dialogue ndialogue = mDialogueMap[keyword];
std::vector<ESM::DialInfo>::const_iterator iter;
if(ndialogue.type == ESM::Dialogue::Topic) if(ndialogue.type == ESM::Dialogue::Topic)
{ {
for (iter = ndialogue.mInfo.begin(); for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter) iter!=ndialogue.mInfo.end(); ++iter)
{ {
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true)) if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
@ -742,6 +739,7 @@ namespace MWDialogue
} }
} }
} }
updateTopics(); updateTopics();
} }

@ -3,6 +3,9 @@
#include "../mwworld/environment.hpp" #include "../mwworld/environment.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/messagebox.hpp"
namespace MWDialogue namespace MWDialogue
{ {
Quest& Journal::getQuest (const std::string& id) Quest& Journal::getQuest (const std::string& id)
@ -34,6 +37,10 @@ namespace MWDialogue
Quest& quest = getQuest (id); Quest& quest = getQuest (id);
quest.addEntry (entry, *mEnvironment.mWorld); // we are doing slicing on purpose here quest.addEntry (entry, *mEnvironment.mWorld); // we are doing slicing on purpose here
std::vector<std::string> empty;
std::string notification = "Your Journal has been updated.";
mEnvironment.mWindowManager->messageBox (notification, empty);
} }
void Journal::setJournalIndex (const std::string& id, int index) void Journal::setJournalIndex (const std::string& id, int index)

@ -19,7 +19,7 @@ void MessageBoxManager::onFrame (float frameDuration)
if(it->current >= it->max) if(it->current >= it->max)
{ {
it->messageBox->mMarkedToDelete = true; it->messageBox->mMarkedToDelete = true;
if(*mMessageBoxes.begin() == it->messageBox) // if this box is the last one if(*mMessageBoxes.begin() == it->messageBox) // if this box is the last one
{ {
// collect all with mMarkedToDelete and delete them. // collect all with mMarkedToDelete and delete them.
@ -47,7 +47,7 @@ void MessageBoxManager::onFrame (float frameDuration)
it++; it++;
} }
} }
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) { if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
delete mInterMessageBoxe; delete mInterMessageBoxe;
mInterMessageBoxe = NULL; mInterMessageBoxe = NULL;
@ -57,20 +57,18 @@ void MessageBoxManager::onFrame (float frameDuration)
void MessageBoxManager::createMessageBox (const std::string& message) void MessageBoxManager::createMessageBox (const std::string& message)
{ {
std::cout << "MessageBox: " << message << std::endl;
MessageBox *box = new MessageBox(*this, message); MessageBox *box = new MessageBox(*this, message);
removeMessageBox(message.length()*mMessageBoxSpeed, box); removeMessageBox(message.length()*mMessageBoxSpeed, box);
mMessageBoxes.push_back(box); mMessageBoxes.push_back(box);
std::vector<MessageBox*>::iterator it; std::vector<MessageBox*>::iterator it;
if(mMessageBoxes.size() > 3) { if(mMessageBoxes.size() > 3) {
delete *mMessageBoxes.begin(); delete *mMessageBoxes.begin();
mMessageBoxes.erase(mMessageBoxes.begin()); mMessageBoxes.erase(mMessageBoxes.begin());
} }
int height = 0; int height = 0;
for(it = mMessageBoxes.begin(); it != mMessageBoxes.end(); ++it) for(it = mMessageBoxes.begin(); it != mMessageBoxes.end(); ++it)
{ {
@ -88,9 +86,9 @@ bool MessageBoxManager::createInteractiveMessageBox (const std::string& message,
std::cout << "interactive MessageBox: " << message << " - "; std::cout << "interactive MessageBox: " << message << " - ";
std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", ")); std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", "));
std::cout << std::endl; std::cout << std::endl;
mInterMessageBoxe = new InteractiveMessageBox(*this, message, buttons); mInterMessageBoxe = new InteractiveMessageBox(*this, message, buttons);
return true; return true;
} }
@ -105,7 +103,7 @@ void MessageBoxManager::removeMessageBox (float time, MessageBox *msgbox)
timer.current = 0; timer.current = 0;
timer.max = time; timer.max = time;
timer.messageBox = msgbox; timer.messageBox = msgbox;
mTimers.insert(mTimers.end(), timer); mTimers.insert(mTimers.end(), timer);
} }
@ -152,25 +150,25 @@ MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::strin
mBottomPadding = 20; mBottomPadding = 20;
mNextBoxPadding = 20; mNextBoxPadding = 20;
mMarkedToDelete = false; mMarkedToDelete = false;
getWidget(mMessageWidget, "message"); getWidget(mMessageWidget, "message");
mMessageWidget->setOverflowToTheLeft(true); mMessageWidget->setOverflowToTheLeft(true);
mMessageWidget->addText(cMessage); mMessageWidget->addText(cMessage);
MyGUI::IntSize size; MyGUI::IntSize size;
size.width = mFixedWidth; size.width = mFixedWidth;
size.height = 100; // dummy size.height = 100; // dummy
MyGUI::IntCoord coord; MyGUI::IntCoord coord;
coord.left = 10; // dummy coord.left = 10; // dummy
coord.top = 10; // dummy coord.top = 10; // dummy
mMessageWidget->setSize(size); mMessageWidget->setSize(size);
MyGUI::IntSize textSize = mMessageWidget->_getTextSize(); MyGUI::IntSize textSize = mMessageWidget->_getTextSize();
size.height = mHeight = textSize.height + 20; // this is the padding between the text and the box size.height = mHeight = textSize.height + 20; // this is the padding between the text and the box
mMainWidget->setSize(size); mMainWidget->setSize(size);
size.width -= 15; // this is to center the text (see messagebox_layout.xml, Widget type="Edit" position="-2 -3 0 0") size.width -= 15; // this is to center the text (see messagebox_layout.xml, Widget type="Edit" position="-2 -3 0 0")
mMessageWidget->setSize(size); mMessageWidget->setSize(size);
@ -182,11 +180,11 @@ void MessageBox::update (int height)
MyGUI::IntCoord coord; MyGUI::IntCoord coord;
coord.left = (gameWindowSize.width - mFixedWidth)/2; coord.left = (gameWindowSize.width - mFixedWidth)/2;
coord.top = (gameWindowSize.height - mHeight - height - mBottomPadding); coord.top = (gameWindowSize.height - mHeight - height - mBottomPadding);
MyGUI::IntSize size; MyGUI::IntSize size;
size.width = mFixedWidth; size.width = mFixedWidth;
size.height = mHeight; size.height = mHeight;
mMainWidget->setCoord(coord); mMainWidget->setCoord(coord);
mMainWidget->setSize(size); mMainWidget->setSize(size);
mMainWidget->setVisible(true); mMainWidget->setVisible(true);
@ -211,26 +209,26 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
int buttonTopPadding = 5; // ^-- if vertical int buttonTopPadding = 5; // ^-- if vertical
int buttonPadding = 5; // padding between button label and button itself int buttonPadding = 5; // padding between button label and button itself
int buttonMainPadding = 10; // padding between buttons and bottom of the main widget int buttonMainPadding = 10; // padding between buttons and bottom of the main widget
mMarkedToDelete = false; mMarkedToDelete = false;
getWidget(mMessageWidget, "message"); getWidget(mMessageWidget, "message");
getWidget(mButtonsWidget, "buttons"); getWidget(mButtonsWidget, "buttons");
mMessageWidget->setOverflowToTheLeft(true); mMessageWidget->setOverflowToTheLeft(true);
mMessageWidget->addText(message); mMessageWidget->addText(message);
MyGUI::IntSize textSize = mMessageWidget->_getTextSize(); MyGUI::IntSize textSize = mMessageWidget->_getTextSize();
MyGUI::IntSize gameWindowSize = mMessageBoxManager.mWindowManager->getGui()->getViewSize(); MyGUI::IntSize gameWindowSize = mMessageBoxManager.mWindowManager->getGui()->getViewSize();
int biggestButtonWidth = 0; int biggestButtonWidth = 0;
int buttonWidth = 0; int buttonWidth = 0;
int buttonsWidth = 0; int buttonsWidth = 0;
int buttonHeight = 0; int buttonHeight = 0;
MyGUI::IntCoord dummyCoord(0, 0, 0, 0); MyGUI::IntCoord dummyCoord(0, 0, 0, 0);
std::vector<std::string>::const_iterator it; std::vector<std::string>::const_iterator it;
for(it = buttons.begin(); it != buttons.end(); ++it) for(it = buttons.begin(); it != buttons.end(); ++it)
{ {
@ -240,28 +238,28 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
dummyCoord, dummyCoord,
MyGUI::Align::Default); MyGUI::Align::Default);
button->setCaption(*it); button->setCaption(*it);
button->eventMouseButtonClick = MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed); button->eventMouseButtonClick = MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed);
mButtons.push_back(button); mButtons.push_back(button);
buttonWidth = button->_getTextSize().width + 2*buttonPadding + buttonLeftPadding; buttonWidth = button->_getTextSize().width + 2*buttonPadding + buttonLeftPadding;
buttonsWidth += buttonWidth; buttonsWidth += buttonWidth;
buttonHeight = button->_getTextSize().height + 2*buttonPadding + buttonTopPadding; buttonHeight = button->_getTextSize().height + 2*buttonPadding + buttonTopPadding;
if(buttonWidth > biggestButtonWidth) if(buttonWidth > biggestButtonWidth)
{ {
biggestButtonWidth = buttonWidth; biggestButtonWidth = buttonWidth;
} }
} }
buttonsWidth += buttonLeftPadding; buttonsWidth += buttonLeftPadding;
MyGUI::IntSize mainWidgetSize; MyGUI::IntSize mainWidgetSize;
if(buttonsWidth < fixedWidth) if(buttonsWidth < fixedWidth)
{ {
// on one line // on one line
std::cout << "on one line" << std::endl; std::cout << "on one line" << std::endl;
if(textSize.width + 2*textPadding < buttonsWidth) if(textSize.width + 2*textPadding < buttonsWidth)
{ {
std::cout << "width = buttonsWidth" << std::endl; std::cout << "width = buttonsWidth" << std::endl;
@ -272,48 +270,48 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
mainWidgetSize.width = textSize.width + 3*textPadding; mainWidgetSize.width = textSize.width + 3*textPadding;
} }
mainWidgetSize.height = textSize.height + textButtonPadding + buttonHeight + buttonMainPadding; mainWidgetSize.height = textSize.height + textButtonPadding + buttonHeight + buttonMainPadding;
MyGUI::IntCoord absCoord; MyGUI::IntCoord absCoord;
absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2; absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2;
absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2; absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2;
std::cout << "width " << mainWidgetSize.width << " height " << mainWidgetSize.height << std::endl; std::cout << "width " << mainWidgetSize.width << " height " << mainWidgetSize.height << std::endl;
std::cout << "left " << absCoord.left << " top " << absCoord.top << std::endl; std::cout << "left " << absCoord.left << " top " << absCoord.top << std::endl;
mMainWidget->setCoord(absCoord); mMainWidget->setCoord(absCoord);
mMainWidget->setSize(mainWidgetSize); mMainWidget->setSize(mainWidgetSize);
MyGUI::IntCoord messageWidgetCoord; MyGUI::IntCoord messageWidgetCoord;
messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2; messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
messageWidgetCoord.top = textPadding; messageWidgetCoord.top = textPadding;
mMessageWidget->setCoord(messageWidgetCoord); mMessageWidget->setCoord(messageWidgetCoord);
mMessageWidget->setSize(textSize); mMessageWidget->setSize(textSize);
MyGUI::IntCoord buttonCord; MyGUI::IntCoord buttonCord;
MyGUI::IntSize buttonSize(0, buttonHeight); MyGUI::IntSize buttonSize(0, buttonHeight);
int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding; int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding;
std::vector<MyGUI::ButtonPtr>::const_iterator button; std::vector<MyGUI::ButtonPtr>::const_iterator button;
for(button = mButtons.begin(); button != mButtons.end(); ++button) for(button = mButtons.begin(); button != mButtons.end(); ++button)
{ {
buttonCord.left = left; buttonCord.left = left;
buttonCord.top = textSize.height + textButtonPadding; buttonCord.top = textSize.height + textButtonPadding;
buttonSize.width = (*button)->_getTextSize().width + 2*buttonPadding; buttonSize.width = (*button)->_getTextSize().width + 2*buttonPadding;
buttonSize.height = (*button)->_getTextSize().height + 2*buttonPadding; buttonSize.height = (*button)->_getTextSize().height + 2*buttonPadding;
(*button)->setCoord(buttonCord); (*button)->setCoord(buttonCord);
(*button)->setSize(buttonSize); (*button)->setSize(buttonSize);
left += buttonSize.width + buttonLeftPadding; left += buttonSize.width + buttonLeftPadding;
} }
} }
else else
{ {
// among each other // among each other
if(biggestButtonWidth > textSize.width) { if(biggestButtonWidth > textSize.width) {
mainWidgetSize.width = biggestButtonWidth + buttonTopPadding; mainWidgetSize.width = biggestButtonWidth + buttonTopPadding;
} }
@ -321,46 +319,46 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
mainWidgetSize.width = textSize.width + 3*textPadding; mainWidgetSize.width = textSize.width + 3*textPadding;
} }
mainWidgetSize.height = textSize.height + 2*textPadding + textButtonPadding + buttonHeight * buttons.size() + buttonMainPadding; mainWidgetSize.height = textSize.height + 2*textPadding + textButtonPadding + buttonHeight * buttons.size() + buttonMainPadding;
std::cout << "biggestButtonWidth " << biggestButtonWidth << " textSize.width " << textSize.width << std::endl; std::cout << "biggestButtonWidth " << biggestButtonWidth << " textSize.width " << textSize.width << std::endl;
std::cout << "width " << mainWidgetSize.width << " height " << mainWidgetSize.height << std::endl; std::cout << "width " << mainWidgetSize.width << " height " << mainWidgetSize.height << std::endl;
mMainWidget->setSize(mainWidgetSize); mMainWidget->setSize(mainWidgetSize);
MyGUI::IntCoord absCoord; MyGUI::IntCoord absCoord;
absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2; absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2;
absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2; absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2;
mMainWidget->setCoord(absCoord); mMainWidget->setCoord(absCoord);
mMainWidget->setSize(mainWidgetSize); mMainWidget->setSize(mainWidgetSize);
MyGUI::IntCoord messageWidgetCoord; MyGUI::IntCoord messageWidgetCoord;
messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2; messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
messageWidgetCoord.top = textPadding; messageWidgetCoord.top = textPadding;
mMessageWidget->setCoord(messageWidgetCoord); mMessageWidget->setCoord(messageWidgetCoord);
mMessageWidget->setSize(textSize); mMessageWidget->setSize(textSize);
MyGUI::IntCoord buttonCord; MyGUI::IntCoord buttonCord;
MyGUI::IntSize buttonSize(0, buttonHeight); MyGUI::IntSize buttonSize(0, buttonHeight);
int top = textButtonPadding + buttonTopPadding + textSize.height; int top = textButtonPadding + buttonTopPadding + textSize.height;
std::vector<MyGUI::ButtonPtr>::const_iterator button; std::vector<MyGUI::ButtonPtr>::const_iterator button;
for(button = mButtons.begin(); button != mButtons.end(); ++button) for(button = mButtons.begin(); button != mButtons.end(); ++button)
{ {
buttonSize.width = (*button)->_getTextSize().width + buttonPadding*2; buttonSize.width = (*button)->_getTextSize().width + buttonPadding*2;
buttonSize.height = (*button)->_getTextSize().height + buttonPadding*2; buttonSize.height = (*button)->_getTextSize().height + buttonPadding*2;
buttonCord.top = top; buttonCord.top = top;
buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2 - 5; // FIXME: -5 is not so nice :/ buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2 - 5; // FIXME: -5 is not so nice :/
(*button)->setCoord(buttonCord); (*button)->setCoord(buttonCord);
(*button)->setSize(buttonSize); (*button)->setSize(buttonSize);
top += buttonSize.height + 2*buttonTopPadding; top += buttonSize.height + 2*buttonTopPadding;
} }
} }
} }
@ -387,8 +385,3 @@ int InteractiveMessageBox::readPressedButton ()
mButtonPressed = -1; mButtonPressed = -1;
return pressed; return pressed;
} }

@ -271,7 +271,8 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering, Environmen
blight.mGlareView = 0; blight.mGlareView = 0;
blight.mAmbientLoopSoundID = "blight"; blight.mAmbientLoopSoundID = "blight";
mWeatherSettings["blight"] = blight; mWeatherSettings["blight"] = blight;
/*
Weather snow; Weather snow;
snow.mCloudTexture = "tx_bm_sky_snow.dds"; snow.mCloudTexture = "tx_bm_sky_snow.dds";
snow.mCloudsMaximumPercent = 1.0; snow.mCloudsMaximumPercent = 1.0;
@ -328,6 +329,7 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering, Environmen
blizzard.mGlareView = 0; blizzard.mGlareView = 0;
blizzard.mAmbientLoopSoundID = "BM Blizzard"; blizzard.mAmbientLoopSoundID = "BM Blizzard";
mWeatherSettings["blizzard"] = blizzard; mWeatherSettings["blizzard"] = blizzard;
*/
} }
void WeatherManager::setWeather(const String& weather, bool instant) void WeatherManager::setWeather(const String& weather, bool instant)
@ -509,32 +511,32 @@ void WeatherManager::update(float duration)
float thunder = region->data.thunder/255.f; float thunder = region->data.thunder/255.f;
float ash = region->data.ash/255.f; float ash = region->data.ash/255.f;
float blight = region->data.blight/255.f; float blight = region->data.blight/255.f;
float snow = region->data.a/255.f; //float snow = region->data.a/255.f;
float blizzard = region->data.b/255.f; //float blizzard = region->data.b/255.f;
// re-scale to 100 percent // re-scale to 100 percent
const float total = clear+cloudy+foggy+overcast+rain+thunder+ash+blight+snow+blizzard; const float total = clear+cloudy+foggy+overcast+rain+thunder+ash+blight;//+snow+blizzard;
srand(time(NULL)); srand(time(NULL));
float random = ((rand()%100)/100.f) * total; float random = ((rand()%100)/100.f) * total;
if (random >= snow+blight+ash+thunder+rain+overcast+foggy+cloudy+clear) //if (random > snow+blight+ash+thunder+rain+overcast+foggy+cloudy+clear)
weather = "blizzard"; // weather = "blizzard";
else if (random >= blight+ash+thunder+rain+overcast+foggy+cloudy+clear) //else if (random > blight+ash+thunder+rain+overcast+foggy+cloudy+clear)
weather = "snow"; // weather = "snow";
else if (random >= ash+thunder+rain+overcast+foggy+cloudy+clear) /*else*/ if (random > ash+thunder+rain+overcast+foggy+cloudy+clear)
weather = "blight"; weather = "blight";
else if (random >= thunder+rain+overcast+foggy+cloudy+clear) else if (random > thunder+rain+overcast+foggy+cloudy+clear)
weather = "ashstorm"; weather = "ashstorm";
else if (random >= rain+overcast+foggy+cloudy+clear) else if (random > rain+overcast+foggy+cloudy+clear)
weather = "thunderstorm"; weather = "thunderstorm";
else if (random >= overcast+foggy+cloudy+clear) else if (random > overcast+foggy+cloudy+clear)
weather = "rain"; weather = "rain";
else if (random >= foggy+cloudy+clear) else if (random > foggy+cloudy+clear)
weather = "overcast"; weather = "overcast";
else if (random >= cloudy+clear) else if (random > cloudy+clear)
weather = "foggy"; weather = "foggy";
else if (random >= clear) else if (random > clear)
weather = "cloudy"; weather = "cloudy";
else else
weather = "clear"; weather = "clear";

@ -93,6 +93,7 @@ CREDITS
Current Developers: Current Developers:
Alexander “Ace” Olofsson Alexander “Ace” Olofsson
athile athile
BrotherBrick
Cris “Mirceam” Mihalache Cris “Mirceam” Mihalache
gugus / gus gugus / gus
Jacob “Yacoby” Essex Jacob “Yacoby” Essex
@ -104,6 +105,7 @@ Marc “Zini” Zinnschlag
Michael “werdanith” Papageorgiou Michael “werdanith” Papageorgiou
Nikolay “corristo” Kasyanov Nikolay “corristo” Kasyanov
Pieter “pvdk” van der Kloet Pieter “pvdk” van der Kloet
Roman "Kromgart" Melnik
Sebastian “swick” Wick Sebastian “swick” Wick
Retired Developers: Retired Developers:
@ -134,12 +136,15 @@ Bug #179: Pressing space in console triggers activation
Bug #186: CMake doesn't use the debug versions of Ogre libraries on Linux Bug #186: CMake doesn't use the debug versions of Ogre libraries on Linux
Bug #189: ASCII 16 character added to console on it's activation on Mac OS X Bug #189: ASCII 16 character added to console on it's activation on Mac OS X
Bug #190: Case Folding fails with music files Bug #190: Case Folding fails with music files
Bug #192: Keypresses write Text into Console no matter which gui element is active
Bug #196: Collision shapes out of place Bug #196: Collision shapes out of place
Bug #202: ESMTool doesn't not work with localised ESM files anymore Bug #202: ESMTool doesn't not work with localised ESM files anymore
Bug #203: Torch lights only visible on short distance Bug #203: Torch lights only visible on short distance
Bug #207: Ogre.log not written Bug #207: Ogre.log not written
Bug #209: Sounds do not play Bug #209: Sounds do not play
Bug #210: Ogre crash at Dren plantation Bug #210: Ogre crash at Dren plantation
Bug #214: Unsupported file format version
Bug #222: Launcher is writing openmw.cfg file to wrong location
Feature #9: NPC Dialogue Window Feature #9: NPC Dialogue Window
Feature #16/42: New sky/weather implementation Feature #16/42: New sky/weather implementation
Feature #40: Fading Feature #40: Fading

Loading…
Cancel
Save