diff --git a/common/gameplay/barrier_defines.hpp b/common/gameplay/barrier_defines.hpp new file mode 100644 index 0000000..79219d9 --- /dev/null +++ b/common/gameplay/barrier_defines.hpp @@ -0,0 +1,28 @@ +/* Copyright: (c) Kayne Ruse 2013-2016 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#pragma once + +//the bounds for the objects, mapped to the default sprites +constexpr int BARRIER_BOUNDS_X = 0; +constexpr int BARRIER_BOUNDS_Y = 0; +constexpr int BARRIER_BOUNDS_WIDTH = 96; +constexpr int BARRIER_BOUNDS_HEIGHT = 96; diff --git a/server/rooms/room_data.cpp b/server/rooms/room_data.cpp index 4165554..8819c74 100644 --- a/server/rooms/room_data.cpp +++ b/server/rooms/room_data.cpp @@ -21,6 +21,7 @@ */ #include "room_data.hpp" +#include "barrier_defines.hpp" #include "culling_defines.hpp" #include "serial_packet.hpp" #include "server_utilities.hpp" @@ -77,6 +78,10 @@ void RoomData::RunFrame() { int barrierIndex = barrierMgr.Create(-1); BarrierData* barrierData = barrierMgr.Find(barrierIndex); barrierData->SetRoomIndex(roomIndex); + barrierData->SetOrigin({ + (CREATURE_BOUNDS_WIDTH - BARRIER_BOUNDS_WIDTH) / 2 + creatureBox.x, + (CREATURE_BOUNDS_HEIGHT - BARRIER_BOUNDS_HEIGHT) / 2 + creatureBox.y, + }); BarrierPacket barrierPacket; barrierPacket.type = SerialPacketType::BARRIER_CREATE;