From d1bb8afadda7e018ed7ececfafcdaf4f43b3a384 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Tue, 7 Feb 2012 17:53:42 +0100 Subject: Scripts/Commands Send Global GM message when reloading waypoint_data table like other reloads --- src/server/scripts/Commands/cs_reload.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 363f7645f6f..17c819f2f22 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -992,7 +992,7 @@ public: return true; } - static bool HandleReloadWpCommand(ChatHandler* /*handler*/, const char* args) + static bool HandleReloadWpCommand(ChatHandler* handler, const char* args) { if (*args != 'a') sLog->outString("Re-Loading Waypoints data from 'waypoints_data'"); @@ -1000,7 +1000,7 @@ public: sWaypointMgr->Load(); if (*args != 'a') - sLog->outString("DB Table 'waypoint_data' reloaded."); + handler->SendGlobalGMSysMessage("DB Table 'waypoint_data' reloaded."); return true; } -- cgit v1.2.3 From 93d199f04382fe3c7f6f08f59fd2ad058568679a Mon Sep 17 00:00:00 2001 From: Subv2112 Date: Fri, 3 Feb 2012 16:03:52 -0500 Subject: Core/Collision: Ported dynamic line of sight patch by Silverice from MaNGOS and added lots of improvements Please re-extract vmaps --- src/server/authserver/Server/RealmSocket.h | 1 + src/server/collision/BoundingIntervalHierarchy.h | 22 +- .../collision/BoundingIntervalHierarchyWrapper.h | 109 ++++++ src/server/collision/CMakeLists.txt | 27 ++ src/server/collision/DynamicTree.cpp | 206 +++++++++++ src/server/collision/DynamicTree.h | 60 ++++ src/server/collision/Maps/TileAssembler.cpp | 388 +++++++++++---------- src/server/collision/Maps/TileAssembler.h | 29 ++ src/server/collision/Models/GameObjectModel.cpp | 175 ++++++++++ src/server/collision/Models/GameObjectModel.h | 69 ++++ src/server/collision/Models/WorldModel.h | 2 +- src/server/collision/RegularGrid.h | 218 ++++++++++++ src/server/collision/VMapDefinitions.h | 4 +- .../game/Battlegrounds/Zones/BattlegroundDS.cpp | 12 +- .../game/Battlegrounds/Zones/BattlegroundDS.h | 4 +- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 28 +- .../game/Battlegrounds/Zones/BattlegroundRV.h | 9 +- src/server/game/CMakeLists.txt | 2 + src/server/game/DataStores/DBCStructure.h | 2 +- src/server/game/DataStores/DBCfmt.h | 2 +- src/server/game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 104 +++++- src/server/game/Entities/GameObject/GameObject.h | 10 +- src/server/game/Entities/Object/Object.cpp | 29 +- src/server/game/Entities/Transport/Transport.cpp | 2 +- src/server/game/Handlers/QueryHandler.cpp | 2 +- src/server/game/Maps/Map.cpp | 16 +- src/server/game/Maps/Map.h | 10 +- src/server/game/Movement/MotionMaster.cpp | 4 +- .../FleeingMovementGenerator.cpp | 6 +- .../MovementGenerators/RandomMovementGenerator.cpp | 8 +- src/server/game/Spells/Spell.cpp | 2 +- src/server/game/World/World.cpp | 5 + src/server/scripts/CMakeLists.txt | 2 + src/server/scripts/Commands/cs_debug.cpp | 8 + src/server/scripts/Commands/cs_gps.cpp | 4 +- .../BattleForMountHyjal/hyjal_trash.cpp | 4 +- .../IcecrownCitadel/boss_blood_prince_council.cpp | 4 +- .../IcecrownCitadel/boss_professor_putricide.cpp | 2 +- .../IcecrownCitadel/boss_the_lich_king.cpp | 2 +- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 2 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../Outland/BlackTemple/boss_teron_gorefiend.cpp | 2 +- src/server/worldserver/CMakeLists.txt | 2 + src/tools/vmap3_assembler/CMakeLists.txt | 1 + src/tools/vmap3_extractor/adtfile.cpp | 69 ++-- src/tools/vmap3_extractor/adtfile.h | 22 ++ src/tools/vmap3_extractor/dbcfile.cpp | 18 + src/tools/vmap3_extractor/dbcfile.h | 24 +- src/tools/vmap3_extractor/gameobject_extract.cpp | 99 ++++++ src/tools/vmap3_extractor/loadlib/loadlib.h | 20 +- src/tools/vmap3_extractor/model.cpp | 38 +- src/tools/vmap3_extractor/model.h | 29 +- src/tools/vmap3_extractor/modelheaders.h | 18 + src/tools/vmap3_extractor/mpq_libmpq04.h | 13 +- src/tools/vmap3_extractor/vmapexport.cpp | 236 +++++++------ src/tools/vmap3_extractor/vmapexport.h | 33 +- src/tools/vmap3_extractor/wdtfile.cpp | 18 + src/tools/vmap3_extractor/wmo.cpp | 20 +- src/tools/vmap3_extractor/wmo.h | 18 + 60 files changed, 1849 insertions(+), 430 deletions(-) create mode 100644 src/server/collision/BoundingIntervalHierarchyWrapper.h create mode 100644 src/server/collision/DynamicTree.cpp create mode 100644 src/server/collision/DynamicTree.h create mode 100644 src/server/collision/Models/GameObjectModel.cpp create mode 100644 src/server/collision/Models/GameObjectModel.h create mode 100644 src/server/collision/RegularGrid.h create mode 100644 src/tools/vmap3_extractor/gameobject_extract.cpp (limited to 'src/server/scripts/Commands') diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h index 9682b5e4559..9dbd0a4aafb 100755 --- a/src/server/authserver/Server/RealmSocket.h +++ b/src/server/authserver/Server/RealmSocket.h @@ -24,6 +24,7 @@ #include #include #include +#include "Common.h" class RealmSocket : public ACE_Svc_Handler { diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index b0c35237a9d..ea70fc3e322 100755 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -81,13 +81,25 @@ struct AABound class BIH { + private: + void init_empty() + { + tree.clear(); + objects.clear(); + // create space for the first node + tree.push_back(3 << 30); // dummy leaf + tree.insert(tree.end(), 2, 0); + } public: - BIH() {}; - template< class T, class BoundsFunc > - void build(const std::vector &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) + BIH() { init_empty(); } + template< class BoundsFunc, class PrimArray > + void build(const PrimArray &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) { - if (primitives.empty()) + if (primitives.size() == 0) + { + init_empty(); return; + } buildData dat; dat.maxPrims = leafSize; @@ -397,4 +409,4 @@ class BIH void subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats); }; -#endif // _BIH_H +#endif // _BIH_H \ No newline at end of file diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h new file mode 100644 index 00000000000..e54a4e653a1 --- /dev/null +++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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 along + * with this program. If not, see . + */ + +#ifndef _BIH_WRAP +#define _BIH_WRAP + +#include "G3D/Table.h" +#include "G3D/Array.h" +#include "G3D/Set.h" +#include "BoundingIntervalHierarchy.h" + + +template > +class BIHWrap +{ + template + struct MDLCallback + { + const T* const* objects; + RayCallback& _callback; + + MDLCallback(RayCallback& callback, const T* const* objects_array ) : _callback(callback), objects(objects_array){} + + bool operator() (const Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) + { + if (const T* obj = objects[Idx]) + return _callback(ray, *obj, MaxDist/*, stopAtFirst*/); + return false; + } + + void operator() (const Vector3& p, uint32 Idx) + { + if (const T* obj = objects[Idx]) + _callback(p, *obj); + } + }; + + typedef G3D::Array ObjArray; + + BIH m_tree; + ObjArray m_objects; + G3D::Table m_obj2Idx; + G3D::Set m_objects_to_push; + int unbalanced_times; + +public: + BIHWrap() : unbalanced_times(0) {} + + void insert(const T& obj) + { + ++unbalanced_times; + m_objects_to_push.insert(&obj); + } + + void remove(const T& obj) + { + ++unbalanced_times; + uint32 Idx = 0; + const T * temp; + if (m_obj2Idx.getRemove(&obj, temp, Idx)) + m_objects[Idx] = NULL; + else + m_objects_to_push.remove(&obj); + } + + void balance() + { + if (unbalanced_times == 0) + return; + + unbalanced_times = 0; + m_objects.fastClear(); + m_obj2Idx.getKeys(m_objects); + m_objects_to_push.getMembers(m_objects); + + m_tree.build(m_objects, BoundsFunc::getBounds2); + } + + template + void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& maxDist) const + { + MDLCallback temp_cb(intersectCallback, m_objects.getCArray()); + m_tree.intersectRay(ray, temp_cb, maxDist, true); + } + + template + void intersectPoint(const Vector3& point, IsectCallback& intersectCallback) const + { + MDLCallback callback(intersectCallback, m_objects.getCArray()); + m_tree.intersectPoint(point, callback); + } +}; + +#endif // _BIH_WRAP \ No newline at end of file diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt index e2e182626c7..9fc696ab19a 100644 --- a/src/server/collision/CMakeLists.txt +++ b/src/server/collision/CMakeLists.txt @@ -39,9 +39,36 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/shared/Database ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic + ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference ${CMAKE_SOURCE_DIR}/src/server/shared/Logging ${CMAKE_SOURCE_DIR}/src/server/shared/Threading + ${CMAKE_SOURCE_DIR}/src/server/shared/Packets + ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities + ${CMAKE_SOURCE_DIR}/src/server/shared/DataStores + ${CMAKE_SOURCE_DIR}/src/server/game/Addons ${CMAKE_SOURCE_DIR}/src/server/game/Conditions + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit + ${CMAKE_SOURCE_DIR}/src/server/game/Combat + ${CMAKE_SOURCE_DIR}/src/server/game/Loot + ${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous + ${CMAKE_SOURCE_DIR}/src/server/game/Grids + ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells + ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers + ${CMAKE_SOURCE_DIR}/src/server/game/Maps + ${CMAKE_SOURCE_DIR}/src/server/game/DataStores + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline + ${CMAKE_SOURCE_DIR}/src/server/game/Movement + ${CMAKE_SOURCE_DIR}/src/server/game/Server + ${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol + ${CMAKE_SOURCE_DIR}/src/server/game/World + ${CMAKE_SOURCE_DIR}/src/server/game/Spells + ${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Management ${CMAKE_CURRENT_SOURCE_DIR}/Maps diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp new file mode 100644 index 00000000000..1d6877d1209 --- /dev/null +++ b/src/server/collision/DynamicTree.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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 along + * with this program. If not, see . + */ + +#include "DynamicTree.h" +//#include "QuadTree.h" +//#include "RegularGrid.h" +#include "BoundingIntervalHierarchyWrapper.h" + +#include "Log.h" +#include "RegularGrid.h" +#include "Timer.h" +#include "GameObjectModel.h" +#include "ModelInstance.h" + +using VMAP::ModelInstance; +using G3D::Ray; + +template<> struct HashTrait< GameObjectModel>{ + static size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; } +}; + +template<> struct PositionTrait< GameObjectModel> { + static void getPosition(const GameObjectModel& g, Vector3& p) { p = g.getPosition(); } +}; + +template<> struct BoundsTrait< GameObjectModel> { + static void getBounds(const GameObjectModel& g, G3D::AABox& out) { out = g.getBounds();} + static void getBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->getBounds();} +}; + +static bool operator == (const GameObjectModel& mdl, const GameObjectModel& mdl2){ + return &mdl == &mdl2; +} + + +int valuesPerNode = 5, numMeanSplits = 3; + +int UNBALANCED_TIMES_LIMIT = 5; +int CHECK_TREE_PERIOD = 200; + +typedef RegularGrid2D > ParentTree; + +struct DynTreeImpl : public ParentTree/*, public Intersectable*/ +{ + typedef GameObjectModel Model; + typedef ParentTree base; + + DynTreeImpl() : + rebalance_timer(CHECK_TREE_PERIOD), + unbalanced_times(0) + { + } + + void insert(const Model& mdl) + { + base::insert(mdl); + ++unbalanced_times; + } + + void remove(const Model& mdl) + { + base::remove(mdl); + ++unbalanced_times; + } + + void balance() + { + base::balance(); + unbalanced_times = 0; + } + + void update(uint32 difftime) + { + if (!size()) + return; + + rebalance_timer.Update(difftime); + if (rebalance_timer.Passed()) + { + rebalance_timer.Reset(CHECK_TREE_PERIOD); + if (unbalanced_times > 0) + balance(); + } + } + + TimeTrackerSmall rebalance_timer; + int unbalanced_times; +}; + +DynamicMapTree::DynamicMapTree() : impl(*new DynTreeImpl()) +{ +} + +DynamicMapTree::~DynamicMapTree() +{ + delete &impl; +} + +void DynamicMapTree::insert(const GameObjectModel& mdl) +{ + impl.insert(mdl); +} + +void DynamicMapTree::remove(const GameObjectModel& mdl) +{ + impl.remove(mdl); +} + +bool DynamicMapTree::contains(const GameObjectModel& mdl) const +{ + return impl.contains(mdl); +} + +void DynamicMapTree::balance() +{ + impl.balance(); +} + +int DynamicMapTree::size() const +{ + return impl.size(); +} + +void DynamicMapTree::update(uint32 t_diff) +{ + impl.update(t_diff); +} + +struct DynamicTreeIntersectionCallback +{ + bool did_hit; + uint32 phase_mask; + DynamicTreeIntersectionCallback(uint32 phasemask) : did_hit(false), phase_mask(phasemask) {} + bool operator()(const Ray& r, const GameObjectModel& obj, float& distance) + { + did_hit = obj.intersectRay(r, distance, true, phase_mask); + return did_hit; + } + bool didHit() const { return did_hit;} +}; + +struct DynamicTreeIntersectionCallback_WithLogger +{ + bool did_hit; + uint32 phase_mask; + DynamicTreeIntersectionCallback_WithLogger(uint32 phasemask) : did_hit(false), phase_mask(phasemask) + { + sLog->outDebug(LOG_FILTER_MAPS, "Dynamic Intersection log"); + } + bool operator()(const Ray& r, const GameObjectModel& obj, float& distance) + { + sLog->outDebug(LOG_FILTER_MAPS, "testing intersection with %s", obj.name.c_str()); + bool hit = obj.intersectRay(r, distance, true, phase_mask); + if (hit) + { + did_hit = true; + sLog->outDebug(LOG_FILTER_MAPS, "result: intersects"); + } + return hit; + } + bool didHit() const { return did_hit;} +}; + +bool DynamicMapTree::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const +{ + Vector3 v1(x1,y1,z1), v2(x2,y2,z2); + + float maxDist = (v2 - v1).magnitude(); + + if (!G3D::fuzzyGt(maxDist, 0) ) + return true; + + Ray r(v1, (v2-v1) / maxDist); + DynamicTreeIntersectionCallback callback(phasemask); + impl.intersectRay(r, callback, maxDist, v2); + + return !callback.did_hit; +} + +float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const +{ + Vector3 v(x,y,z); + Ray r(v, Vector3(0,0,-1)); + DynamicTreeIntersectionCallback callback(phasemask); + impl.intersectZAllignedRay(r, callback, maxSearchDist); + + if (callback.didHit()) + return v.z - maxSearchDist; + else + return -G3D::inf(); +} \ No newline at end of file diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h new file mode 100644 index 00000000000..ab28641b6ad --- /dev/null +++ b/src/server/collision/DynamicTree.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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 along + * with this program. If not, see . + */ + + +#ifndef _DYNTREE_H +#define _DYNTREE_H + +#include +#include +#include +#include + +//#include "ModelInstance.h" +#include "Define.h" +//#include "GameObjectModel.h" + +namespace G3D +{ + class Vector3; +} + +using G3D::Vector3; +class GameObjectModel; + +class DynamicMapTree +{ + struct DynTreeImpl& impl; +public: + + DynamicMapTree(); + ~DynamicMapTree(); + + bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; + float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const; + + void insert(const GameObjectModel&); + void remove(const GameObjectModel&); + bool contains(const GameObjectModel&) const; + int size() const; + + void balance(); + void update(uint32 diff); +}; + +#endif // _DYNTREE_H diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 355ef6b1944..62968e4dedd 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "WorldModel.h" #include "TileAssembler.h" #include "MapTree.h" #include "BoundingIntervalHierarchy.h" @@ -71,7 +70,6 @@ namespace VMAP bool TileAssembler::convertWorld2() { - std::set spawnedModelFiles; bool success = readMapSpawns(); if (!success) return false; @@ -178,6 +176,8 @@ namespace VMAP // break; //test, extract only first map; TODO: remvoe this line } + // add an object models, listed in temp_gameobject_models file + exportGameobjectModels(); // export objects std::cout << "\nConverting Model Files" << std::endl; for (std::set::iterator mfile = spawnedModelFiles.begin(); mfile != spawnedModelFiles.end(); ++mfile) @@ -251,99 +251,40 @@ namespace VMAP modelPosition.iScale = spawn.iScale; modelPosition.init(); - FILE* rf = fopen(modelFilename.c_str(), "rb"); - if (!rf) - { - printf("ERROR: Can't open model file: %s\n", modelFilename.c_str()); + WorldModel_Raw raw_model; + if (!raw_model.Read(modelFilename.c_str())) return false; - } + uint32 groups = raw_model.groupsArray.size(); + if (groups != 1) + printf("Warning: '%s' does not seem to be a M2 model!\n", modelFilename.c_str()); + AABox modelBound; bool boundEmpty=true; - char ident[8]; - - int readOperation = 1; - - // temporary use defines to simplify read/check code (close file and return at fail) - #define READ_OR_RETURN(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++; - // only use this for array deletes - #define READ_OR_RETURN_WITH_DELETE(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }readOperation++; - - #define CMP_OR_RETURN(V, S) if (strcmp((V), (S)) != 0) { \ - fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); } - - READ_OR_RETURN(&ident, 8); - CMP_OR_RETURN(ident, "VMAP003"); - - // we have to read one int. This is needed during the export and we have to skip it here - uint32 tempNVectors; - READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); - - uint32 groups, wmoRootId; - char blockId[5]; - blockId[4] = 0; - int blocksize; - float *vectorarray = 0; - - READ_OR_RETURN(&groups, sizeof(uint32)); - READ_OR_RETURN(&wmoRootId, sizeof(uint32)); - if (groups != 1) printf("Warning: '%s' does not seem to be a M2 model!\n", modelFilename.c_str()); for (uint32 g=0; g& vertices = raw_model.groupsArray[g].vertexArray; - if (nvectors >0) - { - vectorarray = new float[nvectors*3]; - READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3); - } - else + if (vertices.empty()) { std::cout << "error: model '" << spawn.name << "' has no geometry!" << std::endl; - fclose(rf); - return false; + continue; } - for (uint32 i=0, indexNo=0; indexNo0) filename.push_back('/'); filename.append(pModelFilename); - FILE* rf = fopen(filename.c_str(), "rb"); - if (!rf) - { - printf("ERROR: Can't open model file in form: %s", pModelFilename.c_str()); - printf("... or form: %s", filename.c_str() ); + WorldModel_Raw raw_model; + if (!raw_model.Read(filename.c_str())) return false; + + // write WorldModel + WorldModel model; + model.setRootWmoID(raw_model.RootWMOID); + if (raw_model.groupsArray.size()) + { + std::vector groupsArray; + + uint32 groups = raw_model.groupsArray.size(); + for (uint32 g = 0; g < groups; ++g) + { + GroupModel_Raw& raw_group = raw_model.groupsArray[g]; + groupsArray.push_back(GroupModel(raw_group.mogpflags, raw_group.GroupWMOID, raw_group.bounds )); + groupsArray.back().setMeshData(raw_group.vertexArray, raw_group.triangles); + groupsArray.back().setLiquidData(raw_group.liquid); + } + + model.setGroupModels(groupsArray); } + + success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo"); + //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; + return success; + } + + void TileAssembler::exportGameobjectModels() + { + FILE* model_list = fopen((iSrcDir + "/" + GAMEOBJECT_MODELS).c_str(), "rb"); + FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb"); + if (!model_list || !model_list_copy) + return; + + uint32 name_length, displayId; + char buff[500]; + while (!feof(model_list)) + { + fread(&displayId,sizeof(uint32),1,model_list); + fread(&name_length,sizeof(uint32),1,model_list); - char ident[8]; + if (name_length >= sizeof(buff)) + { + std::cout << "\nFile 'temp_gameobject_models' seems to be corrupted" << std::endl; + break; + } + + fread(&buff,sizeof(char),name_length,model_list); + std::string model_name(buff, name_length); + + WorldModel_Raw raw_model; + if ( !raw_model.Read((iSrcDir + "/" + model_name).c_str()) ) + continue; - int readOperation = 1; + spawnedModelFiles.insert(model_name); + AABox bounds; + bool boundEmpty = true; + for (uint32 g = 0; g < raw_model.groupsArray.size(); ++g) + { + std::vector& vertices = raw_model.groupsArray[g].vertexArray; + + uint32 nvectors = vertices.size(); + for (uint32 i = 0; i < nvectors; ++i) + { + Vector3& v = vertices[i]; + if (boundEmpty) + bounds = AABox(v, v), boundEmpty = false; + else + bounds.merge(v); + } + } + + fwrite(&displayId,sizeof(uint32),1,model_list_copy); + fwrite(&name_length,sizeof(uint32),1,model_list_copy); + fwrite(&buff,sizeof(char),name_length,model_list_copy); + fwrite(&bounds.low(),sizeof(Vector3),1,model_list_copy); + fwrite(&bounds.high(),sizeof(Vector3),1,model_list_copy); + } + fclose(model_list); + fclose(model_list_copy); + } // temporary use defines to simplify read/check code (close file and return at fail) #define READ_OR_RETURN(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++; + fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); } #define READ_OR_RETURN_WITH_DELETE(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }readOperation++; + fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }; #define CMP_OR_RETURN(V, S) if (strcmp((V), (S)) != 0) { \ fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); } - READ_OR_RETURN(&ident, 8); - CMP_OR_RETURN(ident, "VMAP003"); - - // we have to read one int. This is needed during the export and we have to skip it here - uint32 tempNVectors; - READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); - - uint32 groups; - uint32 RootWMOID; + bool GroupModel_Raw::Read(FILE* rf) + { char blockId[5]; blockId[4] = 0; int blocksize; - - READ_OR_RETURN(&groups, sizeof(uint32)); - READ_OR_RETURN(&RootWMOID, sizeof(uint32)); - - std::vector groupsArray; - - for (uint32 g=0; g triangles; - std::vector vertexArray; + uint32 indexes; + // indexes for each branch (not used jet) + READ_OR_RETURN(&indexes, sizeof(uint32)); + } - uint32 mogpflags, GroupWMOID; - READ_OR_RETURN(&mogpflags, sizeof(uint32)); - READ_OR_RETURN(&GroupWMOID, sizeof(uint32)); + // ---- indexes + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "INDX"); + READ_OR_RETURN(&blocksize, sizeof(int)); + uint32 nindexes; + READ_OR_RETURN(&nindexes, sizeof(uint32)); + if (nindexes >0) + { + uint16 *indexarray = new uint16[nindexes]; + READ_OR_RETURN_WITH_DELETE(indexarray, nindexes*sizeof(uint16)); + triangles.reserve(nindexes / 3); + for (uint32 i=0; i0) - { - uint16 *indexarray = new uint16[nindexes]; - READ_OR_RETURN_WITH_DELETE(indexarray, nindexes*sizeof(uint16)); - for (uint32 i=0; i0) + { + float *vectorarray = new float[nvectors*3]; + READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3); + for (uint32 i=0; iGetHeightStorage(), size*sizeof(float)); + size = hlq.xtiles*hlq.ytiles; + READ_OR_RETURN(liquid->GetFlagsStorage(), size); + } + + return true; + } - if (nvectors >0) - { - float *vectorarray = new float[nvectors*3]; - READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3); - for (uint32 i=0; iGetHeightStorage(), size*sizeof(float)); - size = hlq.xtiles*hlq.ytiles; - READ_OR_RETURN(liquid->GetFlagsStorage(), size); - } - groupsArray.push_back(GroupModel(mogpflags, GroupWMOID, AABox(Vector3(bbox1), Vector3(bbox2)))); - groupsArray.back().setMeshData(vertexArray, triangles); - groupsArray.back().setLiquidData(liquid); + GroupModel_Raw::~GroupModel_Raw() + { + delete liquid; + } + + bool WorldModel_Raw::Read(const char * path) + { + FILE* rf = fopen(path, "rb"); + if (!rf) + { + printf("ERROR: Can't open raw model file: %s\n", path); + return false; + } + + char ident[8]; + int readOperation = 0; - // drop of temporary use defines - #undef READ_OR_RETURN - #undef READ_OR_RETURN_WITH_DELETE - #undef CMP_OR_RETURN + READ_OR_RETURN(&ident, 8); + CMP_OR_RETURN(ident, RAW_VMAP_MAGIC); - } - fclose(rf); + // we have to read one int. This is needed during the export and we have to skip it here + uint32 tempNVectors; + READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); - // write WorldModel - WorldModel model; - model.setRootWmoID(RootWMOID); - if (!groupsArray.empty()) - { - model.setGroupModels(groupsArray); + uint32 groups; + READ_OR_RETURN(&groups, sizeof(uint32)); + READ_OR_RETURN(&RootWMOID, sizeof(uint32)); - std::string worldModelFileName(iDestDir); - worldModelFileName.push_back('/'); - worldModelFileName.append(pModelFilename).append(".vmo"); - success = model.writeFile(worldModelFileName); - } + groupsArray.resize(groups); + bool succeed = true; + for (uint32 g = 0; g < groups && succeed; ++g) + succeed = groupsArray[g].Read(rf); - //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; - return success; + fclose(rf); + return succeed; } + + // drop of temporary use defines + #undef READ_OR_RETURN + #undef CMP_OR_RETURN } diff --git a/src/server/collision/Maps/TileAssembler.h b/src/server/collision/Maps/TileAssembler.h index 6128a0d2a53..554940a4663 100755 --- a/src/server/collision/Maps/TileAssembler.h +++ b/src/server/collision/Maps/TileAssembler.h @@ -22,8 +22,10 @@ #include #include #include +#include #include "ModelInstance.h" +#include "WorldModel.h" namespace VMAP { @@ -61,6 +63,31 @@ namespace VMAP typedef std::map MapData; //=============================================== + struct GroupModel_Raw + { + uint32 mogpflags; + uint32 GroupWMOID; + + G3D::AABox bounds; + uint32 liquidflags; + std::vector triangles; + std::vector vertexArray; + class WmoLiquid *liquid; + + GroupModel_Raw() : liquid(0) {} + ~GroupModel_Raw(); + + bool Read(FILE * f); + }; + + struct WorldModel_Raw + { + uint32 RootWMOID; + std::vector groupsArray; + + bool Read(const char * path); + }; + class TileAssembler { private: @@ -70,6 +97,7 @@ namespace VMAP G3D::Table iUniqueNameIds; unsigned int iCurrentUniqueNameId; MapData mapData; + std::set spawnedModelFiles; public: TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName); @@ -78,6 +106,7 @@ namespace VMAP bool convertWorld2(); bool readMapSpawns(); bool calculateTransformedBound(ModelSpawn &spawn); + void exportGameobjectModels(); bool convertRawFile(const std::string& pModelFilename); void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; } diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp new file mode 100644 index 00000000000..5ad984fcb4b --- /dev/null +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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 along + * with this program. If not, see . + */ + +#include "VMapFactory.h" +#include "VMapManager2.h" +#include "VMapDefinitions.h" +#include "WorldModel.h" + +#include "GameObjectModel.h" +#include "Log.h" +#include "GameObject.h" +#include "Creature.h" +#include "TemporarySummon.h" +#include "Object.h" +#include "DBCStores.h" + +using G3D::Vector3; +using G3D::Ray; +using G3D::AABox; + +struct GameobjectModelData +{ + GameobjectModelData(const std::string& name_, const AABox& box) : + name(name_), bound(box) {} + + AABox bound; + std::string name; +}; + +typedef UNORDERED_MAP ModelList; +ModelList model_list; + +void LoadGameObjectModelList() +{ + FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb"); + if (!model_list_file) + return; + + uint32 name_length, displayId; + char buff[500]; + while (!feof(model_list_file)) + { + fread(&displayId,sizeof(uint32),1,model_list_file); + fread(&name_length,sizeof(uint32),1,model_list_file); + + if (name_length >= sizeof(buff)) + { + printf("\nFile '%s' seems to be corrupted", VMAP::GAMEOBJECT_MODELS); + break; + } + + fread(&buff, sizeof(char), name_length,model_list_file); + Vector3 v1, v2; + fread(&v1, sizeof(Vector3), 1, model_list_file); + fread(&v2, sizeof(Vector3), 1, model_list_file); + + model_list.insert + ( + ModelList::value_type( displayId, GameobjectModelData(std::string(buff,name_length),AABox(v1,v2)) ) + ); + } + fclose(model_list_file); +} + +GameObjectModel::~GameObjectModel() +{ + if (iModel) + ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->releaseModelInstance(name); +} + +bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info) +{ + ModelList::const_iterator it = model_list.find(info.Displayid); + if (it == model_list.end()) + return false; + + G3D::AABox mdl_box(it->second.bound); + // ignore models with no bounds + if (mdl_box == G3D::AABox::zero()) + { + std::cout << "Model " << it->second.name << " has zero bounds, loading skipped" << std::endl; + return false; + } + + iModel = ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->acquireModelInstance(sWorld->GetDataPath() + "vmaps/", it->second.name); + + if (!iModel) + return false; + + name = it->second.name; + //flags = VMAP::MOD_M2; + //adtId = 0; + //ID = 0; + iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ()); + phasemask = go.GetPhaseMask(); + iScale = go.GetFloatValue(OBJECT_FIELD_SCALE_X); + iInvScale = 1.f / iScale; + + G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(go.GetOrientation(), 0, 0); + iInvRot = iRotation.inverse(); + // transform bounding box: + mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale); + AABox rotated_bounds; + for (int i = 0; i < 8; ++i) + rotated_bounds.merge(iRotation * mdl_box.corner(i)); + + this->iBound = rotated_bounds + iPos; +#ifdef SPAWN_CORNERS + // test: + for (int i = 0; i < 8; ++i) + { + Vector3 pos(iBound.corner(i)); + if (Creature* c = const_cast(go).SummonCreature(24440, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN)) + { + c->setFaction(35); + c->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.1f); + } + } +#endif + + return true; +} + +GameObjectModel* GameObjectModel::Create(const GameObject& go) +{ + const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(go.GetGOInfo()->displayId); + if (!info) + return NULL; + + GameObjectModel* mdl = new GameObjectModel(); + if (!mdl->initialize(go, *info)) + { + delete mdl; + return NULL; + } + + return mdl; +} + +bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const +{ + if (!(phasemask & ph_mask)) + return false; + + float time = ray.intersectionTime(iBound); + if (time == G3D::inf()) + return false; + + // child bounds are defined in object space: + Vector3 p = iInvRot * (ray.origin() - iPos) * iInvScale; + Ray modRay(p, iInvRot * ray.direction()); + float distance = MaxDist * iInvScale; + bool hit = iModel->IntersectRay(modRay, distance, StopAtFirstHit); + if(hit) + { + distance *= iScale; + MaxDist = distance; + } + return hit; +} \ No newline at end of file diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h new file mode 100644 index 00000000000..413061c0de0 --- /dev/null +++ b/src/server/collision/Models/GameObjectModel.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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 along + * with this program. If not, see . + */ + +#ifndef _GAMEOBJECT_MODEL_H +#define _GAMEOBJECT_MODEL_H + +#include +#include +#include +#include + +#include "Define.h" + +namespace VMAP +{ + class WorldModel; +} + +class GameObject; +struct GameObjectDisplayInfoEntry; + +class GameObjectModel /*, public Intersectable*/ +{ + uint32 phasemask; + G3D::AABox iBound; + G3D::Matrix3 iInvRot; + G3D::Vector3 iPos; + //G3D::Vector3 iRot; + float iInvScale; + float iScale; + VMAP::WorldModel* iModel; + + GameObjectModel() : phasemask(0), iModel(NULL) {} + bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info); + +public: + std::string name; + + const G3D::AABox& getBounds() const { return iBound; } + + ~GameObjectModel(); + + const G3D::Vector3& getPosition() const { return iPos;} + + /** Enables\disables collision. */ + void disable() { phasemask = 0;} + void enable(uint32 ph_mask) { phasemask = ph_mask;} + + bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const; + + static GameObjectModel* Create(const GameObject& go); +}; + +#endif // _GAMEOBJECT_MODEL_H \ No newline at end of file diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h index 52ecf498700..ebf828e4935 100755 --- a/src/server/collision/Models/WorldModel.h +++ b/src/server/collision/Models/WorldModel.h @@ -80,7 +80,7 @@ namespace VMAP //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! void setMeshData(std::vector &vert, std::vector &tri); - void setLiquidData(WmoLiquid* liquid) { iLiquid = liquid; } + void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = NULL; } bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const; bool IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const; bool GetLiquidLevel(const Vector3 &pos, float &liqHeight) const; diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h new file mode 100644 index 00000000000..be61504bc65 --- /dev/null +++ b/src/server/collision/RegularGrid.h @@ -0,0 +1,218 @@ +#ifndef _REGULAR_GRID_H +#define _REGULAR_GRID_H + + +#include +#include +#include +#include +#include + +#include "Errors.h" + +using G3D::Vector2; +using G3D::Vector3; +using G3D::AABox; +using G3D::Ray; + +template +struct NodeCreator{ + static Node * makeNode(int x, int y) { return new Node();} +}; + +template, + /*class BoundsFunc = BoundsTrait,*/ +class PositionFunc = PositionTrait +> +class RegularGrid2D +{ +public: + + enum{ + CELL_NUMBER = 64, + }; + + #define HGRID_MAP_SIZE (533.33333f * 64.f) // shouldn't be changed + #define CELL_SIZE float(HGRID_MAP_SIZE/(float)CELL_NUMBER) + + typedef G3D::Table MemberTable; + + MemberTable memberTable; + Node* nodes[CELL_NUMBER][CELL_NUMBER]; + + RegularGrid2D(){ + memset(nodes, 0, sizeof(nodes)); + } + + ~RegularGrid2D(){ + for (int x = 0; x < CELL_NUMBER; ++x) + for (int y = 0; y < CELL_NUMBER; ++y) + delete nodes[x][y]; + } + + void insert(const T& value) + { + Vector3 pos; + PositionFunc::getPosition(value, pos); + Node& node = getGridFor(pos.x, pos.y); + node.insert(value); + memberTable.set(&value, &node); + } + + void remove(const T& value) + { + memberTable[&value]->remove(value); + // Remove the member + memberTable.remove(&value); + } + + void balance() + { + for (int x = 0; x < CELL_NUMBER; ++x) + for (int y = 0; y < CELL_NUMBER; ++y) + if (Node* n = nodes[x][y]) + n->balance(); + } + + bool contains(const T& value) const { return memberTable.containsKey(&value); } + int size() const { return memberTable.size(); } + + struct Cell + { + int x, y; + bool operator == (const Cell& c2) const { return x == c2.x && y == c2.y;} + + static Cell ComputeCell(float fx, float fy) + { + Cell c = {fx * (1.f/CELL_SIZE) + (CELL_NUMBER/2), fy * (1.f/CELL_SIZE) + (CELL_NUMBER/2)}; + return c; + } + + bool isValid() const { return x >= 0 && x < CELL_NUMBER && y >= 0 && y < CELL_NUMBER;} + }; + + + Node& getGridFor(float fx, float fy) + { + Cell c = Cell::ComputeCell(fx, fy); + return getGrid(c.x, c.y); + } + + Node& getGrid(int x, int y) + { + ASSERT(x < CELL_NUMBER && y < CELL_NUMBER); + if (!nodes[x][y]) + nodes[x][y] = NodeCreatorFunc::makeNode(x,y); + return *nodes[x][y]; + } + + template + void intersectRay(const Ray& ray, RayCallback& intersectCallback, float max_dist) + { + intersectRay(ray, intersectCallback, max_dist, ray.origin() + ray.direction() * max_dist); + } + + template + void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist, const Vector3& end) + { + Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y); + if (!cell.isValid()) + return; + + Cell last_cell = Cell::ComputeCell(end.x, end.y); + + if (cell == last_cell) + { + if (Node* node = nodes[cell.x][cell.y]) + node->intersectRay(ray, intersectCallback, max_dist); + return; + } + + float voxel = (float)CELL_SIZE; + float kx_inv = ray.invDirection().x, bx = ray.origin().x; + float ky_inv = ray.invDirection().y, by = ray.origin().y; + + int stepX, stepY; + float tMaxX, tMaxY; + if (kx_inv >= 0) + { + stepX = 1; + float x_border = (cell.x+1) * voxel; + tMaxX = (x_border - bx) * kx_inv; + } + else + { + stepX = -1; + float x_border = (cell.x-1) * voxel; + tMaxX = (x_border - bx) * kx_inv; + } + + if (ky_inv >= 0) + { + stepY = 1; + float y_border = (cell.y+1) * voxel; + tMaxY = (y_border - by) * ky_inv; + } + else + { + stepY = -1; + float y_border = (cell.y-1) * voxel; + tMaxY = (y_border - by) * ky_inv; + } + + //int Cycles = std::max((int)ceilf(max_dist/tMaxX),(int)ceilf(max_dist/tMaxY)); + //int i = 0; + + float tDeltaX = voxel * fabs(kx_inv); + float tDeltaY = voxel * fabs(ky_inv); + do + { + if (Node* node = nodes[cell.x][cell.y]) + { + //float enterdist = max_dist; + node->intersectRay(ray, intersectCallback, max_dist); + } + if (cell == last_cell) + break; + if(tMaxX < tMaxY) + { + tMaxX += tDeltaX; + cell.x += stepX; + } + else + { + tMaxY += tDeltaY; + cell.y += stepY; + } + //++i; + } while (cell.isValid()); + } + + template + void intersectPoint(const Vector3& point, IsectCallback& intersectCallback) + { + Cell cell = Cell::ComputeCell(point.x, point.y); + if (!cell.isValid()) + return; + if (Node* node = nodes[cell.x][cell.y]) + node->intersectPoint(point, intersectCallback); + } + + // Optimized verson of intersectRay function for rays with vertical directions + template + void intersectZAllignedRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist) + { + Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y); + if (!cell.isValid()) + return; + if (Node* node = nodes[cell.x][cell.y]) + node->intersectRay(ray, intersectCallback, max_dist); + } +}; + +#undef CELL_SIZE +#undef HGRID_MAP_SIZE + +#endif \ No newline at end of file diff --git a/src/server/collision/VMapDefinitions.h b/src/server/collision/VMapDefinitions.h index f7d6f0ddaa1..72a62807b4c 100644 --- a/src/server/collision/VMapDefinitions.h +++ b/src/server/collision/VMapDefinitions.h @@ -24,7 +24,9 @@ namespace VMAP { - const char VMAP_MAGIC[] = "VMAP_3.0"; + const char VMAP_MAGIC[] = "VMAP_4.0"; + const char RAW_VMAP_MAGIC[] = "VMAP004"; // used in extracted vmap files with raw data + const char GAMEOBJECT_MODELS[] = "temp_gameobject_models"; // defined in TileAssembler.cpp currently... bool readChunk(FILE* rf, char *dest, const char *compare, uint32 len); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 87f4ca48378..0a168491996 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -51,15 +51,19 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) if (isWaterFallActive()) { setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); - for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) - SpawnBGObject(i, getWaterFallTimer()); + SpawnBGObject(BG_DS_OBJECT_WATER_2, getWaterFallTimer()); + // turn off collision + if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) + gob->EnableCollision(false); setWaterFallActive(false); } else { setWaterFallTimer(BG_DS_WATERFALL_DURATION); - for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) - SpawnBGObject(i, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY); + // Turn on collision + if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) + gob->EnableCollision(true); setWaterFallActive(true); } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index f2ba2cea1e7..1ec465864d5 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -25,7 +25,7 @@ enum BattlegroundDSObjectTypes { BG_DS_OBJECT_DOOR_1 = 0, BG_DS_OBJECT_DOOR_2 = 1, - BG_DS_OBJECT_WATER_1 = 2, + BG_DS_OBJECT_WATER_1 = 2, // Collision BG_DS_OBJECT_WATER_2 = 3, BG_DS_OBJECT_BUFF_1 = 4, BG_DS_OBJECT_BUFF_2 = 5, @@ -36,7 +36,7 @@ enum BattlegroundDSObjects { BG_DS_OBJECT_TYPE_DOOR_1 = 192642, BG_DS_OBJECT_TYPE_DOOR_2 = 192643, - BG_DS_OBJECT_TYPE_WATER_1 = 194395, + BG_DS_OBJECT_TYPE_WATER_1 = 194395, // Collision BG_DS_OBJECT_TYPE_WATER_2 = 191877, BG_DS_OBJECT_TYPE_BUFF_1 = 184663, BG_DS_OBJECT_TYPE_BUFF_2 = 184664 diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 539419d6c50..ac3ee2642f4 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -63,6 +63,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) case BG_RV_STATE_OPEN_PILARS: for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) DoorOpen(i); + TogglePillarCollision(false); setTimer(BG_RV_PILAR_TO_FIRE_TIMER); setState(BG_RV_STATE_OPEN_FIRE); break; @@ -76,6 +77,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) case BG_RV_STATE_CLOSE_PILARS: for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) DoorOpen(i); + TogglePillarCollision(true); setTimer(BG_RV_PILAR_TO_FIRE_TIMER); setState(BG_RV_STATE_CLOSE_FIRE); break; @@ -207,13 +209,13 @@ bool BattlegroundRV::SetupBattleground() || !AddObject(BG_RV_OBJECT_PILAR_2, BG_RV_OBJECT_TYPE_PILAR_2, 723.644287f, -284.493256f, 24.648525f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_3, BG_RV_OBJECT_TYPE_PILAR_3, 763.611145f, -261.856750f, 25.909504f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_TYPE_PILAR_4, 802.211609f, -284.493256f, 24.648525f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) -/* - // Pilars Collision - Fixme: Use the collision pilars - should make u break LoS + + // Pilars Collision || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_1, BG_RV_OBJECT_TYPE_PILAR_COLLISION_1, 763.632385f, -306.162384f, 30.639660f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_2, BG_RV_OBJECT_TYPE_PILAR_COLLISION_2, 723.644287f, -284.493256f, 32.382710f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_3, BG_RV_OBJECT_TYPE_PILAR_COLLISION_3, 763.611145f, -261.856750f, 30.639660f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_4, BG_RV_OBJECT_TYPE_PILAR_COLLISION_4, 802.211609f, -284.493256f, 32.382710f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY) -*/ + ) { sLog->outErrorDb("BatteGroundRV: Failed to spawn some object!"); @@ -221,3 +223,23 @@ bool BattlegroundRV::SetupBattleground() } return true; } + + +void BattlegroundRV::TogglePillarCollision(bool apply) +{ + for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i) + { + if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[i])) + { + bool startOpen = (gob->GetGoType() == GAMEOBJECT_TYPE_DOOR || gob->GetGoType() == GAMEOBJECT_TYPE_BUTTON ? gob->GetGOInfo()->door.startOpen : false); + if (startOpen) + gob->EnableCollision(!apply); + else + gob->EnableCollision(apply); + + for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) + gob->SendUpdateToPlayer(player); + } + } +} \ No newline at end of file diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 4f99af268db..1dfd4825c8f 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -38,12 +38,12 @@ enum BattlegroundRVObjectTypes BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_PULLEY_1, BG_RV_OBJECT_PULLEY_2, -/* + BG_RV_OBJECT_PILAR_COLLISION_1, BG_RV_OBJECT_PILAR_COLLISION_2, BG_RV_OBJECT_PILAR_COLLISION_3, BG_RV_OBJECT_PILAR_COLLISION_4, -*/ + BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_ELEVATOR_2, BG_RV_OBJECT_MAX, @@ -64,12 +64,12 @@ enum BattlegroundRVObjects BG_RV_OBJECT_TYPE_GEAR_2 = 192394, BG_RV_OBJECT_TYPE_ELEVATOR_1 = 194582, BG_RV_OBJECT_TYPE_ELEVATOR_2 = 194586, -/* + BG_RV_OBJECT_TYPE_PILAR_COLLISION_1 = 194580, // axe BG_RV_OBJECT_TYPE_PILAR_COLLISION_2 = 194579, // arena BG_RV_OBJECT_TYPE_PILAR_COLLISION_3 = 194581, // lightning BG_RV_OBJECT_TYPE_PILAR_COLLISION_4 = 194578, // ivory -*/ + BG_RV_OBJECT_TYPE_PILAR_1 = 194583, // axe BG_RV_OBJECT_TYPE_PILAR_2 = 194584, // arena BG_RV_OBJECT_TYPE_PILAR_3 = 194585, // lightning @@ -129,5 +129,6 @@ class BattlegroundRV : public Battleground uint32 getState() { return State; }; void setState(uint32 state) { State = state; }; + void TogglePillarCollision(bool apply); }; #endif diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index ac1bb9e5cac..cf24c923655 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -110,6 +110,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/dep/zlib ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/collision/Models + ${CMAKE_SOURCE_DIR}/src/server/collision/Maps ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 15408ad03a9..adb7f0ac380 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -955,7 +955,7 @@ struct FactionTemplateEntry struct GameObjectDisplayInfoEntry { uint32 Displayid; // 0 m_ID - // char* filename; // 1 + char* filename; // 1 //uint32 unk1[10]; //2-11 float minX; float minY; diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index c55fb79d461..150159feb11 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -52,7 +52,7 @@ const char EmotesEntryfmt[]="nxxiiix"; const char EmotesTextEntryfmt[]="nxixxxxxxxxxxxxxxxx"; const char FactionEntryfmt[]="niiiiiiiiiiiiiiiiiiffixssssssssssssssssxxxxxxxxxxxxxxxxxx"; const char FactionTemplateEntryfmt[]="niiiiiiiiiiiii"; -const char GameObjectDisplayInfofmt[]="nxxxxxxxxxxxffffffx"; +const char GameObjectDisplayInfofmt[]="nsxxxxxxxxxxffffffx"; const char GemPropertiesEntryfmt[]="nixxi"; const char GlyphPropertiesfmt[]="niii"; const char GlyphSlotfmt[]="nii"; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 23865dd9e41..7f767ea81dc 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1289,7 +1289,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) m_deathState = DEAD; if (canFly()) { - float tz = map->GetHeight(data->posX, data->posY, data->posZ, false); + float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, false); if (data->posZ - tz > 0.1f) Relocate(data->posX, data->posY, tz); } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 3548ef3bc63..4abc6e80b1e 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -30,7 +30,10 @@ #include "CreatureAISelector.h" #include "Group.h" -GameObject::GameObject() : WorldObject(false), m_goValue(new GameObjectValue), m_AI(NULL) +#include "GameObjectModel.h" +#include "DynamicTree.h" + +GameObject::GameObject() : WorldObject(false), m_goValue(new GameObjectValue), m_AI(NULL), m_model(NULL) { m_objectType |= TYPEMASK_GAMEOBJECT; m_objectTypeId = TYPEID_GAMEOBJECT; @@ -62,6 +65,7 @@ GameObject::~GameObject() { delete m_goValue; delete m_AI; + delete m_model; //if (m_uint32Values) // field array can be not exist if GameOBject not loaded // CleanupsBeforeDelete(); } @@ -127,6 +131,11 @@ void GameObject::AddToWorld() m_zoneScript->OnGameObjectCreate(this); sObjectAccessor->AddObject(this); + bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); + if (m_model/* && (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? !GetGOInfo()->door.startOpen : true)*/) + GetMap()->Insert(*m_model); + if (startOpen) + EnableCollision(false); WorldObject::AddToWorld(); } } @@ -140,6 +149,9 @@ void GameObject::RemoveFromWorld() m_zoneScript->OnGameObjectRemove(this); RemoveFromOwner(); + if (m_model) + if (GetMap()->Contains(*m_model)) + GetMap()->Remove(*m_model); WorldObject::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } @@ -199,14 +211,16 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa // set name for logs usage, doesn't affect anything ingame SetName(goinfo->name); - SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); + SetDisplayId(goinfo->displayId); + m_model = GameObjectModel::Create(*this); // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 - SetGoState(go_state); SetGoType(GameobjectTypes(goinfo->type)); + SetGoState(go_state); SetGoArtKit(0); // unknown what this is SetByteValue(GAMEOBJECT_BYTES_1, 2, artKit); + switch (goinfo->type) { @@ -1779,7 +1793,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* { case GO_DESTRUCTIBLE_INTACT: RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_DESTROYED); - SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->displayId); + SetDisplayId(m_goInfo->displayId); if (setHealth) { m_goValue->Building.Health = m_goValue->Building.MaxHealth; @@ -1801,7 +1815,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData)) if (modelData->DamagedDisplayId) modelId = modelData->DamagedDisplayId; - SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); + SetDisplayId(modelId); if (setHealth) { @@ -1834,7 +1848,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData)) if (modelData->DestroyedDisplayId) modelId = modelData->DestroyedDisplayId; - SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); + SetDisplayId(modelId); if (setHealth) { @@ -1852,7 +1866,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData)) if (modelData->RebuildingDisplayId) modelId = modelData->RebuildingDisplayId; - SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); + SetDisplayId(modelId); // restores to full health if (setHealth) @@ -1865,8 +1879,78 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* } } -void GameObject::SetLootState(LootState s, Unit* unit) +void GameObject::SetLootState(LootState state, Unit* unit) { - m_lootState = s; - AI()->OnStateChanged(s, unit); + m_lootState = state; + AI()->OnStateChanged(state, unit); + if (m_model) + { + // startOpen determines whether we are going to add or remove the LoS on activation + bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); + + if (GetGOData()->go_state == GO_NOT_READY) + startOpen = !startOpen; + + if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED) + EnableCollision(startOpen); + else if (state == GO_READY) + EnableCollision(!startOpen); + } } + +void GameObject::SetGoState(GOState state) +{ + SetByteValue(GAMEOBJECT_BYTES_1, 0, state); + if (m_model) + { + if (!IsInWorld()) + return; + + // startOpen determines whether we are going to add or remove the LoS on activation + bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); + + if (GetGOData()->go_state == GO_NOT_READY) + startOpen = !startOpen; + + if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE) + EnableCollision(startOpen); + else if (state == GO_STATE_READY) + EnableCollision(!startOpen); + } +} + +void GameObject::SetDisplayId(uint32 displayid) +{ + SetUInt32Value(GAMEOBJECT_DISPLAYID, displayid); + UpdateModel(); +} + +void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update) +{ + WorldObject::SetPhaseMask(newPhaseMask, update); + EnableCollision(true); +} + +void GameObject::EnableCollision(bool enable) +{ + if (!m_model) + return; + + /*if (enable && !GetMap()->Contains(*m_model)) + GetMap()->Insert(*m_model);*/ + + m_model->enable(enable ? GetPhaseMask() : 0); +} + +void GameObject::UpdateModel() +{ + if (!IsInWorld()) + return; + if (m_model) + if (GetMap()->Contains(*m_model)) + GetMap()->Remove(*m_model); + delete m_model; + m_model = GameObjectModel::Create(*this); + if (m_model) + GetMap()->Insert(*m_model); +} \ No newline at end of file diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index f677d481c33..a4635ca6dfb 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -609,6 +609,7 @@ enum LootState }; class Unit; +class GameObjectModel; // 5 sec for bobber catch #define FISHING_BOBBER_READY_TIME 5 @@ -703,12 +704,15 @@ class GameObject : public WorldObject, public GridObject GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); } void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); } - void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); } + void SetGoState(GOState state); uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); } void SetGoArtKit(uint8 artkit); uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0); + + void SetPhaseMask(uint32 newPhaseMask, bool update); + void EnableCollision(bool enable); void Use(Unit* user); @@ -790,6 +794,9 @@ class GameObject : public WorldObject, public GridObject GameObjectAI* AI() const { return m_AI; } std::string GetAIName() const; + void SetDisplayId(uint32 displayid); + + GameObjectModel * m_model; protected: bool AIM_Initialize(); uint32 m_spellId; @@ -819,6 +826,7 @@ class GameObject : public WorldObject, public GridObject private: void RemoveFromOwner(); void SwitchDoorOrButton(bool activate, bool alternative = false); + void UpdateModel(); // updates model in case displayId were changed //! Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size. bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/) const diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 732171da67a..7113fe8efb5 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -46,6 +46,7 @@ #include "Totem.h" #include "OutdoorPvPMgr.h" #include "MovementPacketBuilder.h" +#include "DynamicTree.h" uint32 GuidHigh2TypeId(uint32 guid_hi) { @@ -1300,15 +1301,19 @@ bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const float ox, oy, oz; obj->GetPosition(ox, oy, oz); - return(IsWithinLOS(ox, oy, oz)); + return IsWithinLOS(ox, oy, oz); } bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const { - float x, y, z; + /*float x, y, z; GetPosition(x, y, z); VMAP::IVMapManager* vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); - return vMapManager->isInLineOfSight(GetMapId(), x, y, z+2.0f, ox, oy, oz+2.0f); + return vMapManager->isInLineOfSight(GetMapId(), x, y, z+2.0f, ox, oy, oz+2.0f);*/ + if (IsInWorld()) + return GetMap()->isInLineOfSight(GetPositionX(), GetPositionY(), GetPositionZ()+2.f, ox, oy, oz+2.f, GetPhaseMask()); + + return true; } bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D /* = true */) const @@ -1530,7 +1535,7 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const { - float new_z = GetBaseMap()->GetHeight(x, y, z, true); + float new_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if (new_z > INVALID_HEIGHT) z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface } @@ -1549,7 +1554,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const float ground_z = z; float max_z = canSwim ? GetBaseMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK)) - : ((ground_z = GetBaseMap()->GetHeight(x, y, z, true))); + : ((ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true))); if (max_z > INVALID_HEIGHT) { if (z > max_z) @@ -1560,7 +1565,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const } else { - float ground_z = GetBaseMap()->GetHeight(x, y, z, true); + float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if (z < ground_z) z = ground_z; } @@ -1583,7 +1588,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const } else { - float ground_z = GetBaseMap()->GetHeight(x, y, z, true); + float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if (z < ground_z) z = ground_z; } @@ -1591,7 +1596,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const } default: { - float ground_z = GetBaseMap()->GetHeight(x, y, z, true); + float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if(ground_z > INVALID_HEIGHT) z = ground_z; break; @@ -2665,8 +2670,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float destx = pos.m_positionX + dist * cos(angle); desty = pos.m_positionY + dist * sin(angle); - ground = GetMap()->GetHeight(destx, desty, MAX_HEIGHT, true); - floor = GetMap()->GetHeight(destx, desty, pos.m_positionZ, true); + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.5f, destx, desty, destz+0.5f, destx, desty, destz, -0.5f); @@ -2689,8 +2694,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float { destx -= step * cos(angle); desty -= step * sin(angle); - ground = GetMap()->GetHeight(destx, desty, MAX_HEIGHT, true); - floor = GetMap()->GetHeight(destx, desty, pos.m_positionZ, true); + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; } // we have correct destz now diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 67d1636c7e2..891cf6b6697 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -222,7 +222,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetEntry(goinfo->entry); - SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); + SetDisplayId(goinfo->displayId); SetGoState(GO_STATE_READY); SetGoType(GameobjectTypes(goinfo->type)); diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 5702eefffec..c907620193a 100755 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -251,7 +251,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) mapid = corpseMapEntry->entrance_map; x = corpseMapEntry->entrance_x; y = corpseMapEntry->entrance_y; - z = entranceMap->GetHeight(x, y, MAX_HEIGHT); + z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT); } } } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index df5ec540427..71fc2ef00a1 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -31,6 +31,7 @@ #include "ObjectMgr.h" #include "Group.h" #include "LFGMgr.h" +#include "DynamicTree.h" union u_map_magic { @@ -368,6 +369,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) // Add resurrectable corpses to world object list in grid sObjectAccessor->AddCorpsesToGrid(GridCoord(cell.GridX(), cell.GridY()), grid->GetGridType(cell.CellX(), cell.CellY()), this); + Balance(); return true; } @@ -498,6 +500,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor(this)->GetGrid(x, y)) { // we need ground level (including grid height version) for proper return water level in point - float ground_z = GetHeight(x, y, z, true, 50.0f); + float ground_z = GetHeight(PHASEMASK_NORMAL, x, y, z, true, 50.0f); if (ground) *ground = ground_z; @@ -1793,6 +1796,17 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0; } +bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const +{ + return VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2) + && m_dyn_tree.isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask); +} + +float Map::GetHeight(uint32 phasemask, float x, float y, float z, bool vmap/*=true*/, float maxSearchDist/*=DEFAULT_HEIGHT_SEARCH*/) const +{ + return std::max(GetHeight(x, y, z, vmap, maxSearchDist), m_dyn_tree.getHeight(x, y, z, maxSearchDist, phasemask)); +} + bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const { // Check surface in x, y point for liquid diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index f3b45bd8f37..7d234d5f75a 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -30,6 +30,8 @@ #include "SharedDefines.h" #include "GridRefManager.h" #include "MapRefManager.h" +#include "DynamicTree.h" +#include "GameObjectModel.h" #include #include @@ -425,7 +427,12 @@ class Map : public GridRefManager InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast(this); else return NULL; } const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return NULL; } float GetWaterOrGroundLevel(float x, float y, float z, float* ground = NULL, bool swim = false) const; - + float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; + bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; + void Balance() { m_dyn_tree.balance(); } + void Remove(const GameObjectModel& mdl) { m_dyn_tree.remove(mdl); } + void Insert(const GameObjectModel& mdl) { m_dyn_tree.insert(mdl); } + bool Contains(const GameObjectModel& mdl) const { return m_dyn_tree.contains(mdl);} private: void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); @@ -481,6 +488,7 @@ class Map : public GridRefManager uint32 i_InstanceId; uint32 m_unloadTimer; float m_VisibleDistance; + DynamicMapTree m_dyn_tree; MapRefManager m_mapRefManager; MapRefManager::iterator m_mapRefIter; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 8975a2d7d7b..adb7b5ca1a8 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -374,7 +374,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee void MotionMaster::MoveFall(uint32 id/*=0*/) { // use larger distance for vmap height search than in most other cases - float tz = i_owner->GetMap()->GetHeight(i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE); + float tz = i_owner->GetMap()->GetHeight(i_owner->GetPhaseMask(), i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", @@ -387,7 +387,7 @@ void MotionMaster::MoveFall(uint32 id/*=0*/) return; Movement::MoveSplineInit init(*i_owner); - init.MoveTo(i_owner->GetPositionX(),i_owner->GetPositionY(),tz); + init.MoveTo(i_owner->GetPositionX(), i_owner->GetPositionY(), tz); init.SetFall(); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 458e6f9a62c..1a628ae076b 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -157,7 +157,7 @@ FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float &z) y = temp_y; return true; } - float new_z = _map->GetHeight(temp_x, temp_y, z, true); + float new_z = _map->GetHeight(owner.GetPhaseMask(), temp_x, temp_y, z, true); if (new_z <= INVALID_HEIGHT) continue; @@ -169,8 +169,8 @@ FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float &z) if (!(new_z - z) || distance / fabs(new_z - z) > 1.0f) { - float new_z_left = _map->GetHeight(temp_x + 1.0f*cos(angle+static_cast(M_PI/2)),temp_y + 1.0f*sin(angle+static_cast(M_PI/2)),z,true); - float new_z_right = _map->GetHeight(temp_x + 1.0f*cos(angle-static_cast(M_PI/2)),temp_y + 1.0f*sin(angle-static_cast(M_PI/2)),z,true); + float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle+static_cast(M_PI/2)),temp_y + 1.0f*sin(angle+static_cast(M_PI/2)),z,true); + float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle-static_cast(M_PI/2)),temp_y + 1.0f*sin(angle-static_cast(M_PI/2)),z,true); if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f) { x = temp_x; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 0205b734058..7270bbbb688 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -33,7 +33,7 @@ #endif template<> -void RandomMovementGenerator::_setRandomLocation(Creature &creature) +void RandomMovementGenerator::_setRandomLocation(Creature& creature) { float respX, respY, respZ, respO, currZ, destX, destY, destZ, travelDistZ; creature.GetHomePosition(respX, respY, respZ, respO); @@ -78,17 +78,17 @@ void RandomMovementGenerator::_setRandomLocation(Creature &creature) // The fastest way to get an accurate result 90% of the time. // Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long. - destZ = map->GetHeight(destX, destY, respZ+travelDistZ-2.0f, false); + destZ = map->GetHeight(creature.GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, false); if (fabs(destZ - respZ) > travelDistZ) // Map check { // Vmap Horizontal or above - destZ = map->GetHeight(destX, destY, respZ - 2.0f, true); + destZ = map->GetHeight(creature.GetPhaseMask(), destX, destY, respZ - 2.0f, true); if (fabs(destZ - respZ) > travelDistZ) { // Vmap Higher - destZ = map->GetHeight(destX, destY, respZ+travelDistZ-2.0f, true); + destZ = map->GetHeight(creature.GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, true); // let's forget this bad coords where a z cannot be find and retry at next tick if (fabs(destZ - respZ) > travelDistZ) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3c73edb880d..042aa68e2a6 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5299,7 +5299,7 @@ SpellCastResult Spell::CheckCast(bool strict) { float x, y, z; m_caster->GetPosition(x, y, z); - float ground_Z = m_caster->GetMap()->GetHeight(x, y, z); + float ground_Z = m_caster->GetMap()->GetHeight(m_caster->GetPhaseMask(), x, y, z); if (fabs(ground_Z - z) < 0.1f) return SPELL_FAILED_DONT_REPORT; break; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 426a93fda57..d87da4cd1a1 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1192,6 +1192,8 @@ void World::LoadConfigSettings(bool reload) sScriptMgr->OnConfigLoad(reload); } +extern void LoadGameObjectModelList(); + /// Initialize the World void World::SetInitialWorldSettings() { @@ -1270,6 +1272,9 @@ void World::SetInitialWorldSettings() sLog->outString("Loading spell custom attributes..."); sSpellMgr->LoadSpellCustomAttr(); + sLog->outString("Loading GameObject models..."); + LoadGameObjectModelList(); + sLog->outString("Loading Script Names..."); sObjectMgr->LoadScriptNames(); diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 56e63af5bbf..9195a60dd9d 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -52,6 +52,7 @@ message("") include_directories( ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/dep/SFMT ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/dep/zlib @@ -69,6 +70,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/collision/Models ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Database ${CMAKE_SOURCE_DIR}/src/server/game/Accounts diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 311c6586a0f..73e6b0ac8a5 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -88,6 +88,7 @@ public: { "update", SEC_ADMINISTRATOR, false, &HandleDebugUpdateCommand, "", NULL }, { "itemexpire", SEC_ADMINISTRATOR, false, &HandleDebugItemExpireCommand, "", NULL }, { "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "", NULL }, + { "los", SEC_MODERATOR, false, &HandleDebugLoSCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = @@ -1040,6 +1041,13 @@ public: handler->GetSession()->GetPlayer()->HandleEmoteCommand(animId); return true; } + + static bool HandleDebugLoSCommand(ChatHandler* handler, char const* args) + { + if (Unit* unit = handler->getSelectedUnit()) + handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not "); + return true; + } static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, char const* args) { diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp index 8f15f8c9ce3..589ed4af3b8 100644 --- a/src/server/scripts/Commands/cs_gps.cpp +++ b/src/server/scripts/Commands/cs_gps.cpp @@ -87,8 +87,8 @@ public: Map2ZoneCoordinates(zoneX, zoneY, zoneId); Map const* map = object->GetMap(); - float groundZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); - float floorZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); + float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); + float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 6466780f024..3a96e64697d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -1200,7 +1200,7 @@ public: float x, y, z; me->GetPosition(x, y, z); - z = me->GetMap()->GetHeight(x, y, z); + z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetPosition(x, y, z, 0); } @@ -1319,7 +1319,7 @@ public: { float x, y, z; me->GetPosition(x, y, z); - z = me->GetMap()->GetHeight(x, y, z); + z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetPosition(x, y, z, 0); hyjal_trashAI::JustDied(victim); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 94a3da2672b..62b16669152 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -892,7 +892,7 @@ class boss_prince_valanar_icc : public CreatureScript { float x, y, z; summon->GetPosition(x, y, z); - float ground_Z = summon->GetMap()->GetHeight(x, y, z, true, 500.0f); + float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f); summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z); break; } @@ -1238,7 +1238,7 @@ class npc_kinetic_bomb : public CreatureScript me->SetReactState(REACT_PASSIVE); me->SetSpeed(MOVE_FLIGHT, IsHeroic() ? 0.3f : 0.15f, true); me->GetPosition(_x, _y, _groundZ); - _groundZ = me->GetMap()->GetHeight(_x, _y, _groundZ, true, 500.0f); + _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f); } void DoAction(int32 const action) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index cf22338995b..6eda383e75d 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -948,7 +948,7 @@ class spell_putricide_ooze_summon : public SpellScriptLoader uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; float x, y, z; GetTarget()->GetPosition(x, y, z); - z = GetTarget()->GetMap()->GetHeight(x, y, z, true, 25.0f); + z = GetTarget()->GetMap()->GetHeight(GetTarget()->GetPhaseMask(), x, y, z, true, 25.0f); x += 10.0f * cosf(caster->GetOrientation()); y += 10.0f * sinf(caster->GetOrientation()); caster->CastSpell(x, y, z, triggerSpellId, true, NULL, NULL, GetCasterGUID()); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 5029dbcceee..6cac58efb42 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -504,7 +504,7 @@ class boss_the_lich_king : public CreatureScript float x, y, z; me->GetPosition(x, y, z); // use larger distance for vmap height search than in most other cases - float ground_Z = me->GetMap()->GetHeight(x, y, z, true, MAX_FALL_DISTANCE); + float ground_Z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z, true, MAX_FALL_DISTANCE); if (fabs(ground_Z - z) < 0.1f) return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 6bd8f3cba7d..bae1ec36ea8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1921,7 +1921,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader Position pos; caster->GetPosition(&pos); caster->GetNearPosition(pos, 5.0f, 0.0f); - pos.m_positionZ = caster->GetBaseMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f); + pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f); pos.m_positionZ += 0.05f; caster->SetHomePosition(pos); caster->GetMotionMaster()->MovePoint(POINT_LAND, pos); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index d96790c3e37..a5adeb18637 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -755,7 +755,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript { float x, y, z; me->GetPosition(x, y, z); - z = me->GetMap()->GetHeight(x, y, z); + z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetPosition(x, y, z, 0); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 15c7cdb187d..278488eac9e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -435,7 +435,7 @@ public: float X = CalculateRandomLocation(target->GetPositionX(), 20); float Y = CalculateRandomLocation(target->GetPositionY(), 20); float Z = target->GetPositionZ(); - Z = me->GetMap()->GetHeight(X, Y, Z); + Z = me->GetMap()->GetHeight(me->GetPhaseMask(), X, Y, Z); Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); if (DoomBlossom) { diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 191bbbf35b4..b3254fe7a28 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -44,12 +44,14 @@ endif() include_directories( ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/dep/gsoap ${CMAKE_SOURCE_DIR}/dep/sockets/include ${CMAKE_SOURCE_DIR}/dep/SFMT ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/collision/Models ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography diff --git a/src/tools/vmap3_assembler/CMakeLists.txt b/src/tools/vmap3_assembler/CMakeLists.txt index ba5d1649d38..42ffc749ba8 100644 --- a/src/tools/vmap3_assembler/CMakeLists.txt +++ b/src/tools/vmap3_assembler/CMakeLists.txt @@ -13,6 +13,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging + ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Maps ${CMAKE_SOURCE_DIR}/src/server/collision/Models ${ACE_INCLUDE_DIR} diff --git a/src/tools/vmap3_extractor/adtfile.cpp b/src/tools/vmap3_extractor/adtfile.cpp index 58c1bb94b1c..a966172a3be 100644 --- a/src/tools/vmap3_extractor/adtfile.cpp +++ b/src/tools/vmap3_extractor/adtfile.cpp @@ -1,13 +1,40 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "adtfile.h" #include #include -#ifdef _WIN32 +#ifdef WIN32 #define snprintf _snprintf #endif +const char * GetPlainName(const char * FileName) +{ + const char * szTemp; + + if((szTemp = strrchr(FileName, '\\')) != NULL) + FileName = szTemp + 1; + return FileName; +} + char * GetPlainName(char * FileName) { char * szTemp; @@ -43,6 +70,14 @@ void fixname2(char *name, size_t len) } } +char * GetExtension(char * FileName) +{ + char * szTemp; + if((szTemp = strrchr(FileName, '.')) != NULL) + return szTemp; + return NULL; +} + ADTFile::ADTFile(char* filename): ADT(filename) { Adtfilename.append(filename); @@ -107,35 +142,15 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY) while (p= 4 ? path.substr(path.size()-4,4) : ""; - std::transform( ext3.begin(), ext3.end(), ext3.begin(), ::tolower ); - if(ext3 == ".mdx") - { - // replace .mdx -> .m2 - path.erase(path.length()-2,2); - path.append("2"); - } - // >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file - // nothing do - - char szLocalFile[1024]; - snprintf(szLocalFile, 1024, "%s/%s", szWorkDirWmo, s); - FILE * output = fopen(szLocalFile,"rb"); - if(!output) - { - Model m2(path); - if(m2.open()) - m2.ConvertToVMAPModel(szLocalFile); - } - else - fclose(output); + string path(p); + ExtractSingleModel(path); + + p = p+strlen(p)+1; } delete[] buf; } diff --git a/src/tools/vmap3_extractor/adtfile.h b/src/tools/vmap3_extractor/adtfile.h index eaf09a9243d..08814996f68 100644 --- a/src/tools/vmap3_extractor/adtfile.h +++ b/src/tools/vmap3_extractor/adtfile.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef ADT_H #define ADT_H @@ -115,7 +133,11 @@ private: string Adtfilename; }; +const char * GetPlainName(const char * FileName); +char * GetPlainName(char * FileName); +char * GetExtension(char * FileName); void fixnamen(char *name, size_t len); +void fixname2(char *name, size_t len); //void fixMapNamen(char *name, size_t len); #endif diff --git a/src/tools/vmap3_extractor/dbcfile.cpp b/src/tools/vmap3_extractor/dbcfile.cpp index 8b8afe9f23c..2474cea5259 100644 --- a/src/tools/vmap3_extractor/dbcfile.cpp +++ b/src/tools/vmap3_extractor/dbcfile.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "dbcfile.h" #include "mpq_libmpq04.h" #undef min diff --git a/src/tools/vmap3_extractor/dbcfile.h b/src/tools/vmap3_extractor/dbcfile.h index d405d6ffd60..56cce9a521c 100644 --- a/src/tools/vmap3_extractor/dbcfile.h +++ b/src/tools/vmap3_extractor/dbcfile.h @@ -1,19 +1,19 @@ /* - * Copyright (C) 2008-2010 TrinityCore - * Copyright (C) 2005-2010 MaNGOS + * Copyright (C) 2005-2011 MaNGOS * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * 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. + * 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 along - * with this program. If not, see . + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DBCFILE_H diff --git a/src/tools/vmap3_extractor/gameobject_extract.cpp b/src/tools/vmap3_extractor/gameobject_extract.cpp new file mode 100644 index 00000000000..8a1f67cd2c2 --- /dev/null +++ b/src/tools/vmap3_extractor/gameobject_extract.cpp @@ -0,0 +1,99 @@ +#include "model.h" +#include "dbcfile.h" +#include "adtfile.h" +#include "vmapexport.h" + +#include +#include + +bool ExtractSingleModel(std::string& fname) +{ + char * name = GetPlainName((char*)fname.c_str()); + char * ext = GetExtension(name); + + // < 3.1.0 ADT MMDX section store filename.mdx filenames for corresponded .m2 file + if (!strcmp(ext, ".mdx")) + { + // replace .mdx -> .m2 + fname.erase(fname.length()-2,2); + fname.append("2"); + } + // >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file + // nothing do + + std::string output(szWorkDirWmo); + output += "/"; + output += name; + + if (FileExists(output.c_str())) + return true; + + Model mdl(fname); + if (!mdl.open()) + return false; + + return mdl.ConvertToVMAPModel(output.c_str()); +} + +void ExtractGameobjectModels() +{ + printf("Extracting GameObject models..."); + DBCFile dbc("DBFilesClient\\GameObjectDisplayInfo.dbc"); + if(!dbc.open()) + { + printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n"); + exit(1); + } + + std::string basepath = szWorkDirWmo; + basepath += "/"; + std::string path; + + FILE * model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb"); + + for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it) + { + path = it->getString(1); + + if (path.length() < 4) + continue; + + fixnamen((char*)path.c_str(), path.size()); + char * name = GetPlainName((char*)path.c_str()); + fixname2(name, strlen(name)); + + char * ch_ext = GetExtension(name); + if (!ch_ext) + continue; + + strToLower(ch_ext); + + bool result = false; + if (!strcmp(ch_ext, ".wmo")) + { + result = ExtractSingleWmo(path); + } + else if (!strcmp(ch_ext, ".mdl")) + { + // TODO: extract .mdl files, if needed + continue; + } + else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2")) + { + result = ExtractSingleModel(path); + } + + if (result) + { + uint32 displayId = it->getUInt(0); + uint32 path_length = strlen(name); + fwrite(&displayId, sizeof(uint32), 1, model_list); + fwrite(&path_length, sizeof(uint32), 1, model_list); + fwrite(name, sizeof(char), path_length, model_list); + } + } + + fclose(model_list); + + printf("Done!\n"); +} diff --git a/src/tools/vmap3_extractor/loadlib/loadlib.h b/src/tools/vmap3_extractor/loadlib/loadlib.h index bf6c0706d46..61865c4b436 100644 --- a/src/tools/vmap3_extractor/loadlib/loadlib.h +++ b/src/tools/vmap3_extractor/loadlib/loadlib.h @@ -1,7 +1,25 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef LOAD_LIB_H #define LOAD_LIB_H -#ifdef _WIN32 +#ifdef WIN32 typedef __int64 int64; typedef __int32 int32; typedef __int16 int16; diff --git a/src/tools/vmap3_extractor/model.cpp b/src/tools/vmap3_extractor/model.cpp index 81e27621956..117c594b41a 100644 --- a/src/tools/vmap3_extractor/model.cpp +++ b/src/tools/vmap3_extractor/model.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "model.h" #include "wmo.h" @@ -6,7 +24,7 @@ #include #include -Model::Model(std::string &filename) : filename(filename) +Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0) { } @@ -23,6 +41,8 @@ bool Model::open() return false; } + _unload(); + memcpy(&header, f.getBuffer(), sizeof(ModelHeader)); if(header.nBoundingTriangles > 0) { @@ -49,7 +69,7 @@ bool Model::open() return true; } -bool Model::ConvertToVMAPModel(char * outfilename) +bool Model::ConvertToVMAPModel(const char * outfilename) { int N[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; FILE * output=fopen(outfilename,"wb"); @@ -58,7 +78,7 @@ bool Model::ConvertToVMAPModel(char * outfilename) printf("Can't create the output file '%s'\n",outfilename); return false; } - fwrite("VMAP003",8,1,output); + fwrite(szRawVMAPMagic,8,1,output); uint32 nVertices = 0; nVertices = header.nBoundingVertices; fwrite(&nVertices, sizeof(int), 1, output); @@ -92,24 +112,16 @@ bool Model::ConvertToVMAPModel(char * outfilename) { for(uint32 vpos=0; vpos + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef MODEL_H #define MODEL_H @@ -23,14 +41,21 @@ public: size_t nIndices; bool open(); - bool ConvertToVMAPModel(char * outfilename); + bool ConvertToVMAPModel(const char * outfilename); bool ok; Model(std::string &filename); - ~Model(); + ~Model() {_unload();} private: + void _unload() + { + delete[] vertices; + delete[] indices; + vertices = NULL; + indices = NULL; + } std::string filename; char outfilename; }; diff --git a/src/tools/vmap3_extractor/modelheaders.h b/src/tools/vmap3_extractor/modelheaders.h index 776a981ebd8..d859fd3511e 100644 --- a/src/tools/vmap3_extractor/modelheaders.h +++ b/src/tools/vmap3_extractor/modelheaders.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef MODELHEADERS_H #define MODELHEADERS_H diff --git a/src/tools/vmap3_extractor/mpq_libmpq04.h b/src/tools/vmap3_extractor/mpq_libmpq04.h index f32f09badde..4b0a2465bfd 100644 --- a/src/tools/vmap3_extractor/mpq_libmpq04.h +++ b/src/tools/vmap3_extractor/mpq_libmpq04.h @@ -1,3 +1,6 @@ +#define _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_WARNINGS + #ifndef MPQ_H #define MPQ_H @@ -21,14 +24,14 @@ public: void close(); void GetFileListTo(vector& filelist) { - uint32 filenum; - if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; - libmpq__off_t size, transferred; - libmpq__file_unpacked_size(mpq_a, filenum, &size); + uint32 filenum; + if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; + libmpq__off_t size, transferred; + libmpq__file_unpacked_size(mpq_a, filenum, &size); char *buffer = new char[size]; - libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); + libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); char seps[] = "\n"; char *token; diff --git a/src/tools/vmap3_extractor/vmapexport.cpp b/src/tools/vmap3_extractor/vmapexport.cpp index 689691e1d91..bf5fe1c517f 100644 --- a/src/tools/vmap3_extractor/vmapexport.cpp +++ b/src/tools/vmap3_extractor/vmapexport.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #define _CRT_SECURE_NO_DEPRECATE #include #include @@ -5,7 +23,7 @@ #include #include -#ifdef _WIN32 +#ifdef WIN32 #include #include #include @@ -29,6 +47,8 @@ #include "wmo.h" #include "mpq_libmpq04.h" +#include "vmapexport.h" + //------------------------------------------------------------------------------ // Defines @@ -55,13 +75,19 @@ bool preciseVectorData = false; // Constants //static const char * szWorkDirMaps = ".\\Maps"; -const char * szWorkDirWmo = "./Buildings"; +const char* szWorkDirWmo = "./Buildings"; +const char* szRawVMAPMagic = "VMAP004"; // Local testing functions -static void clreol() +bool FileExists(const char* file) { - printf("\r \r"); + if (FILE* n = fopen(file, "rb")) + { + fclose(n); + return true; + } + return false; } void strToLower(char* str) @@ -73,15 +99,6 @@ void strToLower(char* str) } } -static const char * GetPlainName(const char * szFileName) -{ - const char * szTemp; - - if((szTemp = strrchr(szFileName, '\\')) != NULL) - szFileName = szTemp + 1; - return szFileName; -} - // copied from contrib/extractor/System.cpp void ReadLiquidTypeTableDBC() { @@ -104,10 +121,9 @@ void ReadLiquidTypeTableDBC() printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count); } -int ExtractWmo() +bool ExtractWmo() { - char szLocalFile[1024] = ""; - bool success=true; + bool success = true; //const char* ParsArchiveNames[] = {"patch-2.MPQ", "patch.MPQ", "common.MPQ", "expansion.MPQ"}; @@ -116,99 +132,98 @@ int ExtractWmo() vector filelist; (*ar_itr)->GetFileListTo(filelist); - for (vector::iterator fname=filelist.begin(); fname != filelist.end() && success; ++fname) + for (vector::iterator fname = filelist.begin(); fname != filelist.end() && success; ++fname) { - bool file_ok=true; if (fname->find(".wmo") != string::npos) - { - // Copy files from archive - //std::cout << "found *.wmo file " << *fname << std::endl; - sprintf(szLocalFile, "%s/%s", szWorkDirWmo, GetPlainName(fname->c_str())); - fixnamen(szLocalFile,strlen(szLocalFile)); - FILE * n; - if ((n = fopen(szLocalFile, "rb"))== NULL) - { - int p = 0; - //Select root wmo files - const char * rchr = strrchr(GetPlainName(fname->c_str()),0x5f); - if(rchr != NULL) - { - char cpy[4]; - strncpy((char*)cpy,rchr,4); - for (int i=0;i<4; ++i) - { - int m = cpy[i]; - if(isdigit(m)) - p++; - } - } - if(p != 3) - { - std::cout << "Extracting " << *fname << std::endl; - WMORoot * froot = new WMORoot(*fname); - if(!froot->open()) - { - printf("Couldn't open RootWmo!!!\n"); - delete froot; - continue; - } - FILE *output=fopen(szLocalFile,"wb"); - if(!output) - { - printf("couldn't open %s for writing!\n", szLocalFile); - success=false; - } - froot->ConvertToVMAPRootWmo(output); - int Wmo_nVertices = 0; - //printf("root has %d groups\n", froot->nGroups); - if(froot->nGroups !=0) - { - for (uint32 i=0; inGroups; ++i) - { - char temp[1024]; - strcpy(temp, fname->c_str()); - temp[fname->length()-4] = 0; - char groupFileName[1024]; - sprintf(groupFileName,"%s_%03d.wmo",temp, i); - //printf("Trying to open groupfile %s\n",groupFileName); - string s = groupFileName; - WMOGroup * fgroup = new WMOGroup(s); - if(!fgroup->open()) - { - printf("Could not open all Group file for: %s\n",GetPlainName(fname->c_str())); - file_ok=false; - break; - } - - Wmo_nVertices += fgroup->ConvertToVMAPGroupWmo(output, froot, preciseVectorData); - delete fgroup; - } - } - fseek(output, 8, SEEK_SET); // store the correct no of vertices - fwrite(&Wmo_nVertices,sizeof(int),1,output); - fclose(output); - delete froot; - } - } - else - { - fclose(n); - } - } - // Delete the extracted file in the case of an error - if(!file_ok) - remove(szLocalFile); + success = ExtractSingleWmo(*fname); } } - if(success) + if (success) printf("\nExtract wmo complete (No (fatal) errors)\n"); return success; } -void ExtractMapsFromMpq() +bool ExtractSingleWmo(std::string& fname) { + // Copy files from archive + + char szLocalFile[1024]; + const char * plain_name = GetPlainName(fname.c_str()); + sprintf(szLocalFile, "%s/%s", szWorkDirWmo, plain_name); + fixnamen(szLocalFile,strlen(szLocalFile)); + + if (FileExists(szLocalFile)) + return true; + + int p = 0; + //Select root wmo files + const char * rchr = strrchr(plain_name, '_'); + if(rchr != NULL) + { + char cpy[4]; + strncpy((char*)cpy,rchr,4); + for (int i=0;i < 4; ++i) + { + int m = cpy[i]; + if(isdigit(m)) + p++; + } + } + + if (p == 3) + return true; + + bool file_ok = true; + std::cout << "Extracting " << fname << std::endl; + WMORoot froot(fname); + if(!froot.open()) + { + printf("Couldn't open RootWmo!!!\n"); + return true; + } + FILE *output = fopen(szLocalFile,"wb"); + if(!output) + { + printf("couldn't open %s for writing!\n", szLocalFile); + return false; + } + froot.ConvertToVMAPRootWmo(output); + int Wmo_nVertices = 0; + //printf("root has %d groups\n", froot->nGroups); + if (froot.nGroups !=0) + { + for (uint32 i = 0; i < froot.nGroups; ++i) + { + char temp[1024]; + strcpy(temp, fname.c_str()); + temp[fname.length()-4] = 0; + char groupFileName[1024]; + sprintf(groupFileName,"%s_%03d.wmo",temp, i); + //printf("Trying to open groupfile %s\n",groupFileName); + + string s = groupFileName; + WMOGroup fgroup(s); + if(!fgroup.open()) + { + printf("Could not open all Group file for: %s\n", plain_name); + file_ok = false; + break; + } + + Wmo_nVertices += fgroup.ConvertToVMAPGroupWmo(output, &froot, preciseVectorData); + } + } + + fseek(output, 8, SEEK_SET); // store the correct no of vertices + fwrite(&Wmo_nVertices,sizeof(int),1,output); + fclose(output); + + // Delete the extracted file in the case of an error + if (!file_ok) + remove(szLocalFile); + return true; } void ParsMapFiles() @@ -251,8 +266,9 @@ void getGamePath() LONG l; s = sizeof(input_path); memset(input_path,0,s); - l = RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\World of Warcraft",0,KEY_QUERY_VALUE,&key); - l = RegQueryValueExA(key,"InstallPath",0,&t,(LPBYTE)input_path,&s); + l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\World of Warcraft",0,KEY_QUERY_VALUE,&key); + //l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\Burning Crusade Closed Beta",0,KEY_QUERY_VALUE,&key); + l = RegQueryValueEx(key,"InstallPath",0,&t,(LPBYTE)input_path,&s); RegCloseKey(key); if (strlen(input_path) > 0) { @@ -379,16 +395,17 @@ bool processArgv(int argc, char ** argv, const char *versionString) { bool result = true; hasInputPathParam = false; + bool preciseVectorData = false; - for (int i=1; i < argc; ++i) + for(int i=1; i< argc; ++i) { - if (strcmp("-s", argv[i]) == 0) + if(strcmp("-s",argv[i]) == 0) { preciseVectorData = false; } - else if (strcmp("-d", argv[i]) == 0) + else if(strcmp("-d",argv[i]) == 0) { - if ((i + 1) < argc) + if((i+1) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef VMAPEXPORT_H #define VMAPEXPORT_H +#include + enum ModelFlags { - MOD_M2 = 1, - MOD_WORLDSPAWN = 1<<1, + MOD_M2 = 1, + MOD_WORLDSPAWN = 1<<1, MOD_HAS_BOUND = 1<<2 }; extern const char * szWorkDirWmo; +extern const char * szRawVMAPMagic; // vmap magic string for extracted raw vmap data + +bool FileExists(const char * file); +void strToLower(char* str); + +bool ExtractSingleWmo(std::string& fname); +bool ExtractSingleModel(std::string& fname); + +void ExtractGameobjectModels(); #endif diff --git a/src/tools/vmap3_extractor/wdtfile.cpp b/src/tools/vmap3_extractor/wdtfile.cpp index cd24ef0346c..e3ee545db19 100644 --- a/src/tools/vmap3_extractor/wdtfile.cpp +++ b/src/tools/vmap3_extractor/wdtfile.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "wdtfile.h" #include "adtfile.h" diff --git a/src/tools/vmap3_extractor/wmo.cpp b/src/tools/vmap3_extractor/wmo.cpp index 216a2248953..58957e007c1 100644 --- a/src/tools/vmap3_extractor/wmo.cpp +++ b/src/tools/vmap3_extractor/wmo.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "wmo.h" #include "vec3d.h" @@ -106,7 +124,7 @@ bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile) { //printf("Convert RootWmo...\n"); - fwrite("VMAP003",1,8,pOutfile); + fwrite(szRawVMAPMagic,1,8,pOutfile); unsigned int nVectors = 0; fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later fwrite(&nGroups,4,1,pOutfile); diff --git a/src/tools/vmap3_extractor/wmo.h b/src/tools/vmap3_extractor/wmo.h index 12979bc13d9..d1f7b82f0c6 100644 --- a/src/tools/vmap3_extractor/wmo.h +++ b/src/tools/vmap3_extractor/wmo.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef WMO_H #define WMO_H #define TILESIZE (533.33333f) -- cgit v1.2.3 From 03c34ee507b4e43fabee1ff382d9de9ea815e3f2 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Feb 2012 13:56:08 +0100 Subject: Fix a lot of warnings --- src/server/authserver/Server/RealmSocket.cpp | 2 +- src/server/authserver/Server/RealmSocket.h | 2 +- .../collision/BoundingIntervalHierarchyWrapper.h | 4 ++-- src/server/collision/DynamicTree.cpp | 5 +++-- src/server/collision/Maps/TileAssembler.cpp | 9 ++++----- src/server/collision/Models/GameObjectModel.cpp | 20 +++++++++----------- src/server/collision/RegularGrid.h | 4 ++-- src/server/game/Conditions/ConditionMgr.cpp | 5 ++--- src/server/game/Conditions/ConditionMgr.h | 7 ++++--- src/server/game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 9 ++++----- src/server/game/Entities/Unit/Unit.cpp | 16 ++++++++-------- src/server/game/Entities/Vehicle/VehicleDefines.h | 2 +- src/server/game/Groups/Group.cpp | 2 +- src/server/game/Instances/InstanceScript.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 6 +++--- src/server/game/Maps/Map.cpp | 2 +- src/server/game/Movement/MotionMaster.h | 2 +- .../MovementGenerators/HomeMovementGenerator.cpp | 2 +- .../MovementGenerators/PointMovementGenerator.cpp | 2 +- .../MovementGenerators/RandomMovementGenerator.cpp | 3 +-- .../MovementGenerators/TargetedMovementGenerator.h | 5 +++-- .../MovementGenerators/WaypointMovementGenerator.cpp | 4 ++-- .../MovementGenerators/WaypointMovementGenerator.h | 5 +++-- src/server/game/Movement/Spline/MoveSpline.cpp | 2 +- src/server/game/Movement/Spline/MoveSpline.h | 2 -- src/server/game/Movement/Spline/MoveSplineFlag.h | 16 ++++++++-------- src/server/game/Movement/Spline/Spline.cpp | 2 -- src/server/game/Movement/Spline/Spline.h | 6 +----- src/server/game/Quests/QuestDef.h | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 6 +++--- src/server/game/Spells/Auras/SpellAuras.cpp | 4 ++-- src/server/game/Spells/Spell.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- src/server/scripts/Outland/blades_edge_mountains.cpp | 6 ++---- src/server/scripts/Spells/spell_generic.cpp | 10 ++++++---- 38 files changed, 88 insertions(+), 98 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp index 72c36fc6646..e839457d1c9 100755 --- a/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -95,7 +95,7 @@ const std::string& RealmSocket::getRemoteAddress(void) const return _remoteAddress; } -const uint16 RealmSocket::getRemotePort(void) const +uint16 RealmSocket::getRemotePort(void) const { return _remotePort; } diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h index 9dbd0a4aafb..c03a0e3ad1e 100755 --- a/src/server/authserver/Server/RealmSocket.h +++ b/src/server/authserver/Server/RealmSocket.h @@ -55,7 +55,7 @@ public: const std::string& getRemoteAddress(void) const; - const uint16 getRemotePort(void) const; + uint16 getRemotePort(void) const; virtual int open(void *); diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h index e54a4e653a1..e2252ca60c8 100644 --- a/src/server/collision/BoundingIntervalHierarchyWrapper.h +++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h @@ -34,7 +34,7 @@ class BIHWrap const T* const* objects; RayCallback& _callback; - MDLCallback(RayCallback& callback, const T* const* objects_array ) : _callback(callback), objects(objects_array){} + MDLCallback(RayCallback& callback, const T* const* objects_array ) : objects(objects_array), _callback(callback) {} bool operator() (const Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) { @@ -106,4 +106,4 @@ public: } }; -#endif // _BIH_WRAP \ No newline at end of file +#endif // _BIH_WRAP diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp index 89e76d426fe..ebb46614a20 100644 --- a/src/server/collision/DynamicTree.cpp +++ b/src/server/collision/DynamicTree.cpp @@ -43,10 +43,11 @@ template<> struct BoundsTrait< GameObjectModel> { static void getBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->getBounds();} }; +/* static bool operator == (const GameObjectModel& mdl, const GameObjectModel& mdl2){ return &mdl == &mdl2; } - +*/ int valuesPerNode = 5, numMeanSplits = 3; @@ -251,4 +252,4 @@ float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, return v.z - maxSearchDist; else return -G3D::inf(); -} \ No newline at end of file +} diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 62968e4dedd..cfd50c318df 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -344,16 +344,15 @@ namespace VMAP char buff[500]; while (!feof(model_list)) { - fread(&displayId,sizeof(uint32),1,model_list); - fread(&name_length,sizeof(uint32),1,model_list); - - if (name_length >= sizeof(buff)) + if (fread(&displayId, sizeof(uint32), 1, model_list) != 1 + || fread(&name_length, sizeof(uint32), 1, model_list) != 1 + || name_length >= sizeof(buff) + || fread(&buff, sizeof(char), name_length, model_list) != name_length) { std::cout << "\nFile 'temp_gameobject_models' seems to be corrupted" << std::endl; break; } - fread(&buff,sizeof(char),name_length,model_list); std::string model_name(buff, name_length); WorldModel_Raw raw_model; diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 5ad984fcb4b..4c0a344f868 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -36,7 +36,7 @@ using G3D::AABox; struct GameobjectModelData { GameobjectModelData(const std::string& name_, const AABox& box) : - name(name_), bound(box) {} + bound(box), name(name_) {} AABox bound; std::string name; @@ -55,20 +55,18 @@ void LoadGameObjectModelList() char buff[500]; while (!feof(model_list_file)) { - fread(&displayId,sizeof(uint32),1,model_list_file); - fread(&name_length,sizeof(uint32),1,model_list_file); - - if (name_length >= sizeof(buff)) + Vector3 v1, v2; + if (fread(&displayId, sizeof(uint32), 1, model_list_file) != 1 + || fread(&name_length, sizeof(uint32), 1, model_list_file) != 1 + || name_length >= sizeof(buff) + || fread(&buff, sizeof(char), name_length, model_list_file) != name_length + || fread(&v1, sizeof(Vector3), 1, model_list_file) != 1 + || fread(&v2, sizeof(Vector3), 1, model_list_file) != 1) { printf("\nFile '%s' seems to be corrupted", VMAP::GAMEOBJECT_MODELS); break; } - fread(&buff, sizeof(char), name_length,model_list_file); - Vector3 v1, v2; - fread(&v1, sizeof(Vector3), 1, model_list_file); - fread(&v2, sizeof(Vector3), 1, model_list_file); - model_list.insert ( ModelList::value_type( displayId, GameobjectModelData(std::string(buff,name_length),AABox(v1,v2)) ) @@ -172,4 +170,4 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto MaxDist = distance; } return hit; -} \ No newline at end of file +} diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index be61504bc65..2c11b1c257d 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -17,7 +17,7 @@ using G3D::Ray; template struct NodeCreator{ - static Node * makeNode(int x, int y) { return new Node();} + static Node * makeNode(int /*x*/, int /*y*/) { return new Node();} }; templateSourceGroup && (*itr).second.text_id == cond->SourceEntry) + if ((*itr).second.entry == cond->SourceGroup && (*itr).second.text_id == uint32(cond->SourceEntry)) { (*itr).second.conditions.push_back(cond); return true; @@ -743,7 +742,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) { for (GossipMenuItemsContainer::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { - if ((*itr).second.MenuId == cond->SourceGroup && (*itr).second.OptionIndex == cond->SourceEntry) + if ((*itr).second.MenuId == cond->SourceGroup && (*itr).second.OptionIndex == uint32(cond->SourceEntry)) { (*itr).second.Conditions.push_back(cond); return true; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 3c968998566..79a2122ae29 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -255,10 +255,11 @@ template bool CompareValues(ComparisionType type, T val1, T val2) return val1 >= val2; case COMP_TYPE_LOW_EQ: return val1 <= val2; + default: + // incorrect parameter + ASSERT(false); + return false; } - // incorrect parameter - ASSERT(false); - return false; } #define sConditionMgr ACE_Singleton::instance() diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index cbd0922118c..d40ee89e774 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -145,7 +145,7 @@ m_PlayerDamageReq(0), m_lootMoney(0), m_lootRecipient(0), m_lootRecipientGroup(0 m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL), m_path_id(0) +m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 41e0b8e054b..a06cee891e7 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -33,7 +33,7 @@ #include "GameObjectModel.h" #include "DynamicTree.h" -GameObject::GameObject() : WorldObject(false), m_goValue(new GameObjectValue), m_AI(NULL), m_model(NULL) +GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new GameObjectValue), m_AI(NULL) { m_objectType |= TYPEMASK_GAMEOBJECT; m_objectTypeId = TYPEID_GAMEOBJECT; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 80511f49a64..941d898c1fb 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -434,9 +434,9 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/) // 5. Credit instance encounter. KillRewarder::KillRewarder(Player* killer, Unit* victim, bool isBattleGround) : // 1. Initialize internal variables to default values. - _killer(killer), _victim(victim), _isBattleGround(isBattleGround), - _isPvP(false), _group(killer->GetGroup()), _groupRate(1.0f), - _maxLevel(0), _maxNotGrayMember(NULL), _count(0), _sumLevel(0), _isFullXP(false), _xp(0) + _killer(killer), _victim(victim), _group(killer->GetGroup()), + _groupRate(1.0f), _maxNotGrayMember(NULL), _count(0), _sumLevel(0), _xp(0), + _isFullXP(false), _maxLevel(0), _isBattleGround(isBattleGround), _isPvP(false) { // mark the credit as pvp if victim is player if (victim->GetTypeId() == TYPEID_PLAYER) @@ -11830,7 +11830,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) lootedObjectInDungeon = true; if (!lootedObjectInDungeon) @@ -12024,7 +12024,6 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) return NULL; Item* lastItem = pItem; - uint32 entry = pItem->GetEntry(); for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end();) { uint16 pos = itr->pos; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 04eab0b7d56..183267d1dbf 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -146,9 +146,10 @@ _hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo) #endif Unit::Unit(bool isWorldObject): WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false), -m_ControlledByPlayer(false), i_AI(NULL), i_disabledAI(NULL), m_procDeep(0), -m_removedAurasCount(0), i_motionMaster(this), m_ThreatManager(this), m_vehicle(NULL), -m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this), movespline(new Movement::MoveSpline()) +m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), +i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(this), +m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), +m_HostileRefManager(this) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -7010,8 +7011,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot())); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) - || attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK - || attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK) + || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) + || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) return false; // Now compute real proc chance... @@ -7307,8 +7308,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere Player* player = ToPlayer(); WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot())); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) - || attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK - || attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK) + || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) + || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) return false; float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f)); @@ -12685,7 +12686,6 @@ void Unit::setDeathState(DeathState s) { // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that // it can be used to check creation of death items (such as soul shards). - DeathState oldDeathState = m_deathState; m_deathState = s; if (s != ALIVE && s != JUST_ALIVED) diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index 57d9204ad1c..df34a61d444 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -63,7 +63,7 @@ struct VehicleSeat struct VehicleAccessory { VehicleAccessory(uint32 entry, int8 seatId, bool isMinion, uint8 summonType, uint32 summonTime) : - AccessoryEntry(entry), SeatId(seatId), IsMinion(isMinion), SummonedType(summonType), SummonTime(summonTime) {} + AccessoryEntry(entry), IsMinion(isMinion), SummonTime(summonTime), SeatId(seatId), SummonedType(summonType) {} uint32 AccessoryEntry; uint32 IsMinion; uint32 SummonTime; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index b31b632e963..b24b5be014a 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -554,7 +554,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV { Player* Leader = ObjectAccessor::FindPlayer(GetLeaderGUID()); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(sLFGMgr->GetDungeon(GetGUID())); - if ((Leader && dungeon && Leader->isAlive() && Leader->GetMapId() != dungeon->map) || !dungeon) + if ((Leader && dungeon && Leader->isAlive() && Leader->GetMapId() != uint32(dungeon->map)) || !dungeon) { Disband(); return false; diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 90fb8ffb9f0..c6a93ff4272 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -316,7 +316,7 @@ void InstanceScript::DoSendNotifyToInstance(char const* format, ...) for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) if (Player* player = i->getSource()) if (WorldSession* session = player->GetSession()) - session->SendNotification(buff); + session->SendNotification("%s", buff); } } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 564d0cce8b7..64e9b9a27e4 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1364,7 +1364,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i) { - if (i->itemid == cond->SourceEntry) + if (i->itemid == uint32(cond->SourceEntry)) { i->conditions.push_back(cond); return true; @@ -1380,7 +1380,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i) { - if ((*i).itemid == cond->SourceEntry) + if ((*i).itemid == uint32(cond->SourceEntry)) { (*i).conditions.push_back(cond); return true; @@ -1392,7 +1392,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i) { - if ((*i).itemid == cond->SourceEntry) + if ((*i).itemid == uint32(cond->SourceEntry)) { (*i).conditions.push_back(cond); return true; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 39f695c0868..7f7612c2046 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2374,7 +2374,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) - if (dungeon->map == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) + if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 83ff81ab30b..9910f8ad40a 100755 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -91,7 +91,7 @@ class MotionMaster //: private std::stack void InitTop(); public: - explicit MotionMaster(Unit* unit) : _top(-1), _owner(unit), _expList(NULL), _cleanFlag(MMCF_NONE) + explicit MotionMaster(Unit* unit) : _expList(NULL), _top(-1), _owner(unit), _cleanFlag(MMCF_NONE) { for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) { diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index dc47898352e..5725aec54f6 100755 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -57,7 +57,7 @@ void HomeMovementGenerator::_setTargetLocation(Creature & owner) owner.ClearUnitState(UNIT_STATE_ALL_STATE & ~UNIT_STATE_EVADE); } -bool HomeMovementGenerator::Update(Creature &owner, const uint32 time_diff) +bool HomeMovementGenerator::Update(Creature &owner, const uint32 /*time_diff*/) { arrived = owner.movespline->Finalized(); return !arrived; diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index 02f9ebce847..c565e150740 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -41,7 +41,7 @@ void PointMovementGenerator::Initialize(T &unit) } template -bool PointMovementGenerator::Update(T &unit, const uint32 &diff) +bool PointMovementGenerator::Update(T &unit, const uint32 & /*diff*/) { if (!&unit) return false; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 054f87d9fff..b65fa210723 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -35,9 +35,8 @@ template<> void RandomMovementGenerator::_setRandomLocation(Creature& creature) { - float respX, respY, respZ, respO, currZ, destX, destY, destZ, travelDistZ; + float respX, respY, respZ, respO, destX, destY, destZ, travelDistZ; creature.GetHomePosition(respX, respY, respZ, respO); - currZ = creature.GetPositionZ(); Map const* map = creature.GetBaseMap(); // For 2D/3D system selection diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h index bf2eecc89f6..b851dbc0e05 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h @@ -39,8 +39,9 @@ class TargetedMovementGeneratorMedium { protected: TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) : - TargetedMovementGeneratorBase(target), i_offset(offset), i_angle(angle), - i_recalculateTravel(false), i_targetReached(false), i_recheckDistance(0) + TargetedMovementGeneratorBase(target), i_recheckDistance(0), + i_offset(offset), i_angle(angle), + i_recalculateTravel(false), i_targetReached(false) { } ~TargetedMovementGeneratorMedium() {} diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index da84325a00a..1871454d614 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -78,7 +78,7 @@ void WaypointMovementGenerator::OnArrived(Creature& creature) if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) { - sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for %u.", i_path->at(i_currentNode)->event_id, i_currentNode, creature.GetGUID()); + sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for "UI64FMTD".", i_path->at(i_currentNode)->event_id, i_currentNode, creature.GetGUID()); creature.GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, &creature, NULL/*, false*/); } @@ -240,7 +240,7 @@ void FlightPathMovementGenerator::Reset(Player & player) init.Launch(); } -bool FlightPathMovementGenerator::Update(Player &player, const uint32 diff) +bool FlightPathMovementGenerator::Update(Player &player, const uint32 /*diff*/) { uint32 pointId = (uint32)player.movespline->currentPathIdx(); if (pointId > i_currentNode) diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index aa6d327db3b..9c2475267f6 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -42,7 +42,7 @@ template class PathMovementBase { public: - PathMovementBase() : i_currentNode(0), i_path(NULL) {} + PathMovementBase() : i_path(NULL), i_currentNode(0) {} virtual ~PathMovementBase() {}; // template pattern, not defined .. override required @@ -63,7 +63,8 @@ class WaypointMovementGenerator public PathMovementBase { public: - WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : i_nextMoveTime(0), path_id(_path_id), m_isArrivalDone(false), repeating(_repeating) {} + WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) + : i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) {} ~WaypointMovementGenerator() { i_path = NULL; } void Initialize(Creature &); void Finalize(Creature &); diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 4eaa6b57b36..5d0344f9769 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -187,7 +187,7 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args) } MoveSpline::MoveSpline() : m_Id(0), time_passed(0), - vertical_acceleration(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0), initialOrientation(0.f) + vertical_acceleration(0.f), initialOrientation(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0) { splineflags.done = true; } diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 4b8dbcc8ee3..d4b19b21634 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.h @@ -47,7 +47,6 @@ namespace Movement Result_NextCycle = 0x04, Result_NextSegment = 0x08, }; - #pragma region fields friend class PacketBuilder; protected: MySpline spline; @@ -88,7 +87,6 @@ namespace Movement void _Finalize(); void _Interrupt() { splineflags.done = true;} - #pragma endregion public: void Initialize(const MoveSplineInitArgs&); diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h index de91f63c30a..33973064e09 100644 --- a/src/server/game/Movement/Spline/MoveSplineFlag.h +++ b/src/server/game/Movement/Spline/MoveSplineFlag.h @@ -98,14 +98,14 @@ namespace Movement void operator &= (uint32 f) { raw() &= f;} void operator |= (uint32 f) { raw() |= f;} - void EnableAnimation(uint8 anim) { raw() = raw() & ~(Mask_Animations|Falling|Parabolic) | Animation|anim;} - void EnableParabolic() { raw() = raw() & ~(Mask_Animations|Falling|Animation) | Parabolic;} - void EnableFalling() { raw() = raw() & ~(Mask_Animations|Parabolic|Animation) | Falling;} - void EnableFlying() { raw() = raw() & ~Catmullrom | Flying; } - void EnableCatmullRom() { raw() = raw() & ~Flying | Catmullrom; } - void EnableFacingPoint() { raw() = raw() & ~Mask_Final_Facing | Final_Point;} - void EnableFacingAngle() { raw() = raw() & ~Mask_Final_Facing | Final_Angle;} - void EnableFacingTarget() { raw() = raw() & ~Mask_Final_Facing | Final_Target;} + void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations|Falling|Parabolic)) | Animation|anim;} + void EnableParabolic() { raw() = (raw() & ~(Mask_Animations|Falling|Animation)) | Parabolic;} + void EnableFalling() { raw() = (raw() & ~(Mask_Animations|Parabolic|Animation)) | Falling;} + void EnableFlying() { raw() = (raw() & ~Catmullrom) | Flying; } + void EnableCatmullRom() { raw() = (raw() & ~Flying) | Catmullrom; } + void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;} + void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle;} + void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target;} uint8 animId : 8; bool done : 1; diff --git a/src/server/game/Movement/Spline/Spline.cpp b/src/server/game/Movement/Spline/Spline.cpp index 14c1bd0c117..6970acf5415 100644 --- a/src/server/game/Movement/Spline/Spline.cpp +++ b/src/server/game/Movement/Spline/Spline.cpp @@ -56,7 +56,6 @@ SplineBase::InitMethtod SplineBase::initializers[SplineBase::ModesEnd] = }; /////////// -#pragma region evaluation methtods using G3D::Matrix4; static const Matrix4 s_catmullRomCoeffs( @@ -199,7 +198,6 @@ float SplineBase::SegLengthBezier3(index_type index) const } return length; } -#pragma endregion void SplineBase::init_spline(const Vector3 * controls, index_type count, EvaluationMode m) { diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index 28876b220d4..627cdcf3e3b 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -39,7 +39,6 @@ public: ModesEnd }; - #pragma region fields protected: ControlArray points; @@ -84,10 +83,9 @@ protected: void UninitializedSpline() const { ASSERT(false);} - #pragma endregion public: - explicit SplineBase() : m_mode(UninitializedMode), index_lo(0), index_hi(0), cyclic(false) {} + explicit SplineBase() : index_lo(0), index_hi(0), m_mode(UninitializedMode), cyclic(false) {} /** Caclulates the position for given segment Idx, and percent of segment length t @param t - percent of segment length, assumes that t in range [0, 1] @@ -138,13 +136,11 @@ class Spline : public SplineBase public: typedef length_type LengthType; typedef std::vector LengthArray; - #pragma region fields protected: LengthArray lengths; index_type computeIndexInBounds(length_type length) const; - #pragma endregion public: explicit Spline(){} diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index eaaaeaac9ca..21b98ad2cea 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -360,7 +360,7 @@ class Quest struct QuestStatusData { - QuestStatusData(): Status(QUEST_STATUS_NONE), Explored(false), Timer(0), PlayerCount(0) + QuestStatusData(): Status(QUEST_STATUS_NONE), Timer(0), PlayerCount(0), Explored(false) { memset(ItemCount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16)); memset(CreatureOrGOCount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16)); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1972b625a9f..73039d15620 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -373,10 +373,10 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= }; AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster): -m_base(base), m_spellInfo(base->GetSpellInfo()), m_effIndex(effIndex), +m_base(base), m_spellInfo(base->GetSpellInfo()), m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[m_effIndex].BasePoints), -m_canBeRecalculated(true), m_spellmod(NULL), m_isPeriodic(false), -m_periodicTimer(0), m_tickNumber(0) +m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), +m_canBeRecalculated(true), m_isPeriodic(false) { CalculatePeriodic(caster, true, false); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 4bc193b49d2..ee5827cdb98 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -37,8 +37,8 @@ #include "Vehicle.h" AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): -_target(target), _base(aura), _slot(MAX_AURAS), _flags(AFLAG_NONE), -_effectsToApply(effMask), _removeMode(AURA_REMOVE_NONE), _needClientUpdate(false) +_target(target), _base(aura), _removeMode(AURA_REMOVE_NONE), _slot(MAX_AURAS), +_flags(AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false) { ASSERT(GetTarget() && GetBase()); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6cacf5e7e5a..cc159a613c3 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4651,7 +4651,7 @@ SpellCastResult Spell::CheckCast(bool strict) Unit::AuraEffectList const& blockSpells = m_caster->GetAuraEffectsByType(SPELL_AURA_BLOCK_SPELL_FAMILY); for (Unit::AuraEffectList::const_iterator blockItr = blockSpells.begin(); blockItr != blockSpells.end(); ++blockItr) - if ((*blockItr)->GetMiscValue() == m_spellInfo->SpellFamilyName) + if (uint32((*blockItr)->GetMiscValue()) == m_spellInfo->SpellFamilyName) return SPELL_FAILED_SPELL_UNAVAILABLE; bool reqCombat = true; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 73e6b0ac8a5..3de1181f764 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1042,7 +1042,7 @@ public: return true; } - static bool HandleDebugLoSCommand(ChatHandler* handler, char const* args) + static bool HandleDebugLoSCommand(ChatHandler* handler, char const* /*args*/) { if (Unit* unit = handler->getSelectedUnit()) handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not "); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index a78a29704cc..242b2f2f0ea 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -308,7 +308,7 @@ struct boss_twin_baseAI : public ScriptedAI void EnableDualWield(bool mode = true) { - SetEquipmentSlots(false, m_uiWeapon, mode ? m_uiWeapon : EQUIP_UNEQUIP, EQUIP_UNEQUIP); + SetEquipmentSlots(false, m_uiWeapon, mode ? m_uiWeapon : int32(EQUIP_UNEQUIP), EQUIP_UNEQUIP); me->SetCanDualWield(mode); me->UpdateDamagePhysical(mode ? OFF_ATTACK : BASE_ATTACK); } diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 97ce9f45430..c9fdd0f65ff 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -739,7 +739,7 @@ class npc_simon_bunny : public CreatureScript if (!listening) return; - uint8 pressedColor; + uint8 pressedColor = SIMON_MAX_COLORS; if (type == clusterIds[SIMON_RED]) pressedColor = SIMON_RED; @@ -974,7 +974,7 @@ class npc_simon_bunny : public CreatureScript // Handles the spell rewards. The spells also have the QuestCompleteEffect, so quests credits are working. void GiveRewardForLevel(uint8 level) { - uint32 rewSpell; + uint32 rewSpell = 0; switch (level) { case 6: @@ -989,8 +989,6 @@ class npc_simon_bunny : public CreatureScript case 10: rewSpell = SPELL_REWARD_BUFF_3; break; - default: - rewSpell = 0; } if (rewSpell) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 9899e50cd28..09fb6830da8 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1521,7 +1521,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (group && group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) return; // in correct dungeon @@ -1706,6 +1706,8 @@ class spell_gen_break_shield: public SpellScriptLoader } break; } + default: + break; } } @@ -1834,7 +1836,7 @@ class spell_gen_mounted_charge: public SpellScriptLoader } } - void HandleChargeEffect(SpellEffIndex effIndex) + void HandleChargeEffect(SpellEffIndex /*effIndex*/) { uint32 spellId; @@ -1908,7 +1910,7 @@ class spell_gen_defend : public SpellScriptLoader void RefreshVisualShields(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) + if (GetCaster()) { Unit* target = GetTarget(); @@ -1989,7 +1991,7 @@ class spell_gen_tournament_duel : public SpellScriptLoader return true; } - void HandleScriptEffect(SpellEffIndex effIndex) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* rider = GetCaster()->GetCharmer()) { -- cgit v1.2.3 From 5411e1ce522b5a6f0faf2575fb96157bedeb5454 Mon Sep 17 00:00:00 2001 From: click Date: Sat, 18 Feb 2012 16:52:08 +0100 Subject: Core: Clean up whitespace and tabs in the base sourcetree --- src/server/collision/DynamicTree.h | 2 +- src/server/collision/Maps/TileAssembler.cpp | 18 ++++++------- src/server/collision/Models/GameObjectModel.cpp | 2 +- src/server/collision/Models/GameObjectModel.h | 4 +-- src/server/collision/RegularGrid.h | 4 +-- src/server/game/AI/SmartScripts/SmartAI.cpp | 10 ++++---- src/server/game/AI/SmartScripts/SmartAI.h | 2 +- src/server/game/AI/SmartScripts/SmartScript.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 14 +++++----- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 6 ++--- src/server/game/Chat/Commands/TicketCommands.cpp | 2 +- src/server/game/Conditions/ConditionMgr.cpp | 8 +++--- src/server/game/DungeonFinding/LFGMgr.cpp | 14 +++++----- src/server/game/Entities/GameObject/GameObject.h | 4 +-- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Handlers/AuctionHouseHandler.cpp | 4 +-- src/server/game/Handlers/CalendarHandler.cpp | 4 +-- src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/game/Maps/Map.h | 2 +- .../WaypointMovementGenerator.cpp | 10 ++++---- src/server/game/Spells/Auras/SpellAuraEffects.h | 2 +- src/server/game/Spells/Auras/SpellAuras.cpp | 2 +- src/server/game/Spells/Auras/SpellAuras.h | 2 +- src/server/game/World/World.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- src/server/scripts/Commands/cs_go.cpp | 2 +- .../EasternKingdoms/AlteracValley/boss_vanndar.cpp | 2 +- .../BlackrockDepths/blackrock_depths.cpp | 2 +- .../scripts/EasternKingdoms/arathi_highlands.cpp | 2 +- src/server/scripts/Examples/example_spell.cpp | 4 +-- .../BlackfathomDeeps/blackfathom_deeps.cpp | 6 ++--- .../CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp | 2 +- .../Kalimdor/Maraudon/boss_celebras_the_cursed.cpp | 6 ++--- .../scripts/Kalimdor/Maraudon/boss_landslide.cpp | 6 ++--- .../scripts/Kalimdor/Maraudon/boss_noxxion.cpp | 8 +++--- .../Kalimdor/Maraudon/boss_princess_theradras.cpp | 8 +++--- src/server/scripts/Kalimdor/desolace.cpp | 2 +- .../IcecrownCitadel/icecrown_citadel_teleport.cpp | 2 +- .../scripts/Northrend/Nexus/Oculus/boss_urom.cpp | 2 +- .../scripts/Northrend/Nexus/Oculus/oculus.cpp | 2 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp | 2 +- .../UtgardeKeep/UtgardeKeep/boss_keleseth.cpp | 4 +-- .../UtgardeKeep/UtgardePinnacle/boss_svala.cpp | 30 +++++++++++----------- src/server/scripts/Northrend/dalaran.cpp | 2 +- src/server/scripts/Northrend/sholazar_basin.cpp | 2 +- .../scripts/Outland/blades_edge_mountains.cpp | 2 +- src/server/scripts/Spells/spell_dk.cpp | 8 +++--- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/scripts/Spells/spell_hunter.cpp | 6 ++--- src/server/scripts/Spells/spell_item.cpp | 12 ++++----- src/server/scripts/Spells/spell_mage.cpp | 2 +- src/server/scripts/Spells/spell_priest.cpp | 2 +- src/server/scripts/Spells/spell_quest.cpp | 2 +- src/server/scripts/Spells/spell_rogue.cpp | 4 +-- src/server/scripts/Spells/spell_shaman.cpp | 6 ++--- src/server/scripts/Spells/spell_warlock.cpp | 4 +-- src/server/scripts/Spells/spell_warrior.cpp | 2 +- src/server/scripts/World/go_scripts.cpp | 2 +- .../Database/Implementation/CharacterDatabase.h | 2 +- src/server/shared/Threading/Callback.h | 2 +- 63 files changed, 143 insertions(+), 143 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h index 0b4f5908c04..079c0adbf5e 100644 --- a/src/server/collision/DynamicTree.h +++ b/src/server/collision/DynamicTree.h @@ -16,7 +16,7 @@ * with this program. If not, see . */ - + #ifndef _DYNTREE_H #define _DYNTREE_H diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index cfd50c318df..68ea3ec80cd 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -258,7 +258,7 @@ namespace VMAP uint32 groups = raw_model.groupsArray.size(); if (groups != 1) printf("Warning: '%s' does not seem to be a M2 model!\n", modelFilename.c_str()); - + AABox modelBound; bool boundEmpty=true; @@ -308,7 +308,7 @@ namespace VMAP WorldModel_Raw raw_model; if (!raw_model.Read(filename.c_str())) return false; - + // write WorldModel WorldModel model; model.setRootWmoID(raw_model.RootWMOID); @@ -327,12 +327,12 @@ namespace VMAP model.setGroupModels(groupsArray); } - + success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo"); //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; return success; } - + void TileAssembler::exportGameobjectModels() { FILE* model_list = fopen((iSrcDir + "/" + GAMEOBJECT_MODELS).c_str(), "rb"); @@ -405,13 +405,13 @@ namespace VMAP READ_OR_RETURN(&mogpflags, sizeof(uint32)); READ_OR_RETURN(&GroupWMOID, sizeof(uint32)); - + Vector3 vec1, vec2; READ_OR_RETURN(&vec1, sizeof(Vector3)); READ_OR_RETURN(&vec2, sizeof(Vector3)); bounds.set(vec1, vec2); - + READ_OR_RETURN(&liquidflags, sizeof(uint32)); // will this ever be used? what is it good for anyway?? @@ -475,7 +475,7 @@ namespace VMAP size = hlq.xtiles*hlq.ytiles; READ_OR_RETURN(liquid->GetFlagsStorage(), size); } - + return true; } @@ -484,7 +484,7 @@ namespace VMAP { delete liquid; } - + bool WorldModel_Raw::Read(const char * path) { FILE* rf = fopen(path, "rb"); @@ -493,7 +493,7 @@ namespace VMAP printf("ERROR: Can't open raw model file: %s\n", path); return false; } - + char ident[8]; int readOperation = 0; diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 4c0a344f868..1abbc59a5b0 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ - + #include "VMapFactory.h" #include "VMapManager2.h" #include "VMapDefinitions.h" diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h index 413061c0de0..0bb6c0f47bc 100644 --- a/src/server/collision/Models/GameObjectModel.h +++ b/src/server/collision/Models/GameObjectModel.h @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ - + #ifndef _GAMEOBJECT_MODEL_H #define _GAMEOBJECT_MODEL_H @@ -57,7 +57,7 @@ public: const G3D::Vector3& getPosition() const { return iPos;} - /** Enables\disables collision. */ + /** Enables\disables collision. */ void disable() { phasemask = 0;} void enable(uint32 ph_mask) { phasemask = ph_mask;} diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index 2c11b1c257d..2867b29cfc1 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -135,7 +135,7 @@ public: float ky_inv = ray.invDirection().y, by = ray.origin().y; int stepX, stepY; - float tMaxX, tMaxY; + float tMaxX, tMaxY; if (kx_inv >= 0) { stepX = 1; @@ -215,4 +215,4 @@ public: #undef CELL_SIZE #undef HGRID_MAP_SIZE -#endif +#endif diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 07a8e3fdca7..7838e6891fe 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -450,7 +450,7 @@ void SmartAI::EnterEvadeMode() return; RemoveAuras(); - + me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(); @@ -480,15 +480,15 @@ void SmartAI::MoveInLineOfSight(Unit* who) { if (!who) return; - + GetScript()->OnMoveInLineOfSight(who); - + if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who)) return; if (!CanAIAttack(who)) return; - + if (!me->canStartAttack(who, false)) return; @@ -827,7 +827,7 @@ void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker) GetScript()->mLastInvoker = invoker->GetGUID(); GetScript()->SetScript9(e, entry); } - + void SmartAI::sOnGameEvent(bool start, uint16 eventId) { GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId); diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index a40254fe384..e82b35ec87a 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -195,7 +195,7 @@ class SmartAI : public CreatureAI mDespawnState = t ? 1 : 0; } void StartDespawn() { mDespawnState = 2; } - + void RemoveAuras(); private: diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c716741371e..ae2558830b5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -88,7 +88,7 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3 ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject()); meets = sConditionMgr->IsObjectMeetToConditions(info, conds); - + if (meets) ProcessEvent(*i, unit, var0, var1, bvar, spell, gob); } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 9a23d9e1390..f99e317454c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -260,7 +260,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) } case SMART_TARGET_GAMEOBJECT_GUID: { - if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry)) + if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry)) return false; break; } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index e08fe331d3d..5cc7d0e716c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -154,7 +154,7 @@ enum SMART_EVENT SMART_EVENT_IS_BEHIND_TARGET = 67, //1 // cooldownMin, CooldownMax SMART_EVENT_GAME_EVENT_START = 68, //1 // game_event.Entry SMART_EVENT_GAME_EVENT_END = 69, //1 // game_event.Entry - SMART_EVENT_GO_STATE_CHANGED = 70, // go state + SMART_EVENT_GO_STATE_CHANGED = 70, // go state SMART_EVENT_END = 71, }; @@ -341,16 +341,16 @@ struct SmartEvent uint32 cooldownMax; } behindTarget; - struct + struct { uint32 gameEventId; } gameEvent; - + struct { uint32 state; } goStateChanged; - + struct { uint32 param1; @@ -872,7 +872,7 @@ struct SmartAction { uint32 goRespawnTime; } RespawnTarget; - + struct { uint32 gossipMenuId; @@ -883,12 +883,12 @@ struct SmartAction { uint32 state; } setGoLootState; - + struct { uint32 id; } sendTargetToTarget; - + struct { uint32 param1; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 3c3d5e1655b..98bb704661e 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -102,7 +102,7 @@ void BattlegroundRV::StartingEventOpenDoors() setState(BG_RV_STATE_OPEN_FENCES); setTimer(BG_RV_FIRST_TIMER); - + TogglePillarCollision(true); } @@ -239,11 +239,11 @@ void BattlegroundRV::TogglePillarCollision(bool apply) if (gob->GetGOInfo()->door.startOpen) _state = GO_STATE_ACTIVE; gob->SetGoState(apply ? (GOState)_state : (GOState)(!_state)); - + if (gob->GetGOInfo()->door.startOpen) gob->EnableCollision(!apply); // Forced collision toggle } - + for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) gob->SendUpdateToPlayer(player); diff --git a/src/server/game/Chat/Commands/TicketCommands.cpp b/src/server/game/Chat/Commands/TicketCommands.cpp index 138466f9623..177899efbf0 100755 --- a/src/server/game/Chat/Commands/TicketCommands.cpp +++ b/src/server/game/Chat/Commands/TicketCommands.cpp @@ -257,7 +257,7 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args) ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), + std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), m_session ? m_session->GetPlayer()->GetName() : "Console", NULL); SendGlobalGMSysMessage(msg.c_str()); return true; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 320a02a30ed..ea4a52f0612 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -193,7 +193,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_OBJECT_ENTRY: { if (object->GetTypeId() == ConditionValue1) - condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); + condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); break; } case CONDITION_TYPE_MASK: @@ -302,8 +302,8 @@ uint32 Condition::GetMaxAvailableConditionTargets() case CONDITION_SOURCE_TYPE_GOSSIP_MENU: case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: return 2; - case CONDITION_SOURCE_TYPE_SMART_EVENT: - return 2; + case CONDITION_SOURCE_TYPE_SMART_EVENT: + return 2; default: return 1; } @@ -1437,7 +1437,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) return false; } if (cond->ConditionValue3) - sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TYPE_MASK: diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index cccb780e412..e6039880b63 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -83,12 +83,12 @@ void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) uint32 dungeon = fields[16].GetUInt32(); uint8 state = fields[17].GetUInt8(); - + if (!dungeon || !state) return; SetDungeon(guid, dungeon); - + switch (state) { case LFG_STATE_DUNGEON: @@ -104,19 +104,19 @@ void LFGMgr::_SaveToDB(uint64 guid, uint32 db_guid) { if (!IS_GROUP(guid)) return; - + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); stmt->setUInt32(0, db_guid); CharacterDatabase.Execute(stmt); - + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LFG_DATA); stmt->setUInt32(0, db_guid); - + stmt->setUInt32(1, GetDungeon(guid)); stmt->setUInt32(2, GetState(guid)); - + CharacterDatabase.Execute(stmt); } @@ -999,7 +999,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal) LfgQueueInfo* queue = itQueue->second; if (!queue) continue; - + for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer) { if (*itPlayers == ObjectAccessor::FindPlayer(itPlayer->first)) diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index a4635ca6dfb..a4fece4d301 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -710,7 +710,7 @@ class GameObject : public WorldObject, public GridObject uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0); - + void SetPhaseMask(uint32 newPhaseMask, bool update); void EnableCollision(bool enable); @@ -795,7 +795,7 @@ class GameObject : public WorldObject, public GridObject std::string GetAIName() const; void SetDisplayId(uint32 displayid); - + GameObjectModel * m_model; protected: bool AIM_Initialize(); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 941d898c1fb..42c0823c3da 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14828,7 +14828,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) uint16 log_slot = FindQuestSlot(0); if (log_slot >= MAX_QUEST_LOG_SIZE) // Player does not have any free slot in the quest log - return; + return; uint32 quest_id = quest->GetQuestId(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4670a976e42..91263882a8c 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14826,7 +14826,7 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const // remove current target if (getVictim()) targets.remove(getVictim()); - + if (exclude) targets.remove(exclude); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 5a5ae0325e3..f99bfe52df3 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -128,7 +128,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR); return; } - + for (uint32 i = 0; i < itemsCount; ++i) { recv_data >> itemGUIDs[i]; @@ -188,7 +188,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) return; } - if (sAuctionMgr->GetAItem(item->GetGUIDLow()) || !item->CanBeTraded() || item->IsNotEmptyBag() || + if (sAuctionMgr->GetAItem(item->GetGUIDLow()) || !item->CanBeTraded() || item->IsNotEmptyBag() || item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) || item->GetCount() < count[i]) { diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index be547c84b19..820079a90e1 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -88,7 +88,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) data << uint32(counter); // raid reset count std::set sentMaps; - + ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap(); for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr) { @@ -102,7 +102,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) continue; sentMaps.insert(mapId); - + data << uint32(mapId); data << uint32(itr->second - cur_time); data << uint32(mapEntry->unk_time); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index d677424496a..a48cf70bd54 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -197,7 +197,7 @@ bool LoginQueryHolder::Initialize() stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES); stmt->setUInt32(0, m_accountId); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES, stmt); - + return res; } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 9f4dbb23b63..d8db4c947a3 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -171,7 +171,7 @@ class GridMap uint8 _liquidOffY; uint8 _liquidWidth; uint8 _liquidHeight; - + bool loadAreaData(FILE* in, uint32 offset, uint32 size); bool loadHeihgtData(FILE* in, uint32 offset, uint32 size); diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 1871454d614..fb2249c508e 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -111,8 +111,8 @@ bool WaypointMovementGenerator::StartMove(Creature &creature) m_isArrivalDone = false; - creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); - + creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); + Movement::MoveSplineInit init(creature); init.MoveTo(node->x, node->y, node->z); @@ -147,7 +147,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 if (CanMove(diff)) return StartMove(creature); } - else + else { if (creature.IsStopped()) Stop(STOP_TIME_FOR_PLAYER); @@ -155,7 +155,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 { OnArrived(creature); return StartMove(creature); - } + } } return true; } @@ -293,7 +293,7 @@ bool FlightPathMovementGenerator::GetResetPosition(Player&, float& x, float& y, x = node.x; y = node.y; z = node.z; return true; } - + void FlightPathMovementGenerator::InitEndGridInfo() { /*! Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 490f33f46e1..64079918638 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -104,7 +104,7 @@ class AuraEffect int32 m_periodicTimer; int32 m_amplitude; uint32 m_tickNumber; - + uint8 const m_effIndex; bool m_canBeRecalculated; bool m_isPeriodic; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 1260425ef55..5329c1a0914 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2045,7 +2045,7 @@ void Aura::TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo) if (aurApp->HasEffect(i)) // TODO: OnEffectProc hook here (allowing prevention of selected effects) GetEffect(i)->HandleProc(aurApp, eventInfo); - // TODO: AfterEffectProc hook here + // TODO: AfterEffectProc hook here // TODO: AfterProc hook here diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 0af8d132211..79a068589f9 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -186,7 +186,7 @@ class Aura bool CanStackWith(Aura const* existingAura) const; // Proc system - // this subsystem is not yet in use - the core of it is functional, but still some research has to be done + // this subsystem is not yet in use - the core of it is functional, but still some research has to be done // and some dependant problems fixed before it can replace old proc system (for example cooldown handling) // currently proc system functionality is implemented in Unit::ProcDamageAndSpell bool IsProcOnCooldown() const; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 354b36ba93b..a31f2618d61 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1276,7 +1276,7 @@ void World::SetInitialWorldSettings() sLog->outString("Loading GameObject models..."); LoadGameObjectModelList(); - + sLog->outString("Loading Script Names..."); sObjectMgr->LoadScriptNames(); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 3de1181f764..8ca40231090 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1041,7 +1041,7 @@ public: handler->GetSession()->GetPlayer()->HandleEmoteCommand(animId); return true; } - + static bool HandleDebugLoSCommand(ChatHandler* handler, char const* /*args*/) { if (Unit* unit = handler->getSelectedUnit()) diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 3de0d89bac5..f7371884da2 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -496,7 +496,7 @@ public: float z; float ort = port ? (float)atof(port) : player->GetOrientation(); uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId(); - + if (goZ) { z = (float)atof(goZ); diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp index 54fcb9d99c2..3960351d395 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp @@ -24,7 +24,7 @@ enum Yells YELL_RESPAWN1 = -1810010, // no creature_text YELL_RESPAWN2 = -1810011, // no creature_text YELL_RANDOM = 2, - YELL_SPELL = 3, + YELL_SPELL = 3, }; enum Spells diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 17cf775603f..7ef11e5256a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -1301,7 +1301,7 @@ void AddSC_blackrock_depths() new npc_kharan_mighthammer(); new npc_lokhtos_darkbargainer(); new npc_rocknot(); - // Fix us + // Fix us /*new npc_dughal_stormwing(); new npc_tobias_seecher(); new npc_marshal_windsor(); diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp index e2a9717882b..82b09b9dc18 100644 --- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp +++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp @@ -73,7 +73,7 @@ class npc_professor_phizzlethorpe : public CreatureScript switch (uiPointId) { - case 4:Talk(SAY_PROGRESS_2, player->GetGUID());break; + case 4:Talk(SAY_PROGRESS_2, player->GetGUID());break; case 5:Talk(SAY_PROGRESS_3, player->GetGUID());break; case 8:Talk(EMOTE_PROGRESS_4);break; case 9: diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index b1a8f17d16a..71dbd7f4fb0 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -93,14 +93,14 @@ class spell_ex_5581 : public SpellScriptLoader void HandleAfterCast() { sLog->outString("All immediate actions for the spell are finished now"); - // this is a safe for triggering additional effects for a spell without interfering + // this is a safe for triggering additional effects for a spell without interfering // with visuals or with other effects of the spell //GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); } SpellCastResult CheckRequirement() { - // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) + // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) // in this case we're disallowing to select non-player as a target of the spell //if (!GetTargetUnit() || GetTargetUnit()->ToPlayer()) //return SPELL_FAILED_BAD_TARGETS; diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index 878116ad476..3bfaa448b85 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -165,14 +165,14 @@ public: DoCast(target, SPELL_FROST_BOLT_VOLLEY); } frostBoltVolleyTimer = urand(5000, 8000); - } + } else frostBoltVolleyTimer -= diff; - + if (frostNovaTimer <= diff) { DoCastAOE(SPELL_FROST_NOVA, false); frostNovaTimer = urand(25000, 30000); - } + } else frostNovaTimer -= diff; break; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 0caec3c7069..107c9e8f2f9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -947,7 +947,7 @@ void hyjalAI::HideNearPos(float x, float y) Trinity::AllFriendlyCreaturesInGrid creature_check(me); Trinity::CreatureListSearcher creature_searcher(me, creatures, creature_check); - TypeContainerVisitor , GridTypeMapContainer> creature_visitor(creature_searcher); + TypeContainerVisitor , GridTypeMapContainer> creature_visitor(creature_searcher); cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index 74e7a919263..38d9ce31563 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -77,7 +77,7 @@ public: if (target) DoCast(target, SPELL_WRATH); Wrath_Timer = 8000; - } + } else Wrath_Timer -= diff; //EntanglingRoots @@ -85,7 +85,7 @@ public: { DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); EntanglingRoots_Timer = 20000; - } + } else EntanglingRoots_Timer -= diff; //CorruptForces @@ -94,7 +94,7 @@ public: me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_CORRUPT_FORCES); CorruptForces_Timer = 20000; - } + } else CorruptForces_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp index 418bf3a09ce..ea419793ae8 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp @@ -71,7 +71,7 @@ public: { DoCast(me->getVictim(), SPELL_KNOCKAWAY); KnockAway_Timer = 15000; - } + } else KnockAway_Timer -= diff; //Trample_Timer @@ -79,7 +79,7 @@ public: { DoCast(me, SPELL_TRAMPLE); Trample_Timer = 8000; - } + } else Trample_Timer -= diff; //Landslide @@ -90,7 +90,7 @@ public: me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_LANDSLIDE); Landslide_Timer = 60000; - } + } else Landslide_Timer -= diff; } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp index 0e3ee5dc52b..18ce7be0f0a 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp @@ -80,7 +80,7 @@ public: me->SetDisplayId(11172); Invisible = false; //me->m_canMove = true; - } + } else if (Invisible) { Invisible_Timer -= diff; @@ -97,7 +97,7 @@ public: { DoCast(me->getVictim(), SPELL_TOXICVOLLEY); ToxicVolley_Timer = 9000; - } + } else ToxicVolley_Timer -= diff; //Uppercut_Timer @@ -105,7 +105,7 @@ public: { DoCast(me->getVictim(), SPELL_UPPERCUT); Uppercut_Timer = 12000; - } + } else Uppercut_Timer -= diff; //Adds_Timer @@ -127,7 +127,7 @@ public: Invisible_Timer = 15000; Adds_Timer = 40000; - } + } else Adds_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index bade5655f36..039d30071d2 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -77,7 +77,7 @@ public: { DoCast(me, SPELL_DUSTFIELD); Dustfield_Timer = 14000; - } + } else Dustfield_Timer -= diff; //Boulder_Timer @@ -88,7 +88,7 @@ public: if (target) DoCast(target, SPELL_BOULDER); Boulder_Timer = 10000; - } + } else Boulder_Timer -= diff; //RepulsiveGaze_Timer @@ -96,7 +96,7 @@ public: { DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); RepulsiveGaze_Timer = 20000; - } + } else RepulsiveGaze_Timer -= diff; //Thrash_Timer @@ -104,7 +104,7 @@ public: { DoCast(me, SPELL_THRASH); Thrash_Timer = 18000; - } + } else Thrash_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index 421a1d7b38a..49a9be21a98 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -175,7 +175,7 @@ public: ## Hand of Iruxos ######*/ -enum +enum { QUEST_HAND_IRUXOS = 5381, NPC_DEMON_SPIRIT = 11876, diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp index 0266db5f26b..af8aba57a6d 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp @@ -84,7 +84,7 @@ class at_frozen_throne_teleport : public AreaTriggerScript Spell::SendCastResult(player, spell, 0, SPELL_FAILED_AFFECTING_COMBAT); return true; } - + if (InstanceScript* instance = player->GetInstanceScript()) if (instance->GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE && instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE && diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index aef959aad70..9671d59bcec 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -289,7 +289,7 @@ public: void JustDied(Unit* /*killer*/) { _JustDied(); - DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur } void LeaveCombat() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index c687aad8bd2..11433bfde37 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -201,7 +201,7 @@ public: Talk(SAY_UROM); me->DespawnOrUnsummon(60000); } - } + } }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 8c637bc4e90..da46d016e91 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1670,7 +1670,7 @@ class spell_pursue : public SpellScriptLoader if (Creature* caster = GetCaster()->ToCreature()) caster->AI()->EnterEvadeMode(); } - else + else { //! In the end, only one target should be selected _target = SelectRandomContainerElement(targets); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 12d953a07b4..159e2a9702b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -593,7 +593,7 @@ class boss_freya : public CreatureScript void JustDied(Unit* /*who*/) { //! Freya's chest is dynamically spawned on death by different spells. - const uint32 summonSpell[2][4] = + const uint32 summonSpell[2][4] = { /* 0Elder, 1Elder, 2Elder, 3Elder */ /* 10N */ {62950, 62953, 62955, 62957}, diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 8a6d7f80818..93cc94923db 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -18,7 +18,7 @@ /* ScriptData SDName: Boss_Prince_Keleseth SD%Complete: 100 -SDComment: +SDComment: SDCategory: Utgarde Keep EndScriptData */ @@ -158,7 +158,7 @@ public: { if (data == DATA_ON_THE_ROCKS) return onTheRocks; - + return 0; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 989e1e57453..915ead98bb7 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -34,7 +34,7 @@ enum Spells SPELL_RITUAL_DISARM = 54159, SPELL_RITUAL_STRIKE_EFF_1 = 48277, SPELL_RITUAL_STRIKE_EFF_2 = 59930, - + SPELL_SUMMONED_VIS = 64446, SPELL_RITUAL_CHANNELER_1 = 48271, SPELL_RITUAL_CHANNELER_2 = 48274, @@ -62,7 +62,7 @@ enum Yells SAY_SLAY = 3, SAY_DEATH = 4, SAY_SACRIFICE_PLAYER = 5, - + // Image of Arthas SAY_DIALOG_OF_ARTHAS_1 = 0, SAY_DIALOG_OF_ARTHAS_2 = 1 @@ -101,7 +101,7 @@ enum SvalaPoint #define DATA_INCREDIBLE_HULK 2043 -static const float spectatorWP[2][3] = +static const float spectatorWP[2][3] = { {296.95f,-312.76f,86.36f}, {297.69f,-275.81f,86.36f} @@ -133,7 +133,7 @@ public: InstanceScript* instance; SummonList summons; SvalaPhase Phase; - + Position pos; float x, y, z; @@ -157,7 +157,7 @@ public: summons.DespawnAll(); me->RemoveAllAuras(); - + if (Phase > INTRO) { me->SetFlying(true); @@ -177,7 +177,7 @@ public: instance->SetData64(DATA_SACRIFICED_PLAYER, 0); } } - + void JustReachedHome() { if (Phase > INTRO) @@ -188,23 +188,23 @@ public: me->SendMovementFlagUpdate(); } } - + void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - + sinsterStrikeTimer = 7 * IN_MILLISECONDS; callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); if (instance) instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); } - + void JustSummoned(Creature* summon) { if (summon->GetEntry() == CREATURE_RITUAL_CHANNELER) summon->CastSpell(summon, SPELL_SUMMONED_VIS, true); - + summons.Summon(summon); } @@ -222,7 +222,7 @@ public: { Phase = INTRO; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - + if (GameObject* mirror = GetClosestGameObjectWithEntry(me, OBJECT_UTGARDE_MIRROR, 100.0f)) mirror->SetGoState(GO_STATE_READY); @@ -233,13 +233,13 @@ public: } } } - + void KilledUnit(Unit* victim) { if (victim != me) Talk(SAY_SLAY); } - + void DamageTaken(Unit* attacker, uint32 &damage) { if (Phase == SVALADEAD) @@ -532,7 +532,7 @@ public: if (IsHeroic()) DoCast(me, SPELL_SHADOWS_IN_THE_DARK); } - + void UpdateAI(const uint32 diff) { if (me->HasUnitState(UNIT_STATE_CASTING)) @@ -648,7 +648,7 @@ class npc_scourge_hulk : public CreatureScript { return type == DATA_INCREDIBLE_HULK ? killedByRitualStrike : 0; } - + void DamageTaken(Unit* attacker, uint32 &damage) { if (damage >= me->GetHealth() && attacker->GetEntry() == CREATURE_SVALA_SORROWGRAVE) diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index cd3cbf29d0d..258d038ee4b 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -75,7 +75,7 @@ public: return; Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself(); - + if (!player || player->isGameMaster() || player->IsBeingTeleported() || // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass player->HasAura(SPELL_SUNREAVER_DISGUISE_FEMALE) || player->HasAura(SPELL_SUNREAVER_DISGUISE_MALE) || diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 79e8da6fd77..36dc6177f64 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -676,7 +676,7 @@ enum MiscLifewarden NPC_SERVANT = 28320, // Servant of Freya WHISPER_ACTIVATE = 0, - + SPELL_FREYA_DUMMY = 51318, SPELL_LIFEFORCE = 51395, SPELL_FREYA_DUMMY_TRIGGER = 51335, diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index c9fdd0f65ff..f99851f013e 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -977,7 +977,7 @@ class npc_simon_bunny : public CreatureScript uint32 rewSpell = 0; switch (level) { - case 6: + case 6: if (large) GivePunishment(); else diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 2d90b5346a4..3822428cc75 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -698,7 +698,7 @@ class spell_dk_death_strike : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const @@ -747,7 +747,7 @@ class spell_dk_death_coil : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const @@ -776,7 +776,7 @@ class spell_dk_death_grip : public SpellScriptLoader GetSummonPosition(effIndex, pos, 0.0f, 0); if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence - target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); + target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); } } @@ -784,7 +784,7 @@ class spell_dk_death_grip : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index a34b16a9c22..b6a4ca8ce31 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1599,7 +1599,7 @@ class spell_gen_spirit_healer_res : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_gen_spirit_healer_res_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - }; + }; SpellScript* GetSpellScript() const { diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 13ad05b1930..029e571d935 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -50,12 +50,12 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader class spell_hun_aspect_of_the_beast_AuraScript : public AuraScript { PrepareAuraScript(spell_hun_aspect_of_the_beast_AuraScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - + bool Validate(SpellInfo const* /*entry*/) { if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET)) @@ -506,7 +506,7 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript { PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript); - + bool Load() { if (!GetCaster()->isPet()) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 844162a88ec..4f0c389825e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -813,7 +813,7 @@ class spell_item_book_of_glyph_mastery : public SpellScriptLoader class spell_item_book_of_glyph_mastery_SpellScript : public SpellScript { PrepareSpellScript(spell_item_book_of_glyph_mastery_SpellScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; @@ -1123,7 +1123,7 @@ class spell_item_purify_helboar_meat : public SpellScriptLoader { return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PURIFIED_HELBOAR_MEAT) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_TOXIC_HELBOAR_MEAT)) @@ -1162,7 +1162,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader class spell_item_crystal_prison_dummy_dnd_SpellScript : public SpellScript { PrepareSpellScript(spell_item_crystal_prison_dummy_dnd_SpellScript); - + bool Validate(SpellInfo const* /*spell*/) { if (!sObjectMgr->GetGameObjectTemplate(OBJECT_IMPRISONED_DOOMGUARD)) @@ -1229,7 +1229,7 @@ class spell_item_reindeer_transformation : public SpellScriptLoader caster->RemoveAurasByType(SPELL_AURA_MOUNTED); //5 different spells used depending on mounted speed and if mount can fly or not - + if (flyspeed >= 4.1f) // Flying Reindeer caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer @@ -1328,7 +1328,7 @@ class spell_item_poultryizer : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { - if (GetCastItem() && GetHitUnit()) + if (GetCastItem() && GetHitUnit()) GetCaster()->CastSpell(GetHitUnit(), roll_chance_i(80) ? SPELL_POULTRYIZER_SUCCESS : SPELL_POULTRYIZER_BACKFIRE , true, GetCastItem()); } @@ -1358,7 +1358,7 @@ class spell_item_socrethars_stone : public SpellScriptLoader class spell_item_socrethars_stone_SpellScript : public SpellScript { PrepareSpellScript(spell_item_socrethars_stone_SpellScript); - + bool Load() { return (GetCaster()->GetAreaId() == 3900 || GetCaster()->GetAreaId() == 3742); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 181b89ed5f8..adbaebdf827 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -87,7 +87,7 @@ class spell_mage_cold_snap : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - + Player* caster = GetCaster()->ToPlayer(); // immediately finishes the cooldown on Frost spells const SpellCooldowns& cm = caster->GetSpellCooldownMap(); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index b7793c919b6..b73d858f6a6 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -252,7 +252,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader Unit* target = GetTarget(); if (dmgInfo.GetAttacker() == target) return; - + if (Unit* caster = GetCaster()) if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) { diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 9b5e2b2ea09..ecd3317d7a7 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -993,7 +993,7 @@ class spell_q14112_14145_chum_the_water: public SpellScriptLoader class spell_q14112_14145_chum_the_water_SpellScript : public SpellScript { PrepareSpellScript(spell_q14112_14145_chum_the_water_SpellScript); - + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK)) diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 0be2bf6b40c..207d047d8db 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -258,7 +258,7 @@ class spell_rog_shiv : public SpellScriptLoader class spell_rog_shiv_SpellScript : public SpellScript { PrepareSpellScript(spell_rog_shiv_SpellScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; @@ -321,7 +321,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader return; Player* player = GetCaster()->ToPlayer(); - + if (Unit* target = GetHitUnit()) { diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index be5d04c1597..f334f8d2264 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -427,7 +427,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader { if (triggeringSpell) damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL)); - + // Restorative Totems if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1)) AddPctN(damage, dummy->GetAmount()); @@ -486,7 +486,7 @@ class spell_sha_mana_spring_totem : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_sha_mana_spring_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const @@ -529,7 +529,7 @@ class spell_sha_lava_lash : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_sha_lava_lash_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index bf1c205f1af..7a8aa79bec5 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -328,7 +328,7 @@ class spell_warl_soulshatter : public SpellScriptLoader { sLog->outString("THREATREDUCTION"); caster->CastSpell(target, SPELL_SOULSHATTER, true); - } else + } else sLog->outString("can have threat? %b . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster)); } @@ -363,7 +363,7 @@ class spell_warl_life_tap : public SpellScriptLoader class spell_warl_life_tap_SpellScript : public SpellScript { PrepareSpellScript(spell_warl_life_tap_SpellScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index cf4c7bfdec8..fa6f96c3c00 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -333,7 +333,7 @@ class spell_warr_execute : public SpellScriptLoader if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_GLYPH_OF_EXECUTION, EFFECT_0)) rageUsed += aurEff->GetAmount() * 10; - + int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); caster->CastCustomSpell(target,SPELL_EXECUTE,&bp,0,0,true,0,0,GetOriginalCaster()->GetGUID()); } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index fff01c83d07..3dfc85d7eb4 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1312,7 +1312,7 @@ class go_veil_skith_cage : public GameObjectScript (*itr)->AI()->Talk(SAY_FREE_0); (*itr)->GetMotionMaster()->Clear(); } - } + } return false; } }; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 18b488e055a..ca53712fbaa 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -351,7 +351,7 @@ enum CharacterDatabaseStatements CHAR_DEL_CHARACTER_SOCIAL, CHAR_UPD_CHARACTER_SOCIAL_NOTE, CHAR_UPD_CHARACTER_POSITION, - + CHAR_INS_LFG_DATA, CHAR_DEL_LFG_DATA, diff --git a/src/server/shared/Threading/Callback.h b/src/server/shared/Threading/Callback.h index fd7a1130fb4..3e1e7ac692f 100755 --- a/src/server/shared/Threading/Callback.h +++ b/src/server/shared/Threading/Callback.h @@ -96,7 +96,7 @@ class QueryCallback { return _stage; } - + //! Resets all underlying variables (param, result and stage) void Reset() { -- cgit v1.2.3