Skip to content

Commit

Permalink
Removed Unit::BuildMovementPacket, an unneeded ASSERT and fixed some …
Browse files Browse the repository at this point in the history
…stuff in Gate of the Setting Sun, WIP.
  • Loading branch information
cocolino committed Sep 27, 2015
1 parent 2a47f1d commit b08a2a4
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 149 deletions.
3 changes: 2 additions & 1 deletion src/server/game/Entities/Player/PlayerMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ void Player::ReadMovementInfo(WorldPacket& data, MovementInfo* mi, ExtraMovement
bitcounterLoop = data.ReadBits(22);
break;
case MSEUnkUIntLoop:
data.read_skip(bitcounterLoop * sizeof(uint32));
for (int i = 0; i != bitcounterLoop; i++)
data.read_skip<uint32>();
break;
case MSEFlushBits:
data.FlushBits();
Expand Down
90 changes: 0 additions & 90 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21421,96 +21421,6 @@ void Unit::_ExitVehicle(Position const* exitPosition)
}
}

void Unit::BuildMovementPacket(ByteBuffer *data) const
{
*data << uint32(GetUnitMovementFlags()); // movement flags
*data << uint16(GetExtraUnitMovementFlags()); // 2.3.0
*data << uint32(getMSTime()); // time / counter
*data << GetPositionX();
*data << GetPositionY();
*data << GetPositionZMinusOffset();
*data << GetOrientation();

bool onTransport = m_movementInfo.t_guid != 0;
bool hasInterpolatedMovement = m_movementInfo.flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT;
bool time3 = false;
bool swimming = ((GetUnitMovementFlags() & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING))
|| (m_movementInfo.flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING));
bool interPolatedTurning = m_movementInfo.flags2 & MOVEMENTFLAG2_INTERPOLATED_TURNING;
bool jumping = GetUnitMovementFlags() & MOVEMENTFLAG_FALLING;
bool splineElevation = m_movementInfo.HaveSplineElevation;
bool hasSpline = IsSplineEnabled();

// Fix player movement visibility during being CC-ed.
if (GetTypeId() == TYPEID_PLAYER && IsInCC() && !hasSpline)
hasSpline = true;

data->WriteBits(GetUnitMovementFlags(), 30);
data->WriteBits(m_movementInfo.flags2, 12);
data->WriteBit(onTransport);
if (onTransport)
{
data->WriteBit(hasInterpolatedMovement);
data->WriteBit(time3);
}

data->WriteBit(swimming);
data->WriteBit(interPolatedTurning);
if (interPolatedTurning)
data->WriteBit(jumping);

data->WriteBit(splineElevation);
data->WriteBit(hasSpline);

data->FlushBits(); // reset bit stream

*data << uint64(GetGUID());
*data << uint32(getMSTime());
*data << float(GetPositionX());
*data << float(GetPositionY());
*data << float(GetPositionZ());
*data << float(GetOrientation());

if (onTransport)
{
if (m_vehicle)
*data << uint64(m_vehicle->GetBase()->GetGUID());
else if (GetTransport())
*data << uint64(GetTransport()->GetGUID());
else // probably should never happen
*data << (uint64)0;

*data << float (GetTransOffsetX());
*data << float (GetTransOffsetY());
*data << float (GetTransOffsetZ());
*data << float (GetTransOffsetO());
*data << uint8 (GetTransSeat());
*data << uint32(GetTransTime());
if (hasInterpolatedMovement)
*data << int32(0); // Transport Time 2
if (time3)
*data << int32(0); // Transport Time 3
}

if (swimming)
*data << (float)m_movementInfo.pitch;

if (interPolatedTurning)
{
*data << (uint32)m_movementInfo.fallTime;
*data << (float)m_movementInfo.j_zspeed;
if (jumping)
{
*data << (float)m_movementInfo.j_sinAngle;
*data << (float)m_movementInfo.j_cosAngle;
*data << (float)m_movementInfo.j_xyspeed;
}
}

if (splineElevation)
*data << (float)m_movementInfo.splineElevation;
}

