1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Pieter van der Kloet 2011-10-04 00:40:41 +02:00
commit 9e34f30500
8 changed files with 93 additions and 11 deletions

View File

@ -471,6 +471,10 @@ if(DPKG_PROGRAM)
set(PACKAGE_MAINTAINER "unknown") set(PACKAGE_MAINTAINER "unknown")
endif() endif()
#Install icon and desktop file
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/openmw.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
INSTALL(FILES "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.png" DESTINATION "share/pixmaps/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
#Install global configuration files #Install global configuration files
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "../etc/openmw/" RENAME "openmw.cfg" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "../etc/openmw/" RENAME "openmw.cfg" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
INSTALL(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
@ -489,8 +493,8 @@ if(DPKG_PROGRAM)
Data files from the original game is required to run it.") Data files from the original game is required to run it.")
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") SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW esmtool;Esmtool omwlauncher;OMWLauncher")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libogremain-1.7.1 (>= 1.7.1-1), libbullet2.77 (>= 2.77), libboost-filesystem1.42.0 (>= 1.42.0), libboost-program-options1.42.0 (>= 1.42.0), libboost-system1.42.0 (>= 1.42.0), libboost-thread1.42.0 (>= 1.42.0), libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libois-1.2.0 (>= 1.2.0), libopenal1 (>= 1:1.12.854), libsndfile1 (>= 1.0.23), libstdc++6 (>= 4.4.5), libuuid1 (>= 2.17.2)") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libogremain-1.7.3 (>= 1.7.3), libbullet0 (>= 2.77), libboost-filesystem1.42.0 (>= 1.42.0), libboost-program-options1.42.0 (>= 1.42.0), libboost-system1.42.0 (>= 1.42.0), libboost-thread1.42.0 (>= 1.42.0), libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libois-1.2.0 (>= 1.2.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")
@ -514,7 +518,10 @@ if (BUILD_ESMTOOL)
add_subdirectory( apps/esmtool ) add_subdirectory( apps/esmtool )
endif() endif()
add_subdirectory( apps/launcher ) option(BUILD_LAUNCHER "build Launcher inspector" ON)
if (BUILD_LAUNCHER)
add_subdirectory( apps/launcher )
endif()
if (WIN32) if (WIN32)
if (MSVC) if (MSVC)

View File

@ -68,6 +68,10 @@ target_link_libraries(omwlauncher
${PNG_LIBRARY} ${PNG_LIBRARY}
) )
if(DPKG_PROGRAM)
INSTALL(TARGETS omwlauncher RUNTIME DESTINATION games COMPONENT omwlauncher)
endif()
if (APPLE) if (APPLE)
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss
"${APP_BUNDLE_DIR}/../launcher.qss") "${APP_BUNDLE_DIR}/../launcher.qss")

View File

