Finished ACTI, made ESM namespace

actorid
Nicolay Korslund 15 years ago
parent 1ba62f309e
commit 288b9362ae

@ -14,6 +14,8 @@
#include "../mangle/tools/str_exception.h"
#include "../tools/stringops.h"
namespace ESM {
/* A structure used for holding fixed-length strings. In the case of
LEN=4, it can be more efficient to match the string as a 32 bit
number, therefore the struct is implemented as a union with an int.
@ -532,5 +534,5 @@ private:
MasterList masters;
int spf; // Special file signifier (see SpecialFile below)
};
}
#endif

@ -0,0 +1,20 @@
#ifndef _ESM_ACTI_H
#define _ESM_ACTI_H
#include "esm_reader.hpp"
namespace ESM {
struct Activator
{
std::string name, script, model;
void load(ESMReader &esm)
{
model = esm.getHNString("MODL");
name = esm.getHNString("FNAM");
script = esm.getHNOString("SCRI");
}
};
}
#endif

@ -3,6 +3,8 @@
#include "esm_reader.hpp"
namespace ESM {
enum PartReferenceType
{
PRT_Head = 0,
@ -98,5 +100,5 @@ struct Armor
enchant = esm.getHNOString("ENAM");
}
};
}
#endif

@ -3,6 +3,8 @@
#include "esm_reader.hpp"
namespace ESM {
struct BodyPart
{
enum MeshPart
@ -55,5 +57,5 @@ struct BodyPart
esm.getHNT(data, "BYDT", 4);
}
};
}
#endif

@ -2,14 +2,16 @@
#define _ESM_BSGN_H
#include "esm_reader.hpp"
//#include "loadspel.hpp"
#include "loadspel.hpp"
namespace ESM {
struct BirthSign
{
std::string name, description, texture;
// List of powers and abilities that come with this birth sign.
//SpellList powers;
SpellList powers;
void load(ESMReader &esm)
{
@ -17,8 +19,8 @@ struct BirthSign
texture = esm.getHNOString("TNAM");
description = esm.getHNOString("DESC");
//powers.load(esm);
powers.load(esm);
};
};
}
#endif

@ -3,6 +3,8 @@
#include "esm_reader.hpp"
namespace ESM {
struct Door
{
std::string name, model, script, openSound, closeSound;
@ -16,4 +18,5 @@ struct Door
closeSound = esm.getHNOString("ANAM");
}
};
}
#endif

@ -3,6 +3,8 @@
#include "esm_reader.hpp"
namespace ESM {
struct SOUNstruct
{
unsigned char volume, minRange, maxRange;
@ -19,4 +21,5 @@ struct Sound
esm.getHNT(data, "DATA", 3);
}
};
}
#endif

@ -0,0 +1,76 @@
#ifndef _ESM_SPEL_H
#define _ESM_SPEL_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.
TODO: This should also be part of a shared definition file
*/
struct SpellList
{
std::vector<std::string> list;
void load(ESMReader &esm)
{
while(esm.isNextSub("NPCS"))
list.push_back(esm.getHString());
}
};
/* TODO: Not completely ported yet - depends on EffectList, which
should be defined in a shared definition file.
struct Spell
{
enum SpellType
{
ST_Spell = 0, // Normal spell, must be cast and costs mana
ST_Ability = 1, // Inert ability, always in effect
ST_Blight = 2, // Blight disease
ST_Disease = 3, // Common disease
ST_Curse = 4, // Curse (?)
ST_Power = 5 // Power, can use once a day
};
enum Flags
{
F_Autocalc = 1,
F_PCStart = 2,
F_Always = 4 // Casting always succeeds
};
struct SPDTstruct
{
int type; // SpellType
int cost; // Mana cost
int flags; // Flags
};
SPDTstruct data;
std::string name;
EffectList effects;
void load()
{with(esFile){
name = getHNOString("FNAM");
getHNT(data, "SPDT", 12);
effects = getRegion().getBuffer!(ENAMstruct)(0,1);
while(isNextSub("ENAM"))
{
effects.length = effects.length + 1;
readHExact(&effects.array[$-1], effects.array[$-1].sizeof);
}
}}
}
*/
}
#endif

@ -1,11 +1,15 @@
#ifndef _ESM_RECORDS_H
#define _ESM_RECORDS_H
#include "loadacti.hpp"
#include "loadarmo.hpp"
#include "loadbody.hpp"
#include "loadbsgn.hpp"
#include "loaddoor.hpp"
#include "loadsoun.hpp"
#include "loadspel.hpp"
namespace ESM {
// Integer versions of all the record names, used for faster lookup
enum RecNameInts
@ -53,5 +57,5 @@ enum RecNameInts
REC_STAT = 0x54415453,
REC_WEAP = 0x50414557
};
}
#endif

@ -4,7 +4,9 @@
#include "esmtool_cmd.h"
#include <iostream>
using namespace std;
using namespace ESM;
void printRaw(ESMReader &esm);
@ -83,8 +85,36 @@ int main(int argc, char**argv)
cout << " Mesh: " << bp.model << endl;
break;
}
case REC_BSGN:
{
BirthSign bs;
bs.load(esm);
cout << " Name: " << bs.name << endl;
cout << " Texture: " << bs.texture << endl;
cout << " Description: " << bs.description << endl;
break;
}
case REC_DOOR:
{
Door d;
d.load(esm);
cout << " Name: " << d.name << endl;
cout << " Mesh: " << d.model << endl;
cout << " Script: " << d.script << endl;
cout << " OpenSound: " << d.openSound << endl;
cout << " CloseSound: " << d.closeSound << endl;
break;
}
case REC_SOUN:
{
Sound d;
d.load(esm);
cout << " Sound: " << d.sound << endl;
cout << " Volume: " << (int)d.data.volume << endl;
break;
}
default:
//cout << " Skipping\n";
cout << " Skipping\n";
esm.skipRecord();
}
}

Loading…
Cancel
Save