void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool casting /*= false*/)
{
DisableSpline();
Expand Down
2 changes: 0 additions & 2 deletions src/server/game/Entities/Unit/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2271,8 +2271,6 @@ class Unit : public WorldObject
void _ExitVehicle(Position const* exitPosition = NULL);
void _EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp = NULL);

void BuildMovementPacket(ByteBuffer *data) const;

void RewardRage(uint32 baseRage, bool attacker, bool useBonus = true);

virtual float GetFollowAngle() const { return static_cast<float>(M_PI/2); }
Expand Down
8 changes: 0 additions & 8 deletions src/server/game/Entities/Unit/UnitMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,6 @@ void Unit::SendMovementHover(bool apply)
{
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendMovementSetHover(HasUnitMovementFlag(MOVEMENTFLAG_HOVER));

if (apply)
{
/*WorldPacket data(MSG_MOVE_HOVER, 64);
data.append(GetPackGUID());
BuildMovementPacket(&data);
SendMessageToSet(&data, false);*/
}
}

void Unit::SetFeared(bool apply)
Expand Down
1 change: 0 additions & 1 deletion src/server/game/Movement/Spline/MovementPacketBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ namespace Movement
void PacketBuilder::WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data)
{
bool isSplineEnabled = moveSpline.Initialized() && !moveSpline.Finalized();
ASSERT(isSplineEnabled);

if (isSplineEnabled)
{
Expand Down
34 changes: 25 additions & 9 deletions src/server/scripts/Pandaria/GateSettingSun/gate_setting_sun.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
/*
Dungeon : Gate of the Setting Sun 90-90
Instance General Script
*/

#ifndef STORMSTOUT_BREWERY_H_
#define STORMSTOUT_BREWERY_H_
* Copyright (C) 2011-2015 SkyMist Gaming
*
* 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 <http://www.gnu.org/licenses/>.
*
* Dungeon: Dungeon : Gate of the Setting Sun.
* Description: Header Script.
*/

#ifndef DEF_GATE_SETTING_SUN_H_
#define DEF_GATE_SETTING_SUN_H_

#include "SpellScript.h"
#include "Map.h"
#include "Creature.h"
#include "CreatureAIImpl.h"

uint32 const EncounterCount = 4;
#define MAX_ENCOUNTERS 4

enum DataTypes
enum DataTypes // Events / Encounters.
{
DATA_KIPTILAK = 0,
DATA_GADOK = 1,
Expand All @@ -26,6 +41,7 @@ enum DataTypes
DATA_BRASIER_CLICKED = 6,
DATA_RANDOM_BOMBARDER = 7,
DATA_RANDOM_BOMB_STALKER = 8,

MAX_DATA
};

Expand Down Expand Up @@ -104,4 +120,4 @@ enum eSettingSun
CINEMATIC_SETTING_SUN = 265
};

#endif // STORMSTOUT_BREWERY_H_
#endif // DEF_GATE_SETTING_SUN_H_
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
/*
Dungeon : Gate of the Setting Sun 90-90
Instance General Script
*/
* Copyright (C) 2011-2015 SkyMist Gaming
*
* 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 <http://www.gnu.org/licenses/>.
*
* Dungeon: Gate of the Setting Sun.
* Description: Instance Script.
*/

#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "Player.h"
#include "Unit.h"
#include "ObjectAccessor.h"
#include "Group.h"

#include "gate_setting_sun.h"

DoorData const doorData[] =
Expand All @@ -18,51 +37,50 @@ DoorData const doorData[] =
{GO_RIMAK_AFTER_DOOR, DATA_RIMOK, DOOR_TYPE_ROOM, BOUNDARY_S },
{GO_RAIGONN_DOOR, DATA_RAIGONN, DOOR_TYPE_ROOM, BOUNDARY_NE },
{GO_RAIGONN_AFTER_DOOR, DATA_RAIGONN, DOOR_TYPE_PASSAGE, BOUNDARY_E },
{0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE},// END

{0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE}, // END
};

class instance_gate_setting_sun : public InstanceMapScript
{
public:
instance_gate_setting_sun() : InstanceMapScript("instance_gate_setting_sun", 962) { }

InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_gate_setting_sun_InstanceMapScript(map);
}
public:
instance_gate_setting_sun() : InstanceMapScript("instance_gate_setting_sun", 962) { }

