Finished SPEL, added defs.hpp
parent
288b9362ae
commit
ae6136816d
@ -0,0 +1,60 @@
|
||||
#ifndef _ESM_DEFS_H
|
||||
#define _ESM_DEFS_H
|
||||
|
||||
#include "esm_reader.hpp"
|
||||
|
||||
namespace ESM {
|
||||
|
||||
/** A list of references to spells and spell effects. This is shared
|
||||
between the records BSGN, NPC and RACE.
|
||||
*/
|
||||
struct SpellList
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
|
||||
void load(ESMReader &esm)
|
||||
{
|
||||
while(esm.isNextSub("NPCS"))
|
||||
list.push_back(esm.getHString());
|
||||
}
|
||||
};
|
||||
|
||||
/** Defines a spell effect. Shared between SPEL (Spells), ALCH
|
||||
(Potions) and ENCH (Item enchantments) records
|
||||
*/
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
struct ENAMstruct
|
||||
{
|
||||
// Magical effect, hard-coded ID
|
||||
short effectID;
|
||||
|
||||
// Which skills/attributes are affected (for restore/drain spells
|
||||
// etc.)
|
||||
char skill, attribute; // -1 if N/A
|
||||
|
||||
// Other spell parameters
|
||||
int range; // 0 - self, 1 - touch, 2 - target
|
||||
int area, duration, magnMin, magnMax;
|
||||
|
||||
// Struct size should be 24 bytes
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct EffectList
|
||||
{
|
||||
std::vector<ENAMstruct> list;
|
||||
|
||||
void load(ESMReader &esm)
|
||||
{
|
||||
ENAMstruct s;
|
||||
while(esm.isNextSub("ENAM"))
|
||||
{
|
||||
esm.getHT(s, 24);
|
||||
list.push_back(s);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||
Copyright (C) 2008 Nicolay Korslund
|
||||
Email: < korslund@gmail.com >
|
||||
WWW: http://openmw.snaptoad.com/
|
||||
|
||||
This file (loadacti.d) is part of the OpenMW package.
|
||||
|
||||
OpenMW is distributed as free software: you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 3, as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
version 3 along with this program. If not, see
|
||||
http://www.gnu.org/licenses/ .
|
||||
|
||||
*/
|
||||
|
||||
module esm.loadacti;
|
||||
|
||||
import esm.imports;
|
||||
|
||||
/*
|
||||
* Activator
|
||||
*
|
||||
* Activators are static in-world objects that pop up a caption when
|
||||
* you stand close and look at them, for example signs. Some
|
||||
* activators have scrips, such as beds that let you sleep when you
|
||||
* activate them.
|
||||
*/
|
||||
|
||||
struct Activator
|
||||
{
|
||||
mixin LoadT;
|
||||
|
||||
Script *script;
|
||||
MeshIndex model;
|
||||
|
||||
void load()
|
||||
{with(esFile){
|
||||
model = getMesh();
|
||||
name = getHNString("FNAM");
|
||||
script = getHNOPtr!(Script)("SCRI", scripts);
|
||||
|
||||
makeProto();
|
||||
}}
|
||||
}
|
||||
ListID!(Activator) activators;
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||
Copyright (C) 2008 Nicolay Korslund
|
||||
Email: < korslund@gmail.com >
|
||||
WWW: http://openmw.snaptoad.com/
|
||||
|
||||
This file (loadbsgn.d) is part of the OpenMW package.
|
||||
|
||||
OpenMW is distributed as free software: you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 3, as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
version 3 along with this program. If not, see
|
||||
http://www.gnu.org/licenses/ .
|
||||
|
||||
*/
|
||||
|
||||
module esm.loadbsgn;
|
||||
import esm.imports;
|
||||
|
||||
/*
|
||||
* Birth signs
|
||||
*/
|
||||
|
||||
struct BirthSign
|
||||
{
|
||||
char[] description;
|
||||
|
||||
mixin LoadT;
|
||||
|
||||
TextureIndex texture;
|
||||
|
||||
// List of powers and abilities that come with this birth sign.
|
||||
SpellList powers;
|
||||
|
||||
void load()
|
||||
{with(esFile){
|
||||
name = getHNString("FNAM");
|
||||
|
||||
texture = getOTexture();
|
||||
|
||||
description = getHNOString("DESC");
|
||||
|
||||
powers.load();
|
||||
|
||||
// No monster class equivalent yet
|
||||
}}
|
||||
}
|
||||
ListID!(BirthSign) birthSigns;
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||
Copyright (C) 2008 Nicolay Korslund
|
||||
Email: < korslund@gmail.com >
|
||||
WWW: http://openmw.snaptoad.com/
|
||||
|
||||
This file (loadsoun.d) is part of the OpenMW package.
|
||||
|
||||
OpenMW is distributed as free software: you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 3, as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
version 3 along with this program. If not, see
|
||||
http://www.gnu.org/licenses/ .
|
||||
|
||||
*/
|
||||
|
||||
module esm.loadsoun;
|
||||
|
||||
import esm.imports;
|
||||
|
||||
/*
|
||||
* Sounds
|
||||
*/
|
||||
|
||||
align(1) struct SOUNstruct
|
||||
{
|
||||
ubyte volume, minRange, maxRange;
|
||||
}
|
||||
static assert(SOUNstruct.sizeof == 3);
|
||||
|
||||
struct Sound
|
||||
{
|
||||
LoadState state;
|
||||
char[] id;
|
||||
|
||||
SOUNstruct data;
|
||||
|
||||
SoundIndex sound;
|
||||
|
||||
void load()
|
||||
{
|
||||
sound = esFile.getSound();
|
||||
esFile.readHNExact(&data, data.sizeof, "DATA");
|
||||
}
|
||||
}
|
||||
|
||||
ListID!(Sound) sounds;
|
Loading…
Reference in New Issue