1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 03:35:27 +00:00
OpenMW/components/esm4/loadrace.hpp

172 lines
5.4 KiB
C++
Raw Normal View History

2022-01-30 11:07:39 +01:00
/*
Copyright (C) 2016, 2018-2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
cc9cii cc9c@iinet.net.au
Much of the information on the data structures are based on the information
from Tes4Mod:Mod_File_Format and Tes5Mod:File_Formats but also refined by
trial & error. See http://en.uesp.net/wiki for details.
*/
#ifndef ESM4_RACE
#define ESM4_RACE
2022-09-22 21:26:05 +03:00
#include <array>
2022-01-30 11:07:39 +01:00
#include <cstdint>
#include <map>
2022-09-22 21:26:05 +03:00
#include <vector>
2022-01-30 11:07:39 +01:00
#include "actor.hpp" // AttributeValues, BodyTemplate
2022-09-22 21:26:05 +03:00
#include "formid.hpp"
2022-01-30 11:07:39 +01:00
namespace ESM4
{
class Reader;
class Writer;
struct Race
{
#pragma pack(push, 1)
struct Data
{
std::uint8_t flags; // 0x01 = not playable, 0x02 = not male, 0x04 = not female, ?? = fixed
};
#pragma pack(pop)
enum SkillIndex
{
2022-09-22 21:26:05 +03:00
Skill_Armorer = 0x0C,
Skill_Athletics = 0x0D,
Skill_Blade = 0x0E,
Skill_Block = 0x0F,
Skill_Blunt = 0x10,
Skill_HandToHand = 0x11,
Skill_HeavyArmor = 0x12,
Skill_Alchemy = 0x13,
Skill_Alteration = 0x14,
2022-01-30 11:07:39 +01:00
Skill_Conjuration = 0x15,
Skill_Destruction = 0x16,
2022-09-22 21:26:05 +03:00
Skill_Illusion = 0x17,
Skill_Mysticism = 0x18,
2022-01-30 11:07:39 +01:00
Skill_Restoration = 0x19,
2022-09-22 21:26:05 +03:00
Skill_Acrobatics = 0x1A,
Skill_LightArmor = 0x1B,
Skill_Marksman = 0x1C,
Skill_Mercantile = 0x1D,
Skill_Security = 0x1E,
Skill_Sneak = 0x1F,
2022-01-30 11:07:39 +01:00
Skill_Speechcraft = 0x20,
2022-09-22 21:26:05 +03:00
Skill_None = 0xFF,
Skill_Unknown = 0x00
2022-01-30 11:07:39 +01:00
};
enum HeadPartIndex // TES4
{
2022-09-22 21:26:05 +03:00
Head = 0,
EarMale = 1,
EarFemale = 2,
Mouth = 3,
TeethLower = 4,
TeethUpper = 5,
Tongue = 6,
EyeLeft = 7, // no texture
EyeRight = 8, // no texture
NumHeadParts = 9
2022-01-30 11:07:39 +01:00
};
enum BodyPartIndex // TES4
{
2022-09-22 21:26:05 +03:00
UpperBody = 0,
LowerBody = 1,
Hands = 2,
Feet = 3,
Tail = 4,
NumBodyParts = 5
2022-01-30 11:07:39 +01:00
};
struct BodyPart
{
2022-09-22 21:26:05 +03:00
std::string mesh; // can be empty for arms, hands, etc
2022-01-30 11:07:39 +01:00
std::string texture; // can be empty e.g. eye left, eye right
};
2022-09-22 21:26:05 +03:00
FormId mFormId; // from the header
2022-01-30 11:07:39 +01:00
std::uint32_t mFlags; // from the header, see enum type RecordFlag for details
bool mIsTES5;
std::string mEditorId;
std::string mFullName;
std::string mDesc;
2022-09-22 21:26:05 +03:00
std::string mModelMale; // TES5 skeleton (in TES4 skeleton is found in npc_)
2022-01-30 11:07:39 +01:00
std::string mModelFemale; // TES5 skeleton (in TES4 skeleton is found in npc_)
AttributeValues mAttribMale;
AttributeValues mAttribFemale;
std::map<SkillIndex, std::uint8_t> mSkillBonus;
// DATA
float mHeightMale = 1.0f;
float mHeightFemale = 1.0f;
float mWeightMale = 1.0f;
float mWeightFemale = 1.0f;
2022-01-30 11:07:39 +01:00
std::uint32_t mRaceFlags; // 0x0001 = playable?
2022-09-22 21:26:05 +03:00
std::vector<BodyPart> mHeadParts; // see HeadPartIndex
2022-01-30 11:07:39 +01:00
std::vector<BodyPart> mHeadPartsFemale; // see HeadPartIndex
2022-09-22 21:26:05 +03:00
std::vector<BodyPart> mBodyPartsMale; // see BodyPartIndex
2022-01-30 11:07:39 +01:00
std::vector<BodyPart> mBodyPartsFemale; // see BodyPartIndex
2022-09-22 21:26:05 +03:00
std::vector<FormId> mEyeChoices; // texture only
2022-01-30 11:07:39 +01:00
std::vector<FormId> mHairChoices; // not for TES5
float mFaceGenMainClamp;
float mFaceGenFaceClamp;
2022-09-22 21:26:05 +03:00
std::vector<float> mSymShapeModeCoefficients; // should be 50
std::vector<float> mSymShapeModeCoeffFemale; // should be 50
std::vector<float> mAsymShapeModeCoefficients; // should be 30
std::vector<float> mAsymShapeModeCoeffFemale; // should be 30
2022-01-30 11:07:39 +01:00
std::vector<float> mSymTextureModeCoefficients; // should be 50
2022-09-22 21:26:05 +03:00
std::vector<float> mSymTextureModeCoeffFemale; // should be 50
2022-01-30 11:07:39 +01:00
std::map<FormId, std::int32_t> mDisposition; // race adjustments
2022-09-22 21:26:05 +03:00
std::vector<FormId> mBonusSpells; // race ability/power
std::array<FormId, 2> mVNAM; // don't know what these are; 1 or 2 RACE FormIds
std::array<FormId, 2> mDefaultHair; // male/female (HAIR FormId for TES4)
2022-01-30 11:07:39 +01:00
std::uint32_t mNumKeywords;
FormId mSkin; // TES5
BodyTemplate mBodyTemplate; // TES5
// FIXME: there's no fixed order?
// head, mouth, eyes, brow, hair
2022-09-22 21:26:05 +03:00
std::vector<FormId> mHeadPartIdsMale; // TES5
2022-01-30 11:07:39 +01:00
std::vector<FormId> mHeadPartIdsFemale; // TES5
void load(ESM4::Reader& reader);
2022-09-22 21:26:05 +03:00
// void save(ESM4::Writer& writer) const;
2022-01-30 11:07:39 +01:00
2022-09-22 21:26:05 +03:00
// void blank();
2022-01-30 11:07:39 +01:00
};
}
#endif // ESM4_RACE