@ -4,6 +4,8 @@
#include <algorithm> #include <algorithm>
#include "world.hpp"
MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell) MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
{ {
if (cell->data.flags & ESM::Cell::Interior) if (cell->data.flags & ESM::Cell::Interior)
@ -33,8 +35,8 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
} }
} }
MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader) MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader, MWWorld::World& world)
: mStore (store), mReader (reader) {} : mStore (store), mReader (reader), mWorld (world) {}
MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y) MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
{ {
@ -43,7 +45,21 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
if (result==mExteriors.end()) if (result==mExteriors.end())
{ {
const ESM::Cell *cell = mStore.cells.findExt (x, y); const ESM::Cell *cell = mStore.cells.searchExt (x, y);
if (!cell)
{
// Cell isn't predefined. Make one on the fly.
ESM::Cell record;
record.data.flags = 0;
record.data.gridX = x;
record.data.gridY = y;
record.water = 0;
record.mapColor = 0;
cell = mWorld.createRecord (record);
}
result = mExteriors.insert (std::make_pair ( result = mExteriors.insert (std::make_pair (
std::make_pair (x, y), Ptr::CellStore (cell))).first; std::make_pair (x, y), Ptr::CellStore (cell))).first;

View File

@ -18,6 +18,8 @@ namespace ESM
namespace MWWorld namespace MWWorld
{ {
class World;
/// \brief Cell container /// \brief Cell container
class Cells class Cells
{ {
@ -25,6 +27,7 @@ namespace MWWorld
ESM::ESMReader& mReader; ESM::ESMReader& mReader;
std::map<std::string, Ptr::CellStore> mInteriors; std::map<std::string, Ptr::CellStore> mInteriors;
std::map<std::pair<int, int>, Ptr::CellStore> mExteriors; std::map<std::pair<int, int>, Ptr::CellStore> mExteriors;
MWWorld::World& mWorld;
Cells (const Cells&); Cells (const Cells&);
Cells& operator= (const Cells&); Cells& operator= (const Cells&);
@ -33,7 +36,9 @@ namespace MWWorld
public: public:
Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader); Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader, MWWorld::World& world);
///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole
/// world
Ptr::CellStore *getExterior (int x, int y); Ptr::CellStore *getExterior (int x, int y);

View File

@ -214,7 +214,7 @@ namespace MWWorld
const std::string& master, const boost::filesystem::path& resDir, const std::string& master, const boost::filesystem::path& resDir,
bool newGame, Environment& environment, const std::string& encoding) bool newGame, Environment& environment, const std::string& encoding)
: mScene (renderer,physEng), mPlayer (0), mGlobalVariables (0), : mScene (renderer,physEng), mPlayer (0), mGlobalVariables (0),
mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm) mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this)
{ {
mPhysEngine = physEng; mPhysEngine = physEng;
@ -574,6 +574,14 @@ namespace MWWorld
mEnvironment.mSoundManager->stopSound3D (ptr); mEnvironment.mSoundManager->stopSound3D (ptr);
mPhysics->removeObject (ptr.getRefData().getHandle()); mPhysics->removeObject (ptr.getRefData().getHandle());
for (ScriptList::iterator iter = mLocalScripts.begin(); iter!=mLocalScripts.end();
++iter)
if (ptr==iter->second)
{
mLocalScripts.erase (iter);
break;
}
} }
render->deleteObject (ptr.getRefData().getHandle()); render->deleteObject (ptr.getRefData().getHandle());
@ -722,4 +730,27 @@ namespace MWWorld
return std::make_pair (stream.str(), created); return std::make_pair (stream.str(), created);
} }
const ESM::Cell *World::createRecord (const ESM::Cell& record)
{
if (record.data.flags & ESM::Cell::Interior)
{
if (mStore.cells.searchInt (record.name))
throw std::runtime_error ("failed creating interior cell");
ESM::Cell *cell = new ESM::Cell (record);
mStore.cells.intCells.insert (std::make_pair (record.name, cell));
return cell;
}
else
{
if (mStore.cells.searchExt (record.data.gridX, record.data.gridY))
throw std::runtime_error ("failed creating exterior cell");
ESM::Cell *cell = new ESM::Cell (record);
mStore.cells.extCells.insert (
std::make_pair (std::make_pair (record.data.gridX, record.data.gridY), cell));
return cell;
}
}
} }

View File

@ -207,6 +207,10 @@ namespace MWWorld
std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record); std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record);
///< Create a new recrod (of type class) in the ESM store. ///< Create a new recrod (of type class) in the ESM store.
/// \return ID, pointer to created record /// \return ID, pointer to created record
const ESM::Cell *createRecord (const ESM::Cell& record);
///< Create a new recrod (of type cell) in the ESM store.
/// \return ID, pointer to created record
}; };
} }

View File

@ -189,6 +189,9 @@ namespace ESMS
{ {
assert (cell); assert (cell);
if (cell->context.filename.empty())
return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position. // Reopen the ESM reader and seek to the right position.
cell->restore (esm); cell->restore (esm);
@ -212,6 +215,9 @@ namespace ESMS
{ {
assert (cell); assert (cell);
if (cell->context.filename.empty())
return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position. // Reopen the ESM reader and seek to the right position.
cell->restore(esm); cell->restore(esm);

View File

@ -305,15 +305,24 @@ namespace ESMS
delete it->second; delete it->second;
} }
const ESM::Cell* searchInt(const std::string &id) const
{
IntCells::const_iterator iter = intCells.find(id);
if (iter!=intCells.end())
return iter->second;
return 0;
}
const ESM::Cell* findInt(const std::string &id) const const ESM::Cell* findInt(const std::string &id) const
{ {
IntCells::const_iterator it = intCells.find(id); const ESM::Cell *cell = searchInt (id);
if(it == intCells.end()) if (!cell)
throw std::runtime_error ("Interior cell not found - " + id); throw std::runtime_error ("Interior cell not found - " + id);
return it->second; return cell;
} }
const ESM::Cell *searchExt (int x, int y) const const ESM::Cell *searchExt (int x, int y) const