forked from mirror/openmw-tes3mp
Moved base NIF classes into a separate file.
This resolves the dependency mess, and makes things more readable. The dependency tree for nif records now looks like this: Record.hpp --base.hpp ----controlled.hpp ----controller.hpp ----data.hpp ----effect.hpp ----extra.hpp ----node.hpp Node.hpp has many extra dependencies because nifogre only includes it instead of each of these files. That should be fixed.loadfix
parent
5abed1c32a
commit
38bcff2622
@ -0,0 +1,91 @@
|
|||||||
|
///This file holds the main classes of NIF Records used by everything else.
|
||||||
|
#ifndef OPENMW_COMPONENTS_NIF_BASE_HPP
|
||||||
|
#define OPENMW_COMPONENTS_NIF_BASE_HPP
|
||||||
|
|
||||||
|
#include "record.hpp"
|
||||||
|
#include "niffile.hpp"
|
||||||
|
#include "recordptr.hpp"
|
||||||
|
#include "nifstream.hpp"
|
||||||
|
#include "nifkey.hpp"
|
||||||
|
|
||||||
|
namespace Nif
|
||||||
|
{
|
||||||
|
/** A record that can have extra data. The extra data objects
|
||||||
|
themselves descend from the Extra class, and all the extra data
|
||||||
|
connected to an object form a linked list
|
||||||
|
*/
|
||||||
|
class Extra : public Record
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ExtraPtr extra;
|
||||||
|
|
||||||
|
void read(NIFStream *nif) { extra.read(nif); }
|
||||||
|
void post(NIFFile *nif) { extra.post(nif); }
|
||||||
|
};
|
||||||
|
|
||||||
|
class Controller : public Record
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ControllerPtr next;
|
||||||
|
int flags;
|
||||||
|
float frequency, phase;
|
||||||
|
float timeStart, timeStop;
|
||||||
|
ControlledPtr target;
|
||||||
|
|
||||||
|
void read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
next.read(nif);
|
||||||
|
|
||||||
|
flags = nif->getUShort();
|
||||||
|
|
||||||
|
frequency = nif->getFloat();
|
||||||
|
phase = nif->getFloat();
|
||||||
|
timeStart = nif->getFloat();
|
||||||
|
timeStop = nif->getFloat();
|
||||||
|
|
||||||
|
target.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void post(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Record::post(nif);
|
||||||
|
next.post(nif);
|
||||||
|
target.post(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Anything that has a controller
|
||||||
|
class Controlled : public Extra
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ControllerPtr controller;
|
||||||
|
|
||||||
|
void read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
Extra::read(nif);
|
||||||
|
controller.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void post(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Extra::post(nif);
|
||||||
|
controller.post(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Has name, extra-data and controller
|
||||||
|
class Named : public Controlled
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
void read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
name = nif->getString();
|
||||||
|
Controlled::read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
typedef Named NiSequenceStreamHelper;
|
||||||
|
|
||||||
|
} // Namespace
|
||||||
|
#endif
|
Loading…
Reference in New Issue