2014-10-19 02:26:44 -04:00
|
|
|
/// 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 "recordptr.hpp"
|
|
|
|
|
|
|
|
namespace Nif
|
|
|
|
{
|
2022-07-21 15:51:34 +04:00
|
|
|
struct File;
|
|
|
|
struct Record;
|
|
|
|
struct Stream;
|
|
|
|
|
2019-09-13 19:54:19 +03:00
|
|
|
// An extra data record. All the extra data connected to an object form a linked list.
|
2020-12-16 01:06:05 +03:00
|
|
|
struct Extra : public Record
|
2014-10-19 02:26:44 -04:00
|
|
|
{
|
2020-10-04 01:27:49 +03:00
|
|
|
std::string name;
|
2019-09-13 19:54:19 +03:00
|
|
|
ExtraPtr next; // Next extra data record in the list
|
2021-07-27 07:58:57 +03:00
|
|
|
unsigned int recordSize{ 0u };
|
2014-10-19 02:26:44 -04:00
|
|
|
|
2020-12-16 01:06:05 +03:00
|
|
|
void read(NIFStream* nif) override;
|
2022-09-17 19:24:42 +02:00
|
|
|
void post(Reader& nif) override { next.post(nif); }
|
2022-06-22 00:43:16 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Controller : public Record
|
|
|
|
{
|
|
|
|
enum Flags
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2022-06-22 00:43:16 +03:00
|
|
|
Flag_Active = 0x8
|
|
|
|
};
|
|
|
|
|
2014-10-19 02:26:44 -04:00
|
|
|
enum ExtrapolationMode
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2014-10-19 02:26:44 -04:00
|
|
|
Cycle = 0,
|
|
|
|
Reverse = 2,
|
|
|
|
Constant = 4,
|
2022-09-22 21:26:05 +03:00
|
|
|
Mask = 6
|
2019-09-13 19:54:19 +03:00
|
|
|
};
|
2014-10-19 02:26:44 -04:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
ControllerPtr next;
|
2014-10-19 02:26:44 -04:00
|
|
|
int flags;
|
2020-10-16 22:18:54 +04:00
|
|
|
float frequency, phase;
|
|
|
|
float timeStart, timeStop;
|
|
|
|
NamedPtr target;
|
2022-06-22 00:43:16 +03:00
|
|
|
|
|
|
|
void read(NIFStream* nif) override;
|
2022-09-17 19:24:42 +02:00
|
|
|
void post(Reader& nif) override;
|
2014-10-19 02:26:44 -04:00
|
|
|
|
2020-12-16 01:06:05 +03:00
|
|
|
bool isActive() const { return flags & Flag_Active; }
|
2020-10-04 01:27:49 +03:00
|
|
|
ExtrapolationMode extrapolationMode() const { return static_cast<ExtrapolationMode>(flags & Mask); }
|
2014-10-19 02:26:44 -04:00
|
|
|
};
|
|
|
|
|
2019-09-13 19:54:19 +03:00
|
|
|
/// Has name, extra-data and controller
|
2020-12-16 01:06:05 +03:00
|
|
|
struct Named : public Record
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2019-09-13 19:54:19 +03:00
|
|
|
std::string name;
|
|
|
|
ExtraPtr extra;
|
2022-06-22 00:43:16 +03:00
|
|
|
ExtraList extralist;
|
2014-10-19 02:26:44 -04:00
|
|
|
ControllerPtr controller;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2022-07-21 15:51:34 +04:00
|
|
|
void read(NIFStream* nif) override;
|
2022-09-17 19:24:42 +02:00
|
|
|
void post(Reader& nif) override;
|
2014-10-19 02:26:44 -04:00
|
|
|
};
|
2020-02-02 17:08:17 +03:00
|
|
|
using NiSequenceStreamHelper = Named;
|
2014-10-19 02:26:44 -04:00
|
|
|
|
|
|
|
} // Namespace
|
|
|
|
#endif
|