struct instance_gate_setting_sun_InstanceMapScript : public InstanceScript
{
uint64 kiptilakGuid;
uint64 gadokGuid;
uint64 rimokGuid;
uint64 raigonnGuid;
uint64 raigonWeakGuid;
struct instance_gate_setting_sun_InstanceMapScript : public InstanceScript
{
instance_gate_setting_sun_InstanceMapScript(Map* map) : InstanceScript(map)
{
Initialize();
}

uint64 firstDoorGuid;
uint64 fireSignalGuid;
// Bosses.
uint64 kiptilakGuid;
uint64 gadokGuid;
uint64 rimokGuid;
uint64 raigonnGuid;

uint64 wallCGuid;
uint64 portalTempGadokGuid;
uint64 raigonWeakGuid;

uint32 cinematicTimer;
uint8 cinematicEventProgress;
uint64 firstDoorGuid;
uint64 fireSignalGuid;
uint64 wallCGuid;
uint64 portalTempGadokGuid;

std::list<uint64> bombarderGuids;
std::list<uint64> bombStalkerGuids;
std::list<uint64> mantidBombsGUIDs;
std::list<uint64> rimokAddGenetarorsGUIDs;
std::list<uint64> artilleryGUIDs;
std::list<uint64> secondaryDoorGUIDs;
uint32 cinematicTimer;
uint8 cinematicEventProgress;

uint32 dataStorage[MAX_DATA];
std::list<uint64> bombarderGuids;
std::list<uint64> bombStalkerGuids;
std::list<uint64> mantidBombsGUIDs;
std::list<uint64> rimokAddGeneratorsGUIDs;
std::list<uint64> artilleryGUIDs;
std::list<uint64> secondaryDoorGUIDs;

instance_gate_setting_sun_InstanceMapScript(Map* map) : InstanceScript(map)
{}
uint32 dataStorage[MAX_DATA];

void Initialize()
{
SetBossNumber(EncounterCount);
SetBossNumber(MAX_ENCOUNTERS);
LoadDoorData(doorData);

kiptilakGuid = 0;
Expand All @@ -84,7 +102,7 @@ class instance_gate_setting_sun : public InstanceMapScript
bombarderGuids.clear();
bombStalkerGuids.clear();
mantidBombsGUIDs.clear();
rimokAddGenetarorsGUIDs.clear();
rimokAddGeneratorsGUIDs.clear();
artilleryGUIDs.clear();
secondaryDoorGUIDs.clear();
}
Expand Down Expand Up @@ -118,7 +136,7 @@ class instance_gate_setting_sun : public InstanceMapScript
case NPC_RAIGONN: raigonnGuid = creature->GetGUID(); return;
case NPC_KRITHUK_BOMBARDER: bombarderGuids.push_back(creature->GetGUID()); return;
case NPC_BOMB_STALKER: bombStalkerGuids.push_back(creature->GetGUID()); return;
case NPC_ADD_GENERATOR: rimokAddGenetarorsGUIDs.push_back(creature->GetGUID()); return;
case NPC_ADD_GENERATOR: rimokAddGeneratorsGUIDs.push_back(creature->GetGUID()); return;
case NPC_ARTILLERY: artilleryGUIDs.push_back(creature->GetGUID()); return;
default: return;
}
Expand Down Expand Up @@ -204,7 +222,7 @@ class instance_gate_setting_sun : public InstanceMapScript
for (auto itr: secondaryDoorGUIDs)
HandleGameObject(itr, state != DONE);

for (auto itr: rimokAddGenetarorsGUIDs)
for (auto itr: rimokAddGeneratorsGUIDs)
{
if (Creature* generator = instance->GetCreature(itr))
{
Expand Down Expand Up @@ -379,6 +397,10 @@ class instance_gate_setting_sun : public InstanceMapScript
}
};

InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_gate_setting_sun_InstanceMapScript(map);
}
};

void AddSC_instance_gate_setting_sun()
Expand Down

0 comments on commit b08a2a4

Please sign in to comment.