mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 15:16:24 +00:00
Big update.
This commit is contained in:
@@ -46,13 +46,13 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
// Check if sql index pos is valid
|
||||
if (int32(result->GetFieldCount() - 1) < _sqlIndexPos)
|
||||
{
|
||||
ASSERT(false, "Invalid index pos for dbc: '%s'", _sqlTableName);
|
||||
ASSERT(false, "Invalid index pos for dbc: '{}'", _sqlTableName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Resize index table
|
||||
// database query *MUST* contain ORDER BY `index_field` DESC clause
|
||||
uint32 indexTableSize = std::max(records, (*result)[_sqlIndexPos].GetUInt32() + 1);
|
||||
uint32 indexTableSize = std::max(records, (*result)[_sqlIndexPos].Get<uint32>() + 1);
|
||||
if (indexTableSize > records)
|
||||
{
|
||||
char** tmpIdxTable = new char* [indexTableSize];
|
||||
@@ -70,7 +70,7 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 indexValue = fields[_sqlIndexPos].GetUInt32();
|
||||
uint32 indexValue = fields[_sqlIndexPos].Get<uint32>();
|
||||
char* dataValue = indexTable[indexValue];
|
||||
|
||||
// If exist in DBC file override from DB
|
||||
@@ -86,34 +86,34 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
switch (*dbcFormat)
|
||||
{
|
||||
case FT_FLOAT:
|
||||
*reinterpret_cast<float*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].GetFloat();
|
||||
*reinterpret_cast<float*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].Get<float>();
|
||||
dataOffset += sizeof(float);
|
||||
break;
|
||||
case FT_IND:
|
||||
case FT_INT:
|
||||
*reinterpret_cast<uint32*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].GetUInt32();
|
||||
*reinterpret_cast<uint32*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].Get<uint32>();
|
||||
dataOffset += sizeof(uint32);
|
||||
break;
|
||||
case FT_BYTE:
|
||||
*reinterpret_cast<uint8*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].GetUInt8();
|
||||
*reinterpret_cast<uint8*>(&dataValue[dataOffset]) = fields[sqlColumnNumber].Get<uint8>();
|
||||
dataOffset += sizeof(uint8);
|
||||
break;
|
||||
case FT_STRING:
|
||||
*reinterpret_cast<char**>(&dataValue[dataOffset]) = CloneStringToPool(fields[sqlColumnNumber].GetString());
|
||||
*reinterpret_cast<char**>(&dataValue[dataOffset]) = CloneStringToPool(fields[sqlColumnNumber].Get<std::string>());
|
||||
dataOffset += sizeof(char*);
|
||||
break;
|
||||
case FT_SORT:
|
||||
case FT_NA:
|
||||
break;
|
||||
default:
|
||||
ASSERT(false, "Unsupported data type '%c' in table '%s'", *dbcFormat, _sqlTableName);
|
||||
ASSERT(false, "Unsupported data type '%c' in table '{}'", *dbcFormat, _sqlTableName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
++sqlColumnNumber;
|
||||
}
|
||||
|
||||
ASSERT(sqlColumnNumber == result->GetFieldCount(), "SQL format string does not match database for table: '%s'", _sqlTableName);
|
||||
ASSERT(sqlColumnNumber == result->GetFieldCount(), "SQL format string does not match database for table: '{}'", _sqlTableName);
|
||||
ASSERT(dataOffset == _recordSize);
|
||||
} while (result->NextRow());
|
||||
|
||||
|
||||
@@ -18,6 +18,23 @@
|
||||
#ifndef DBCENUMS_H
|
||||
#define DBCENUMS_H
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct DBCPosition2D
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
};
|
||||
|
||||
struct DBCPosition3D
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
float Z;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
// Client expected level limitation, like as used in DBC item max levels for "until max player level"
|
||||
// use as default max player level, must be fit max level for used client
|
||||
// also see MAX_LEVEL and STRONG_MAX_LEVEL define
|
||||
@@ -31,7 +48,7 @@
|
||||
// also see MAX_LEVEL and GT_MAX_LEVEL define
|
||||
#define STRONG_MAX_LEVEL 255
|
||||
|
||||
enum BattlegroundBracketId : uint8 // bracketId for level ranges
|
||||
enum BattlegroundBracketId // bracketId for level ranges
|
||||
{
|
||||
BG_BRACKET_ID_FIRST = 0,
|
||||
BG_BRACKET_ID_LAST = 15
|
||||
|
||||
@@ -21,124 +21,9 @@
|
||||
#include "Common.h"
|
||||
#include "DBCStorageIterator.h"
|
||||
#include "Errors.h"
|
||||
#include <G3D/AABox.h>
|
||||
#include <G3D/Vector3.h>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
// Structures for M4 file. Source: https://wowdev.wiki
|
||||
template<typename T>
|
||||
struct M2SplineKey
|
||||
{
|
||||
T p0;
|
||||
T p1;
|
||||
T p2;
|
||||
};
|
||||
|
||||
struct M2Header
|
||||
{
|
||||
char Magic[4]; // "MD20"
|
||||
uint32 Version; // The version of the format.
|
||||
uint32 lName; // Length of the model's name including the trailing \0
|
||||
uint32 ofsName; // Offset to the name, it seems like models can get reloaded by this name.should be unique, i guess.
|
||||
uint32 GlobalModelFlags; // 0x0001: tilt x, 0x0002: tilt y, 0x0008: add 2 fields in header, 0x0020: load .phys data (MoP+), 0x0080: has _lod .skin files (MoP?+), 0x0100: is camera related.
|
||||
uint32 nGlobalSequences;
|
||||
uint32 ofsGlobalSequences; // A list of timestamps.
|
||||
uint32 nAnimations;
|
||||
uint32 ofsAnimations; // Information about the animations in the model.
|
||||
uint32 nAnimationLookup;
|
||||
uint32 ofsAnimationLookup; // Mapping of global IDs to the entries in the Animation sequences block.
|
||||
uint32 nBones; // MAX_BONES = 0x100
|
||||
uint32 ofsBones; // Information about the bones in this model.
|
||||
uint32 nKeyBoneLookup;
|
||||
uint32 ofsKeyBoneLookup; // Lookup table for key skeletal bones.
|
||||
uint32 nVertices;
|
||||
uint32 ofsVertices; // Vertices of the model.
|
||||
uint32 nViews; // Views (LOD) are now in .skins.
|
||||
uint32 nSubmeshAnimations;
|
||||
uint32 ofsSubmeshAnimations; // Submesh color and alpha animations definitions.
|
||||
uint32 nTextures;
|
||||
uint32 ofsTextures; // Textures of this model.
|
||||
uint32 nTransparency;
|
||||
uint32 ofsTransparency; // Transparency of textures.
|
||||
uint32 nUVAnimation;
|
||||
uint32 ofsUVAnimation;
|
||||
uint32 nTexReplace;
|
||||
uint32 ofsTexReplace; // Replaceable Textures.
|
||||
uint32 nRenderFlags;
|
||||
uint32 ofsRenderFlags; // Blending modes / render flags.
|
||||
uint32 nBoneLookupTable;
|
||||
uint32 ofsBoneLookupTable; // A bone lookup table.
|
||||
uint32 nTexLookup;
|
||||
uint32 ofsTexLookup; // The same for textures.
|
||||
uint32 nTexUnits; // possibly removed with cata?!
|
||||
uint32 ofsTexUnits; // And texture units. Somewhere they have to be too.
|
||||
uint32 nTransLookup;
|
||||
uint32 ofsTransLookup; // Everything needs its lookup. Here are the transparencies.
|
||||
uint32 nUVAnimLookup;
|
||||
uint32 ofsUVAnimLookup;
|
||||
G3D::AABox BoundingBox; // min/max( [1].z, 2.0277779f ) - 0.16f seems to be the maximum camera height
|
||||
float BoundingSphereRadius;
|
||||
G3D::AABox CollisionBox;
|
||||
float CollisionSphereRadius;
|
||||
uint32 nBoundingTriangles;
|
||||
uint32 ofsBoundingTriangles; // Our bounding volumes. Similar structure like in the old ofsViews.
|
||||
uint32 nBoundingVertices;
|
||||
uint32 ofsBoundingVertices;
|
||||
uint32 nBoundingNormals;
|
||||
uint32 ofsBoundingNormals;
|
||||
uint32 nAttachments;
|
||||
uint32 ofsAttachments; // Attachments are for weapons etc.
|
||||
uint32 nAttachLookup;
|
||||
uint32 ofsAttachLookup; // Of course with a lookup.
|
||||
uint32 nEvents;
|
||||
uint32 ofsEvents; // Used for playing sounds when dying and a lot else.
|
||||
uint32 nLights;
|
||||
uint32 ofsLights; // Lights are mainly used in loginscreens but in wands and some doodads too.
|
||||
uint32 nCameras; // Format of Cameras changed with version 271!
|
||||
uint32 ofsCameras; // The cameras are present in most models for having a model in the Character-Tab.
|
||||
uint32 nCameraLookup;
|
||||
uint32 ofsCameraLookup; // And lookup-time again.
|
||||
uint32 nRibbonEmitters;
|
||||
uint32 ofsRibbonEmitters; // Things swirling around. See the CoT-entrance for light-trails.
|
||||
uint32 nParticleEmitters;
|
||||
uint32 ofsParticleEmitters; // Spells and weapons, doodads and loginscreens use them. Blood dripping of a blade? Particles.
|
||||
uint32 nBlendMaps; // This has to deal with blending. Exists IFF (flags & 0x8) != 0. When set, textures blending is overriden by the associated array. See M2/WotLK#Blend_mode_overrides
|
||||
uint32 ofsBlendMaps; // Same as above. Points to an array of uint16 of nBlendMaps entries -- From WoD information.};
|
||||
};
|
||||
|
||||
struct M2Array
|
||||
{
|
||||
uint32_t number;
|
||||
uint32 offset_elements;
|
||||
};
|
||||
struct M2Track
|
||||
{
|
||||
uint16_t interpolation_type;
|
||||
uint16_t global_sequence;
|
||||
M2Array timestamps;
|
||||
M2Array values;
|
||||
};
|
||||
|
||||
struct M2Camera
|
||||
{
|
||||
uint32_t type; // 0: portrait, 1: characterinfo; -1: else (flyby etc.); referenced backwards in the lookup table.
|
||||
float fov; // No radians, no degrees. Multiply by 35 to get degrees.
|
||||
float far_clip;
|
||||
float near_clip;
|
||||
M2Track positions; // How the camera's position moves. Should be 3*3 floats.
|
||||
G3D::Vector3 position_base;
|
||||
M2Track target_positions; // How the target moves. Should be 3*3 floats.
|
||||
G3D::Vector3 target_position_base;
|
||||
M2Track rolldata; // The camera can have some roll-effect. Its 0 to 2*Pi.
|
||||
};
|
||||
|
||||
struct FlyByCamera
|
||||
{
|
||||
uint32 timeStamp;
|
||||
G3D::Vector4 locations;
|
||||
};
|
||||
|
||||
/// Interface class for common access
|
||||
class DBCStorageBase
|
||||
{
|
||||
|
||||
@@ -719,13 +719,11 @@ struct ChrRacesEntry
|
||||
|
||||
struct CinematicCameraEntry
|
||||
{
|
||||
uint32 id; // 0 index
|
||||
char const* filename; // 1
|
||||
uint32 soundid; // 2 in SoundEntries.dbc or 0
|
||||
float base_x; // 3
|
||||
float base_y; // 4
|
||||
float base_z; // 5
|
||||
float base_o; // 6
|
||||
uint32 ID; // 0
|
||||
char const* Model; // 1 Model filename (translate .mdx to .m2)
|
||||
uint32 SoundID; // 2 Sound ID (voiceover for cinematic)
|
||||
DBCPosition3D Origin; // 3-5 Position in map used for basis for M2 co-ordinates
|
||||
float OriginFacing; // 6 Orientation in map used for basis for M2 co-ordinates
|
||||
};
|
||||
|
||||
struct CinematicSequencesEntry
|
||||
@@ -1751,16 +1749,14 @@ struct SpellRadiusEntry
|
||||
|
||||
struct SpellRangeEntry
|
||||
{
|
||||
uint32 ID;
|
||||
float minRangeHostile;
|
||||
float minRangeFriend;
|
||||
float maxRangeHostile;
|
||||
float maxRangeFriend;
|
||||
uint32 type;
|
||||
//char const* Name[16]; // 7-23 unused
|
||||
// 24 string flags, unused
|
||||
//char const* Name2[16]; // 25-40 unused
|
||||
// 41 string flags, unused
|
||||
uint32 ID; // 0
|
||||
float RangeMin[2]; // 1-2 [0] Hostile [1] Friendly
|
||||
float RangeMax[2]; // 3-4 [0] Hostile [1] Friendly
|
||||
uint32 Flags; // 5
|
||||
// char const* DisplayName[16]; // 6-21
|
||||
// uint32 DisplayName_lang_mask; // 22
|
||||
// char const* DisplayNameShort[16]; // 23-38
|
||||
// uint32 DisplayNameShort_lang_mask; // 39
|
||||
};
|
||||
|
||||
struct SpellRuneCostEntry
|
||||
@@ -2180,7 +2176,7 @@ struct WorldStateUI
|
||||
// Structures not used for casting to loaded DBC data and not required then packing
|
||||
struct MapDifficulty
|
||||
{
|
||||
MapDifficulty() {}
|
||||
MapDifficulty() = default;
|
||||
MapDifficulty(uint32 _resetTime, uint32 _maxPlayers, bool _hasErrorMessage) : resetTime(_resetTime), maxPlayers(_maxPlayers), hasErrorMessage(_hasErrorMessage) {}
|
||||
|
||||
uint32 resetTime{0};
|
||||
@@ -2190,7 +2186,7 @@ struct MapDifficulty
|
||||
|
||||
struct TalentSpellPos
|
||||
{
|
||||
TalentSpellPos() {}
|
||||
TalentSpellPos() = default;
|
||||
TalentSpellPos(uint16 _talent_id, uint8 _rank) : talent_id(_talent_id), rank(_rank) {}
|
||||
|
||||
uint16 talent_id{0};
|
||||
@@ -2201,7 +2197,7 @@ typedef std::map<uint32, TalentSpellPos> TalentSpellPosMap;
|
||||
|
||||
struct TaxiPathBySourceAndDestination
|
||||
{
|
||||
TaxiPathBySourceAndDestination() {}
|
||||
TaxiPathBySourceAndDestination() = default;
|
||||
TaxiPathBySourceAndDestination(uint32 _id, uint32 _price) : ID(_id), price(_price) {}
|
||||
|
||||
uint32 ID{0};
|
||||
|
||||
Reference in New Issue
Block a user