ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 00 00 00 01 00 08 06 00 00 00 5c 72 a8 | .PNG........IHDR.............\r. |
0020 | 66 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0e c3 00 | f....bKGD..............pHYs..... |
0040 | 00 0e c3 01 c7 6f a8 64 00 00 00 07 74 49 4d 45 07 e0 06 09 13 17 1c 27 3a ce f8 00 00 20 00 49 | .....o.d....tIME.......':......I |
0060 | 44 41 54 78 da ec bd 79 b0 75 d9 55 1f f6 5b 6b ef 7d 86 7b df fc 0d ad 6e b5 d4 b2 86 d6 d0 20 | DATx...y.u.U..[k.}.{....n....... |
0080 | 09 21 09 0c b4 15 14 01 0e 65 1b 22 84 84 04 84 a4 42 62 8c 84 22 0a 4c a8 10 8a 82 d8 71 2a 41 | .!.......e.".....Bb..".L.....q*A |
00a0 | 46 60 40 55 c4 11 06 63 03 45 51 31 f9 23 71 06 8b 2a 92 18 52 19 84 a0 24 31 58 a2 d0 d8 fd 8d | F`@U...c.EQ1.#q..*..R...$1X..... |
00c0 | ef bd 3b 9c 61 0f 2b 7f ec bd cf 3d f7 7e af 65 b5 d4 fd 19 f5 77 7e 5d b7 be d7 ef dd f7 de 7d | ..;.a.+....=.~.e.....w~].......} |
00e0 | f7 9c b5 f6 5a bf f5 5b 6b 01 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 | ....Z..[k..&L.0a....&L.0a....&L. |
0100 | 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 | 0a....&L.0a....&L.0a....&L.0a... |
0120 | 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 | .&L.0a....&L.0a....&L.0a....&L.0 |
0140 | 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 | a....&L.0a....&L.0a....&L.0a.... |
0160 | 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 | &L.0a....&L.0a....&L.0a....&L.0a |
0180 | c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 | ....&L.0a....&L.0a....&L.0a....& |
01a0 | 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 | L.0a....&L.0a....&L.0a....&L.0a. |
01c0 | 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c | ...&L.0a....&L.0a....&L.0a....&L |
01e0 | 98 30 61 c2 84 09 13 26 4c 98 30 61 c2 84 09 13 26 4c 98 30 6
(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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "irrlichttypes_extrabloated.h"
#include "activeobject.h"
#include <unordered_map>
#include <unordered_set>
class ClientEnvironment;
class ITextureSource;
class Client;
class IGameDef;
class LocalPlayer;
struct ItemStack;
class WieldMeshSceneNode;
class ClientActiveObject : public ActiveObject
{
public:
ClientActiveObject(u16 id, Client *client, ClientEnvironment *env);
virtual ~ClientActiveObject();
virtual void addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) = 0;
virtual void removeFromScene(bool permanent) {}
virtual void updateLight(u32 day_night_ratio) {}
virtual bool getCollisionBox(aabb3f *toset) const { return false; }
virtual bool getSelectionBox(aabb3f *toset) const { return false; }
virtual bool collideWithObjects() const { return false; }
virtual const v3f getPosition() const { return v3f(0.0f); }
virtual scene::ISceneNode *getSceneNode() const
{ return NULL; }
virtual scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode() const
{ return NULL; }
virtual bool isLocalPlayer() const { return false; }
virtual ClientActiveObject *getParent() const { return nullptr; };
virtual const std::unordered_set<int> &getAttachmentChildIds() const
{ static std::unordered_set<int> rv; return rv; }
virtual void updateAttachments() {};
virtual bool doShowSelectionBox() { return true; }
// Step object in time
virtual void step(float dtime, ClientEnvironment *env) {}
// Process a message sent by the server side object
virtual void processMessage(const std::string &data) {}
virtual std::string infoText() { return ""; }
virtual std::string debugInfoText() { return ""; }
/*
This takes the return value of
ServerActiveObject::getClientInitializationData
*/
virtual void initialize(const std::string &data) {}
// Create a certain type of ClientActiveObject
static ClientActiveObject *create(ActiveObjectType type, Client *client,
ClientEnvironment *env);
// If returns true, punch will not be sent to the server
virtual bool directReportPunch(v3f dir, const ItemStack *punchitem = nullptr,
float time_from_last_punch = 1000000) { return false; }
protected:
// Used for creating objects based on type
typedef ClientActiveObject *(*Factory)(Client *client, ClientEnvironment *env);
static void registerType(u16 type, Factory f);
Client *m_client;
ClientEnvironment *m_env;
private:
// Used for creating objects based on type
static std::unordered_map<u16, Factory> m_types;
};
class DistanceSortedActiveObject
{
public:
ClientActiveObject *obj;
DistanceSortedActiveObject(ClientActiveObject *a_obj, f32 a_d)
{
obj = a_obj;
d = a_d;
}
bool operator < (const DistanceSortedActiveObject &other) const
{
return d < other.d;
}
private:
f32 d;
};
|