mirror of https://github.com/OpenMW/openmw.git
Finished all basic parsers. Added --quiet option to esmtool.
parent
2302e1f712
commit
db56985828
@ -0,0 +1,46 @@
|
||||
#ifndef _ESM_DIAL_H
|
||||
#define _ESM_DIAL_H
|
||||
|
||||
#include "esm_reader.hpp"
|
||||
|
||||
namespace ESM {
|
||||
|
||||
/*
|
||||
* Dialogue topic and journal entries. The actual data is contained in
|
||||
* the INFO records following the DIAL.
|
||||
*/
|
||||
|
||||
struct Dialogue
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Topic = 0,
|
||||
Voice = 1,
|
||||
Greeting = 2,
|
||||
Persuasion = 3,
|
||||
Journal = 4,
|
||||
Deleted = -1
|
||||
};
|
||||
|
||||
char type;
|
||||
|
||||
void load(ESMReader &esm)
|
||||
{
|
||||
esm.getSubNameIs("DATA");
|
||||
esm.getSubHeader();
|
||||
int si = esm.getSubSize();
|
||||
if(si == 1)
|
||||
esm.getT(type);
|
||||
else if(si == 4)
|
||||
{
|
||||
// These are just markers, their values are not used.
|
||||
int i;
|
||||
esm.getT(i);
|
||||
esm.getHNT(i,"DELE");
|
||||
type = Deleted;
|
||||
}
|
||||
else esm.fail("Unknown sub record size");
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
@ -1,96 +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 (loadspel.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.loadspel;
|
||||
import esm.imports;
|
||||
|
||||
/*
|
||||
* Spell
|
||||
*/
|
||||
|
||||
struct SpellList
|
||||
{
|
||||
RegionBuffer!(Spell*) list;
|
||||
|
||||
void load()
|
||||
{
|
||||
list = esFile.getRegion().getBuffer!(Spell*)(0,1);
|
||||
|
||||
while(esFile.isNextSub("NPCS"))
|
||||
list ~= esFile.getHPtr!(Spell)(spells);
|
||||
}
|
||||
}
|
||||
|
||||
struct Spell
|
||||
{
|
||||
char[] id;
|
||||
LoadState state;
|
||||
|
||||
enum SpellType
|
||||
{
|
||||
Spell = 0, // Normal spell, must be cast and costs mana
|
||||
Ability = 1, // Inert ability, always in effect
|
||||
Blight = 2, // Blight disease
|
||||
Disease = 3, // Common disease
|
||||
Curse = 4, // Curse (?)
|
||||
Power = 5 // Power, can use once a day
|
||||
}
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Autocalc = 1,
|
||||
PCStart = 2,
|
||||
Always = 4 // Casting always succeeds
|
||||
}
|
||||
|
||||
align(1) struct SPDTstruct
|
||||
{
|
||||
SpellType type;
|
||||
int cost;
|
||||
Flags flags;
|
||||
|
||||
static assert(SPDTstruct.sizeof==12);
|
||||
}
|
||||
|
||||
SPDTstruct data;
|
||||
|
||||
char[] name;
|
||||
EffectList effects;
|
||||
|
||||
void load()
|
||||
{with(esFile){
|
||||
name = getHNOString("FNAM");
|
||||
readHNExact(&data, data.sizeof, "SPDT");
|
||||
|
||||
effects = getRegion().getBuffer!(ENAMstruct)(0,1);
|
||||
|
||||
while(isNextSub("ENAM"))
|
||||
{
|
||||
effects.length = effects.length + 1;
|
||||
readHExact(&effects.array[$-1], effects.array[$-1].sizeof);
|
||||
}
|
||||
}}
|
||||
|
||||
}
|
||||
|
||||
ListID!(Spell) spells;
|
Loading…
Reference in New Issue