diff --git a/CMakeLists.txt b/CMakeLists.txt index 10abb8568..8e9073b7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) # source directory: apps -set(GAME apps/openmw/main.cpp apps/openmw/engine.cpp) -set(GAME_HEADER apps/openmw/mwinput/inputmanager.hpp apps/openmw/engine.hpp) +set(GAME + apps/openmw/main.cpp + apps/openmw/engine.cpp) +set(GAME_HEADER + apps/openmw/mwinput/inputmanager.hpp + apps/openmw/engine.hpp) source_group(game FILES ${GAME} ${GAME_HEADER}) set(GAMEREND @@ -26,7 +30,8 @@ set(GAMEREND_HEADER source_group(game_renderer FILES ${GAMEREND} ${GAMEREND_HEADER}) # set(GAMEINPUT) -set(GAMEINPUT_HEADER apps/openmw/mwinput/inputmanager.hpp) +set(GAMEINPUT_HEADER + apps/openmw/mwinput/inputmanager.hpp) source_group(game_input FILES ${GAMEINPUT} ${GAMEINPUT_HEADER}) set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT}) @@ -34,44 +39,73 @@ set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER}) # source directory: components -set(BSA components/bsa/bsa_archive.cpp components/bsa/bsa_file.cpp) -set(BSA_HEADER components/bsa/bsa_archive.hpp components/bsa/bsa_file.hpp) +set(BSA + components/bsa/bsa_archive.cpp + components/bsa/bsa_file.cpp) +set(BSA_HEADER + components/bsa/bsa_archive.hpp + components/bsa/bsa_file.hpp) source_group(bsa FILES ${BSA} ${BSA_HEADER}) -set(NIF components/nif/nif_file.cpp) -set(NIF_HEADER components/nif/controlled.hpp components/nif/effect.hpp - components/nif/nif_types.hpp components/nif/record.hpp - components/nif/controller.hpp components/nif/extra.hpp components/nif/node.hpp +set(NIF + components/nif/nif_file.cpp) +set(NIF_HEADER + components/nif/controlled.hpp + components/nif/effect.hpp + components/nif/nif_types.hpp + components/nif/record.hpp + components/nif/controller.hpp + components/nif/extra.hpp + components/nif/node.hpp components/nif/record_ptr.hpp - components/nif/data.hpp components/nif/nif_file.hpp components/nif/property.hpp) + components/nif/data.hpp + components/nif/nif_file.hpp + components/nif/property.hpp) source_group(nif FILES ${NIF} ${NIF_HEADER}) -set(NIFOGRE components/nifogre/ogre_nif_loader.cpp) -set(NIFOGRE_HEADER components/nifogre/ogre_nif_loader.hpp) +set(NIFOGRE + components/nifogre/ogre_nif_loader.cpp) +set(NIFOGRE_HEADER + components/nifogre/ogre_nif_loader.hpp) source_group(nifogre FILES ${NIFOGRE} ${NIFOGRE_HEADER}) -set(ESM_STORE components/esm_store/store.cpp components/esm_store/cell_store.cpp) -set(ESM_STORE_HEADER components/esm_store/cell_store.hpp - components/esm_store/reclists.hpp components/esm_store/store.hpp) +set(ESM_STORE + components/esm_store/store.cpp + components/esm_store/cell_store.cpp) +set(ESM_STORE_HEADER + components/esm_store/cell_store.hpp + components/esm_store/reclists.hpp + components/esm_store/store.hpp) source_group(esm_store FILES ${ESM_STORE} ${ESM_STORE_HEADER}) file(GLOB ESM_HEADER components/esm/*.hpp) source_group(esm_header FILES ${ESM_HEADER}) -set(OGRE components/engine/ogre/renderer.cpp) -set(OGRE_HEADER components/engine/ogre/renderer.hpp) +set(OGRE + components/engine/ogre/renderer.cpp) +set(OGRE_HEADER + components/engine/ogre/renderer.hpp) source_group(ogre FILES ${OGRE} ${OGRE_HEADER}) -set(INPUT components/engine/input/oismanager.cpp) -set(INPUT_HEADER components/engine/input/oismanager.hpp components/engine/input/listener.hpp - components/engine/input/func_binder.hpp components/engine/input/dispatch_map.hpp - components/engine/input/dispatcher.hpp components/engine/input/poller.hpp) +set(INPUT + components/engine/input/oismanager.cpp) +set(INPUT_HEADER + components/engine/input/oismanager.hpp + components/engine/input/listener.hpp + components/engine/input/func_binder.hpp + components/engine/input/dispatch_map.hpp + components/engine/input/dispatcher.hpp + components/engine/input/poller.hpp) source_group(input FILES ${INPUT} ${INPUT_HEADER}) -set(MISC components/misc/stringops.cpp components/misc/fileops.cpp) -set(MISC_HEADER components/misc/fileops.hpp components/misc/slice_array.hpp - components/misc/stringops.hpp) -source_group(misc FILES ${MISC} ${MISC_HEADER}) +set(MISC + components/misc/stringops.cpp + components/misc/fileops.cpp) +set(MISC_HEADER + components/misc/fileops.hpp + components/misc/slice_array.hpp + components/misc/stringops.hpp) +source_group(misc FILES ${MISC} ${MISC_HEADER}) set(COMPONENTS ${BSA} ${NIF} ${NIFOGRE} ${ESM_STORE} ${OGRE} ${INPUT} ${MISC}) set(COMPONENTS_HEADER ${BSA_HEADER} ${NIF_HEADER} ${NIFOGRE_HEADER} ${ESM_STORE_HEADER} @@ -100,7 +134,7 @@ find_package(OIS REQUIRED) include_directories("." ${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${PLATFORM_INCLUDE_DIR} - ${CMAKE_HOME_DIRECTORY}/extern/caelum/include ) + ${CMAKE_HOME_DIRECTORY}/extern/caelum/include) link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR}) ADD_SUBDIRECTORY( extern/caelum ) diff --git a/Docs/Doxyfile b/Docs/Doxyfile index f1f5fda07..5adeea871 100644 --- a/Docs/Doxyfile +++ b/Docs/Doxyfile @@ -573,7 +573,10 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = .. +INPUT = ..\apps + ..\components + ..\libs + ..\docs # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 143f62792..f431e51bd 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -20,18 +20,6 @@ OMW::Engine::Engine() { } -// adjust name and load bsa - -void OMW::Engine::prepareMaster() -{ - std::string::size_type sep = mMaster.find_last_of ("."); - - if (sep==std::string::npos) - { - mMaster += ".esm"; - } -} - // Load all BSA files in data directory. void OMW::Engine::loadBSA() @@ -79,6 +67,13 @@ void OMW::Engine::addMaster (const std::string& master) { assert (mMaster.empty()); mMaster = master; + + // Append .esm if not already there + std::string::size_type sep = mMaster.find_last_of ("."); + if (sep == std::string::npos) + { + mMaster += ".esm"; + } } // Enables sky rendering @@ -109,7 +104,6 @@ void OMW::Engine::go() addResourcesDirectory (mDataDir / "Meshes"); addResourcesDirectory (mDataDir / "Textures"); - prepareMaster(); loadBSA(); boost::filesystem::path masterPath (mDataDir); diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index 8143c3ab8..ae69f52b4 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -30,9 +30,6 @@ namespace OMW Engine (const Engine&); Engine& operator= (const Engine&); - /// adjust name and load bsa - void prepareMaster(); - /// add resources directory /// \note This function works recursively. void addResourcesDirectory (const boost::filesystem::path& path); diff --git a/components/esm/esm_reader.hpp b/components/esm/esm_reader.hpp index c03f1d162..7db21323f 100644 --- a/components/esm/esm_reader.hpp +++ b/components/esm/esm_reader.hpp @@ -12,7 +12,7 @@ #include #include #include -#include "components/misc/stringops.hpp" +#include #ifdef __APPLE__ // need our own implementation of strnlen @@ -217,7 +217,7 @@ public: /// Raw opening. Opens the file and sets everything up but doesn't /// parse the header. void openRaw(Mangle::Stream::StreamPtr _esm, const std::string &name) - { + { close(); esm = _esm; c.filename = name; diff --git a/components/nif/controlled.hpp b/components/nif/controlled.hpp index 8396a0a7b..67f2dec36 100644 --- a/components/nif/controlled.hpp +++ b/components/nif/controlled.hpp @@ -30,8 +30,9 @@ namespace Nif { /// Anything that has a controller -struct Controlled : Extra +class Controlled : public Extra { +public: ControllerPtr controller; void read(NIFFile *nif) @@ -42,8 +43,9 @@ struct Controlled : Extra }; /// Has name, extra-data and controller -struct Named : Controlled +class Named : public Controlled { +public: SString name; void read(NIFFile *nif) @@ -54,8 +56,9 @@ struct Named : Controlled }; typedef Named NiSequenceStreamHelper; -struct NiParticleGrowFade : Controlled +class NiParticleGrowFade : public Controlled { +public: void read(NIFFile *nif) { Controlled::read(nif); @@ -65,8 +68,9 @@ struct NiParticleGrowFade : Controlled } }; -struct NiParticleColorModifier : Controlled +class NiParticleColorModifier : public Controlled { +public: NiColorDataPtr data; void read(NIFFile *nif) @@ -76,8 +80,9 @@ struct NiParticleColorModifier : Controlled } }; -struct NiGravity : Controlled +class NiGravity : public Controlled { +public: void read(NIFFile *nif) { Controlled::read(nif); @@ -88,8 +93,9 @@ struct NiGravity : Controlled }; // NiPinaColada -struct NiPlanarCollider : Controlled +class NiPlanarCollider : public Controlled { +public: void read(NIFFile *nif) { Controlled::read(nif); @@ -99,8 +105,9 @@ struct NiPlanarCollider : Controlled } }; -struct NiParticleRotation : Controlled +class NiParticleRotation : public Controlled { +public: void read(NIFFile *nif) { Controlled::read(nif); diff --git a/components/nif/controller.hpp b/components/nif/controller.hpp index 49a38cfaa..d6fb22255 100644 --- a/components/nif/controller.hpp +++ b/components/nif/controller.hpp @@ -31,8 +31,9 @@ namespace Nif { -struct Controller : Record +class Controller : public Record { +public: ControllerPtr next; int flags; float frequency, phase; @@ -54,8 +55,9 @@ struct Controller : Record } }; -struct NiBSPArrayController : Controller +class NiBSPArrayController : public Controller { +public: void read(NIFFile *nif) { Controller::read(nif); @@ -68,8 +70,9 @@ struct NiBSPArrayController : Controller }; typedef NiBSPArrayController NiParticleSystemController; -struct NiMaterialColorController : Controller +class NiMaterialColorController : public Controller { +public: NiPosDataPtr data; void read(NIFFile *nif) @@ -79,8 +82,9 @@ struct NiMaterialColorController : Controller } }; -struct NiPathController : Controller +class NiPathController : public Controller { +public: NiPosDataPtr posData; NiFloatDataPtr floatData; @@ -99,8 +103,9 @@ struct NiPathController : Controller } }; -struct NiUVController : Controller +class NiUVController : public Controller { +public: NiUVDataPtr data; void read(NIFFile *nif) @@ -112,8 +117,9 @@ struct NiUVController : Controller } }; -struct NiKeyframeController : Controller +class NiKeyframeController : public Controller { +public: NiKeyframeDataPtr data; void read(NIFFile *nif) @@ -123,8 +129,9 @@ struct NiKeyframeController : Controller } }; -struct NiAlphaController : Controller +class NiAlphaController : public Controller { +public: NiFloatDataPtr data; void read(NIFFile *nif) @@ -134,8 +141,9 @@ struct NiAlphaController : Controller } }; -struct NiGeomMorpherController : Controller +class NiGeomMorpherController : public Controller { +public: NiMorphDataPtr data; void read(NIFFile *nif) @@ -146,8 +154,9 @@ struct NiGeomMorpherController : Controller } }; -struct NiVisController : Controller +class NiVisController : public Controller { +public: NiVisDataPtr data; void read(NIFFile *nif) diff --git a/components/nif/data.hpp b/components/nif/data.hpp index 920c7cf45..18e78b7ab 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -29,8 +29,10 @@ namespace Nif { -struct NiSourceTexture : Named +class NiSourceTexture : public Named { +public: + // Is this an external (references a separate texture file) or // internal (data is inside the nif itself) texture? bool external; @@ -65,7 +67,7 @@ struct NiSourceTexture : Named { Named::read(nif); - external = nif->getByte(); + external = !!nif->getByte(); if(external) filename = nif->getString(); else @@ -83,8 +85,9 @@ struct NiSourceTexture : Named }; // Common ancestor for several data classes -struct ShapeData : Record +class ShapeData : public Record { +public: FloatArray vertices, normals, colors, uvlist; const Vector *center; float radius; @@ -116,8 +119,9 @@ struct ShapeData : Record } }; -struct NiTriShapeData : ShapeData +class NiTriShapeData : public ShapeData { +public: // Triangles, three vertex indices per triangle SliceArray triangles; @@ -150,8 +154,9 @@ struct NiTriShapeData : ShapeData } }; -struct NiAutoNormalParticlesData : ShapeData +class NiAutoNormalParticlesData : public ShapeData { +public: int activeCount; void read(NIFFile *nif) @@ -171,8 +176,9 @@ struct NiAutoNormalParticlesData : ShapeData } }; -struct NiRotatingParticlesData : NiAutoNormalParticlesData +class NiRotatingParticlesData : public NiAutoNormalParticlesData { +public: void read(NIFFile *nif) { NiAutoNormalParticlesData::read(nif); @@ -185,8 +191,9 @@ struct NiRotatingParticlesData : NiAutoNormalParticlesData } }; -struct NiPosData : Record +class NiPosData : public Record { +public: void read(NIFFile *nif) { int count = nif->getInt(); @@ -210,8 +217,9 @@ struct NiPosData : Record } }; -struct NiUVData : Record +class NiUVData : public Record { +public: void read(NIFFile *nif) { // TODO: This is claimed to be a "float animation key", which is @@ -235,8 +243,9 @@ struct NiUVData : Record } }; -struct NiFloatData : Record +class NiFloatData : public Record { +public: void read(NIFFile *nif) { int count = nif->getInt(); @@ -245,8 +254,9 @@ struct NiFloatData : Record } }; -struct NiPixelData : Record +class NiPixelData : public Record { +public: unsigned int rmask, gmask, bmask, amask; int bpp, mips; @@ -283,8 +293,9 @@ struct NiPixelData : Record } }; -struct NiColorData : Record +class NiColorData : public Record { +public: struct ColorData { float time; @@ -302,8 +313,9 @@ struct NiColorData : Record } }; -struct NiVisData : Record +class NiVisData : public Record { +public: void read(NIFFile *nif) { int count = nif->getInt(); @@ -319,8 +331,9 @@ struct NiVisData : Record } }; -struct NiSkinInstance : Record +class NiSkinInstance : public Record { +public: NiSkinDataPtr data; NodePtr root; NodeList bones; @@ -338,8 +351,9 @@ struct NiSkinInstance : Record void post(NIFFile *nif); }; -struct NiSkinData : Record +class NiSkinData : public Record { +public: // This is to make sure the structs are packed, ie. that the // compiler doesn't mess them up with extra alignment bytes. #pragma pack(push) @@ -395,8 +409,9 @@ struct NiSkinData : Record } }; -struct NiMorphData : Record +class NiMorphData : public Record { +public: void read(NIFFile *nif) { int morphCount = nif->getInt(); @@ -416,8 +431,9 @@ struct NiMorphData : Record } }; -struct NiKeyframeData : Record +class NiKeyframeData : public Record { +public: void read(NIFFile *nif) { // Rotations first diff --git a/components/nif/extra.hpp b/components/nif/extra.hpp index 788fe3113..25375c325 100644 --- a/components/nif/extra.hpp +++ b/components/nif/extra.hpp @@ -35,15 +35,17 @@ namespace Nif themselves decend from the Extra class, and all the extra data connected to an object form a linked list */ -struct Extra : Record +class Extra : public Record { +public: ExtraPtr extra; void read(NIFFile *nif) { extra.read(nif); } }; -struct NiVertWeightsExtraData : Extra +class NiVertWeightsExtraData : public Extra { +public: void read(NIFFile *nif) { Extra::read(nif); @@ -57,8 +59,9 @@ struct NiVertWeightsExtraData : Extra } }; -struct NiTextKeyExtraData : Extra +class NiTextKeyExtraData : public Extra { +public: struct TextKey { float time; @@ -83,8 +86,9 @@ struct NiTextKeyExtraData : Extra } }; -struct NiStringExtraData : Extra +class NiStringExtraData : public Extra { +public: /* Two known meanings: "MRK" - marker, only visible in the editor, not rendered in-game "NCO" - no collision diff --git a/components/nif/nif_file.hpp b/components/nif/nif_file.hpp index f6ee80a9e..72fb7c4b6 100644 --- a/components/nif/nif_file.hpp +++ b/components/nif/nif_file.hpp @@ -27,8 +27,7 @@ #include #include #include - -#include "../misc/slice_array.hpp" +#include #include #include diff --git a/components/nif/node.hpp b/components/nif/node.hpp index 9e6b48885..f0ad54655 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -34,8 +34,9 @@ namespace Nif parent node (unless it's the root), and transformation (location and rotation) relative to it's parent. */ -struct Node : Named +class Node : public Named { +public: // Node flags. Interpretation depends somewhat on the type of node. int flags; const Transformation *trafo; @@ -55,7 +56,7 @@ struct Node : Named trafo = nif->getTrafo(); props.read(nif); - hasBounds = nif->getInt(); + hasBounds = !!nif->getInt(); if(hasBounds) { nif->getInt(); // always 1 diff --git a/components/nif/property.hpp b/components/nif/property.hpp index 3500a25b7..1a16854af 100644 --- a/components/nif/property.hpp +++ b/components/nif/property.hpp @@ -29,8 +29,9 @@ namespace Nif { -struct Property : Named +class Property : public Named { +public: // The meaning of these depends on the actual property type. int flags; @@ -41,8 +42,9 @@ struct Property : Named } }; -struct NiTexturingProperty : Property +class NiTexturingProperty : public Property { +public: // A sub-texture struct Texture { @@ -67,7 +69,7 @@ struct NiTexturingProperty : Property void read(NIFFile *nif) { - inUse = nif->getInt(); + inUse = !!nif->getInt(); if(!inUse) return; texture.read(nif);