1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 03:15:32 +00:00
This commit is contained in:
Nicolay Korslund 2010-07-01 10:38:45 +02:00
commit 4a71a4c50c
12 changed files with 154 additions and 88 deletions

View file

@ -8,8 +8,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
# source directory: apps # source directory: apps
set(GAME apps/openmw/main.cpp apps/openmw/engine.cpp) set(GAME
set(GAME_HEADER apps/openmw/mwinput/inputmanager.hpp apps/openmw/engine.hpp) 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}) source_group(game FILES ${GAME} ${GAME_HEADER})
set(GAMEREND set(GAMEREND
@ -26,7 +30,8 @@ set(GAMEREND_HEADER
source_group(game_renderer FILES ${GAMEREND} ${GAMEREND_HEADER}) source_group(game_renderer FILES ${GAMEREND} ${GAMEREND_HEADER})
# set(GAMEINPUT) # 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}) source_group(game_input FILES ${GAMEINPUT} ${GAMEINPUT_HEADER})
set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT}) set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT})
@ -34,42 +39,71 @@ set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER})
# source directory: components # source directory: components
set(BSA components/bsa/bsa_archive.cpp components/bsa/bsa_file.cpp) set(BSA
set(BSA_HEADER components/bsa/bsa_archive.hpp components/bsa/bsa_file.hpp) 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}) source_group(bsa FILES ${BSA} ${BSA_HEADER})
set(NIF components/nif/nif_file.cpp) set(NIF
set(NIF_HEADER components/nif/controlled.hpp components/nif/effect.hpp components/nif/nif_file.cpp)
components/nif/nif_types.hpp components/nif/record.hpp set(NIF_HEADER
components/nif/controller.hpp components/nif/extra.hpp components/nif/node.hpp 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/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}) source_group(nif FILES ${NIF} ${NIF_HEADER})
set(NIFOGRE components/nifogre/ogre_nif_loader.cpp) set(NIFOGRE
set(NIFOGRE_HEADER components/nifogre/ogre_nif_loader.hpp) components/nifogre/ogre_nif_loader.cpp)
set(NIFOGRE_HEADER
components/nifogre/ogre_nif_loader.hpp)
source_group(nifogre FILES ${NIFOGRE} ${NIFOGRE_HEADER}) source_group(nifogre FILES ${NIFOGRE} ${NIFOGRE_HEADER})
set(ESM_STORE components/esm_store/store.cpp components/esm_store/cell_store.cpp) set(ESM_STORE
set(ESM_STORE_HEADER components/esm_store/cell_store.hpp components/esm_store/store.cpp
components/esm_store/reclists.hpp components/esm_store/store.hpp) 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}) source_group(esm_store FILES ${ESM_STORE} ${ESM_STORE_HEADER})
file(GLOB ESM_HEADER components/esm/*.hpp) file(GLOB ESM_HEADER components/esm/*.hpp)
source_group(esm_header FILES ${ESM_HEADER}) source_group(esm_header FILES ${ESM_HEADER})
set(OGRE components/engine/ogre/renderer.cpp) set(OGRE
set(OGRE_HEADER components/engine/ogre/renderer.hpp) components/engine/ogre/renderer.cpp)
set(OGRE_HEADER
components/engine/ogre/renderer.hpp)
source_group(ogre FILES ${OGRE} ${OGRE_HEADER}) source_group(ogre FILES ${OGRE} ${OGRE_HEADER})
set(INPUT components/engine/input/oismanager.cpp) set(INPUT
set(INPUT_HEADER components/engine/input/oismanager.hpp components/engine/input/listener.hpp components/engine/input/oismanager.cpp)
components/engine/input/func_binder.hpp components/engine/input/dispatch_map.hpp set(INPUT_HEADER
components/engine/input/dispatcher.hpp components/engine/input/poller.hpp) 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}) source_group(input FILES ${INPUT} ${INPUT_HEADER})
set(MISC components/misc/stringops.cpp components/misc/fileops.cpp) set(MISC
set(MISC_HEADER components/misc/fileops.hpp components/misc/slice_array.hpp components/misc/stringops.cpp
components/misc/fileops.cpp)
set(MISC_HEADER
components/misc/fileops.hpp
components/misc/slice_array.hpp
components/misc/stringops.hpp) components/misc/stringops.hpp)
source_group(misc FILES ${MISC} ${MISC_HEADER}) source_group(misc FILES ${MISC} ${MISC_HEADER})
@ -100,7 +134,7 @@ find_package(OIS REQUIRED)
include_directories("." include_directories("."
${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
${PLATFORM_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}) link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR})
ADD_SUBDIRECTORY( extern/caelum ) ADD_SUBDIRECTORY( extern/caelum )

View file

@ -573,7 +573,10 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = .. INPUT = ..\apps
..\components
..\libs
..\docs
# This tag can be used to specify the character encoding of the source files # 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 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

View file

@ -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. // Load all BSA files in data directory.
void OMW::Engine::loadBSA() void OMW::Engine::loadBSA()
@ -79,6 +67,13 @@ void OMW::Engine::addMaster (const std::string& master)
{ {
assert (mMaster.empty()); assert (mMaster.empty());
mMaster = master; 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 // Enables sky rendering
@ -109,7 +104,6 @@ void OMW::Engine::go()
addResourcesDirectory (mDataDir / "Meshes"); addResourcesDirectory (mDataDir / "Meshes");
addResourcesDirectory (mDataDir / "Textures"); addResourcesDirectory (mDataDir / "Textures");
prepareMaster();
loadBSA(); loadBSA();
boost::filesystem::path masterPath (mDataDir); boost::filesystem::path masterPath (mDataDir);

View file

@ -30,9 +30,6 @@ namespace OMW
Engine (const Engine&); Engine (const Engine&);
Engine& operator= (const Engine&); Engine& operator= (const Engine&);
/// adjust name and load bsa
void prepareMaster();
/// add resources directory /// add resources directory
/// \note This function works recursively. /// \note This function works recursively.
void addResourcesDirectory (const boost::filesystem::path& path); void addResourcesDirectory (const boost::filesystem::path& path);

View file

@ -12,7 +12,7 @@
#include <libs/mangle/stream/stream.hpp> #include <libs/mangle/stream/stream.hpp>
#include <libs/mangle/stream/servers/file_stream.hpp> #include <libs/mangle/stream/servers/file_stream.hpp>
#include <libs/mangle/tools/str_exception.hpp> #include <libs/mangle/tools/str_exception.hpp>
#include "components/misc/stringops.hpp" #include <components/misc/stringops.hpp>
#ifdef __APPLE__ #ifdef __APPLE__
// need our own implementation of strnlen // need our own implementation of strnlen

View file

@ -30,8 +30,9 @@ namespace Nif
{ {
/// Anything that has a controller /// Anything that has a controller
struct Controlled : Extra class Controlled : public Extra
{ {
public:
ControllerPtr controller; ControllerPtr controller;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -42,8 +43,9 @@ struct Controlled : Extra
}; };
/// Has name, extra-data and controller /// Has name, extra-data and controller
struct Named : Controlled class Named : public Controlled
{ {
public:
SString name; SString name;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -54,8 +56,9 @@ struct Named : Controlled
}; };
typedef Named NiSequenceStreamHelper; typedef Named NiSequenceStreamHelper;
struct NiParticleGrowFade : Controlled class NiParticleGrowFade : public Controlled
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
Controlled::read(nif); Controlled::read(nif);
@ -65,8 +68,9 @@ struct NiParticleGrowFade : Controlled
} }
}; };
struct NiParticleColorModifier : Controlled class NiParticleColorModifier : public Controlled
{ {
public:
NiColorDataPtr data; NiColorDataPtr data;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -76,8 +80,9 @@ struct NiParticleColorModifier : Controlled
} }
}; };
struct NiGravity : Controlled class NiGravity : public Controlled
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
Controlled::read(nif); Controlled::read(nif);
@ -88,8 +93,9 @@ struct NiGravity : Controlled
}; };
// NiPinaColada // NiPinaColada
struct NiPlanarCollider : Controlled class NiPlanarCollider : public Controlled
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
Controlled::read(nif); Controlled::read(nif);
@ -99,8 +105,9 @@ struct NiPlanarCollider : Controlled
} }
}; };
struct NiParticleRotation : Controlled class NiParticleRotation : public Controlled
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
Controlled::read(nif); Controlled::read(nif);

View file

@ -31,8 +31,9 @@
namespace Nif namespace Nif
{ {
struct Controller : Record class Controller : public Record
{ {
public:
ControllerPtr next; ControllerPtr next;
int flags; int flags;
float frequency, phase; float frequency, phase;
@ -54,8 +55,9 @@ struct Controller : Record
} }
}; };
struct NiBSPArrayController : Controller class NiBSPArrayController : public Controller
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
Controller::read(nif); Controller::read(nif);
@ -68,8 +70,9 @@ struct NiBSPArrayController : Controller
}; };
typedef NiBSPArrayController NiParticleSystemController; typedef NiBSPArrayController NiParticleSystemController;
struct NiMaterialColorController : Controller class NiMaterialColorController : public Controller
{ {
public:
NiPosDataPtr data; NiPosDataPtr data;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -79,8 +82,9 @@ struct NiMaterialColorController : Controller
} }
}; };
struct NiPathController : Controller class NiPathController : public Controller
{ {
public:
NiPosDataPtr posData; NiPosDataPtr posData;
NiFloatDataPtr floatData; NiFloatDataPtr floatData;
@ -99,8 +103,9 @@ struct NiPathController : Controller
} }
}; };
struct NiUVController : Controller class NiUVController : public Controller
{ {
public:
NiUVDataPtr data; NiUVDataPtr data;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -112,8 +117,9 @@ struct NiUVController : Controller
} }
}; };
struct NiKeyframeController : Controller class NiKeyframeController : public Controller
{ {
public:
NiKeyframeDataPtr data; NiKeyframeDataPtr data;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -123,8 +129,9 @@ struct NiKeyframeController : Controller
} }
}; };
struct NiAlphaController : Controller class NiAlphaController : public Controller
{ {
public:
NiFloatDataPtr data; NiFloatDataPtr data;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -134,8 +141,9 @@ struct NiAlphaController : Controller
} }
}; };
struct NiGeomMorpherController : Controller class NiGeomMorpherController : public Controller
{ {
public:
NiMorphDataPtr data; NiMorphDataPtr data;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -146,8 +154,9 @@ struct NiGeomMorpherController : Controller
} }
}; };
struct NiVisController : Controller class NiVisController : public Controller
{ {
public:
NiVisDataPtr data; NiVisDataPtr data;
void read(NIFFile *nif) void read(NIFFile *nif)

View file

@ -29,8 +29,10 @@
namespace Nif namespace Nif
{ {
struct NiSourceTexture : Named class NiSourceTexture : public Named
{ {
public:
// Is this an external (references a separate texture file) or // Is this an external (references a separate texture file) or
// internal (data is inside the nif itself) texture? // internal (data is inside the nif itself) texture?
bool external; bool external;
@ -65,7 +67,7 @@ struct NiSourceTexture : Named
{ {
Named::read(nif); Named::read(nif);
external = nif->getByte(); external = !!nif->getByte();
if(external) filename = nif->getString(); if(external) filename = nif->getString();
else else
@ -83,8 +85,9 @@ struct NiSourceTexture : Named
}; };
// Common ancestor for several data classes // Common ancestor for several data classes
struct ShapeData : Record class ShapeData : public Record
{ {
public:
FloatArray vertices, normals, colors, uvlist; FloatArray vertices, normals, colors, uvlist;
const Vector *center; const Vector *center;
float radius; float radius;
@ -116,8 +119,9 @@ struct ShapeData : Record
} }
}; };
struct NiTriShapeData : ShapeData class NiTriShapeData : public ShapeData
{ {
public:
// Triangles, three vertex indices per triangle // Triangles, three vertex indices per triangle
SliceArray<short> triangles; SliceArray<short> triangles;
@ -150,8 +154,9 @@ struct NiTriShapeData : ShapeData
} }
}; };
struct NiAutoNormalParticlesData : ShapeData class NiAutoNormalParticlesData : public ShapeData
{ {
public:
int activeCount; int activeCount;
void read(NIFFile *nif) void read(NIFFile *nif)
@ -171,8 +176,9 @@ struct NiAutoNormalParticlesData : ShapeData
} }
}; };
struct NiRotatingParticlesData : NiAutoNormalParticlesData class NiRotatingParticlesData : public NiAutoNormalParticlesData
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
NiAutoNormalParticlesData::read(nif); NiAutoNormalParticlesData::read(nif);
@ -185,8 +191,9 @@ struct NiRotatingParticlesData : NiAutoNormalParticlesData
} }
}; };
struct NiPosData : Record class NiPosData : public Record
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
int count = nif->getInt(); int count = nif->getInt();
@ -210,8 +217,9 @@ struct NiPosData : Record
} }
}; };
struct NiUVData : Record class NiUVData : public Record
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
// TODO: This is claimed to be a "float animation key", which is // 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) void read(NIFFile *nif)
{ {
int count = nif->getInt(); 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; unsigned int rmask, gmask, bmask, amask;
int bpp, mips; int bpp, mips;
@ -283,8 +293,9 @@ struct NiPixelData : Record
} }
}; };
struct NiColorData : Record class NiColorData : public Record
{ {
public:
struct ColorData struct ColorData
{ {
float time; float time;
@ -302,8 +313,9 @@ struct NiColorData : Record
} }
}; };
struct NiVisData : Record class NiVisData : public Record
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
int count = nif->getInt(); int count = nif->getInt();
@ -319,8 +331,9 @@ struct NiVisData : Record
} }
}; };
struct NiSkinInstance : Record class NiSkinInstance : public Record
{ {
public:
NiSkinDataPtr data; NiSkinDataPtr data;
NodePtr root; NodePtr root;
NodeList bones; NodeList bones;
@ -338,8 +351,9 @@ struct NiSkinInstance : Record
void post(NIFFile *nif); void post(NIFFile *nif);
}; };
struct NiSkinData : Record class NiSkinData : public Record
{ {
public:
// This is to make sure the structs are packed, ie. that the // This is to make sure the structs are packed, ie. that the
// compiler doesn't mess them up with extra alignment bytes. // compiler doesn't mess them up with extra alignment bytes.
#pragma pack(push) #pragma pack(push)
@ -395,8 +409,9 @@ struct NiSkinData : Record
} }
}; };
struct NiMorphData : Record class NiMorphData : public Record
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
int morphCount = nif->getInt(); int morphCount = nif->getInt();
@ -416,8 +431,9 @@ struct NiMorphData : Record
} }
}; };
struct NiKeyframeData : Record class NiKeyframeData : public Record
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
// Rotations first // Rotations first

View file

@ -35,15 +35,17 @@ namespace Nif
themselves decend from the Extra class, and all the extra data themselves decend from the Extra class, and all the extra data
connected to an object form a linked list connected to an object form a linked list
*/ */
struct Extra : Record class Extra : public Record
{ {
public:
ExtraPtr extra; ExtraPtr extra;
void read(NIFFile *nif) { extra.read(nif); } void read(NIFFile *nif) { extra.read(nif); }
}; };
struct NiVertWeightsExtraData : Extra class NiVertWeightsExtraData : public Extra
{ {
public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
Extra::read(nif); Extra::read(nif);
@ -57,8 +59,9 @@ struct NiVertWeightsExtraData : Extra
} }
}; };
struct NiTextKeyExtraData : Extra class NiTextKeyExtraData : public Extra
{ {
public:
struct TextKey struct TextKey
{ {
float time; float time;
@ -83,8 +86,9 @@ struct NiTextKeyExtraData : Extra
} }
}; };
struct NiStringExtraData : Extra class NiStringExtraData : public Extra
{ {
public:
/* Two known meanings: /* Two known meanings:
"MRK" - marker, only visible in the editor, not rendered in-game "MRK" - marker, only visible in the editor, not rendered in-game
"NCO" - no collision "NCO" - no collision

View file

@ -27,8 +27,7 @@
#include <libs/mangle/stream/stream.hpp> #include <libs/mangle/stream/stream.hpp>
#include <libs/mangle/stream/filters/buffer_stream.hpp> #include <libs/mangle/stream/filters/buffer_stream.hpp>
#include <libs/mangle/tools/str_exception.hpp> #include <libs/mangle/tools/str_exception.hpp>
#include <components/misc/slice_array.hpp>
#include "../misc/slice_array.hpp"
#include <vector> #include <vector>
#include <string> #include <string>

View file

@ -34,8 +34,9 @@ namespace Nif
parent node (unless it's the root), and transformation (location parent node (unless it's the root), and transformation (location
and rotation) relative to it's parent. 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. // Node flags. Interpretation depends somewhat on the type of node.
int flags; int flags;
const Transformation *trafo; const Transformation *trafo;
@ -55,7 +56,7 @@ struct Node : Named
trafo = nif->getTrafo(); trafo = nif->getTrafo();
props.read(nif); props.read(nif);
hasBounds = nif->getInt(); hasBounds = !!nif->getInt();
if(hasBounds) if(hasBounds)
{ {
nif->getInt(); // always 1 nif->getInt(); // always 1

View file

@ -29,8 +29,9 @@
namespace Nif namespace Nif
{ {
struct Property : Named class Property : public Named
{ {
public:
// The meaning of these depends on the actual property type. // The meaning of these depends on the actual property type.
int flags; int flags;
@ -41,8 +42,9 @@ struct Property : Named
} }
}; };
struct NiTexturingProperty : Property class NiTexturingProperty : public Property
{ {
public:
// A sub-texture // A sub-texture
struct Texture struct Texture
{ {
@ -67,7 +69,7 @@ struct NiTexturingProperty : Property
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
inUse = nif->getInt(); inUse = !!nif->getInt();
if(!inUse) return; if(!inUse) return;
texture.read(nif); texture.read(nif);