aboutsummaryrefslogtreecommitdiff
path: root/src/mapblockobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapblockobject.h')
-rw-r--r--src/mapblockobject.h241
1 files changed, 0 insertions, 241 deletions
diff --git a/src/mapblockobject.h b/src/mapblockobject.h
index 61bd6610d..8518d6b11 100644
--- a/src/mapblockobject.h
+++ b/src/mapblockobject.h
@@ -220,119 +220,6 @@ protected:
};
#endif
-class TestObject : public MapBlockObject
-{
-public:
- // The constructor of every MapBlockObject should be like this
- TestObject(MapBlock *block, s16 id, v3f pos):
- MapBlockObject(block, id, pos),
- m_node(NULL)
- {
- }
- virtual ~TestObject()
- {
- }
-
- /*
- Implementation interface
- */
- virtual u16 getTypeId() const
- {
- return MAPBLOCKOBJECT_TYPE_TEST;
- }
- virtual void serialize(std::ostream &os, u8 version)
- {
- serializeBase(os, version);
-
- // Write subpos_c * 100
- u8 buf[2];
- writeU16(buf, m_subpos_c * 100);
- os.write((char*)buf, 2);
- }
- virtual void update(std::istream &is, u8 version)
- {
- // Read subpos_c * 100
- u8 buf[2];
- is.read((char*)buf, 2);
- m_subpos_c = (f32)readU16(buf) / 100;
-
- updateNodePos();
- }
- virtual bool serverStep(float dtime)
- {
- m_subpos_c += dtime * 3.0;
-
- updateNodePos();
-
- return false;
- }
- virtual void addToScene(scene::ISceneManager *smgr)
- {
- if(m_node != NULL)
- return;
-
- //dstream<<"Adding to scene"<<std::endl;
-
- video::IVideoDriver* driver = smgr->getVideoDriver();
-
- scene::SMesh *mesh = new scene::SMesh();
- scene::IMeshBuffer *buf = new scene::SMeshBuffer();
- video::SColor c(255,255,255,255);
- video::S3DVertex vertices[4] =
- {
- video::S3DVertex(-BS/2,0,0, 0,0,0, c, 0,1),
- video::S3DVertex(BS/2,0,0, 0,0,0, c, 1,1),
- video::S3DVertex(BS/2,BS*2,0, 0,0,0, c, 1,0),
- video::S3DVertex(-BS/2,BS*2,0, 0,0,0, c, 0,0),
- };
- u16 indices[] = {0,1,2,2,3,0};
- buf->append(vertices, 4, indices, 6);
- // Set material
- buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
- buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
- buf->getMaterial().setTexture
- (0, driver->getTexture("../data/player.png"));
- buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
- buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
- // Add to mesh
- mesh->addMeshBuffer(buf);
- buf->drop();
- m_node = smgr->addMeshSceneNode(mesh, NULL);
- mesh->drop();
- m_node->setPosition(getAbsolutePos());
- }
- virtual void removeFromScene()
- {
- //dstream<<"Removing from scene"<<std::endl;
- if(m_node != NULL)
- {
- m_node->remove();
- m_node = NULL;
- }
- }
-
- /*
- Special methods
- */
-
- void updateNodePos()
- {
- m_subpos = BS*2.0 * v3f(sin(m_subpos_c), sin(m_subpos_c+1.0), sin(-m_subpos_c));
-
- if(m_node != NULL)
- {
- m_node->setPosition(getAbsolutePos() + m_subpos);
- }
- }
-
-protected:
- scene::IMeshSceneNode *m_node;
- std::string m_text;
-
- v3f m_subpos;
- f32 m_subpos_c;
-};
-
class MovingObject : public MapBlockObject
{
public:
@@ -398,134 +285,6 @@ protected:
bool m_touching_ground;
};
-class Test2Object : public MovingObject
-{
-public:
- // The constructor of every MapBlockObject should be like this
- Test2Object(MapBlock *block, s16 id, v3f pos):
- MovingObject(block, id, pos),
- m_node(NULL)
- {
- m_collision_box = new core::aabbox3d<f32>
- (-BS*0.3,0,-BS*0.3, BS*0.3,BS*1.7,BS*0.3);
- }
- virtual ~Test2Object()
- {
- delete m_collision_box;
- }
-
- /*
- Implementation interface
- */
- virtual u16 getTypeId() const
- {
- return MAPBLOCKOBJECT_TYPE_TEST2;
- }
- virtual void serialize(std::ostream &os, u8 version)
- {
- MovingObject::serialize(os, version);
- }
- virtual void update(std::istream &is, u8 version)
- {
- MovingObject::update(is, version);
-
- updateNodePos();
- }
-
- virtual bool serverStep(float dtime)
- {
- m_speed.X = 2*BS;
- m_speed.Z = 0;
-
- if(m_touching_ground)
- {
- static float count = 0;
- count -= dtime;
- if(count < 0.0)
- {
- count += 1.0;
- m_speed.Y = 6.5*BS;
- }
- }
-
- move(dtime, v3f(0, -9.81*BS, 0));
-
- updateNodePos();
-
- return false;
- }
-
- virtual void clientStep(float dtime)
- {
- m_pos += m_speed * dtime;
-
- updateNodePos();
- }
-
- virtual void addToScene(scene::ISceneManager *smgr)
- {
- if(m_node != NULL)
- return;
-
- //dstream<<"Adding to scene"<<std::endl;
-
- video::IVideoDriver* driver = smgr->getVideoDriver();
-
- scene::SMesh *mesh = new scene::SMesh();
- scene::IMeshBuffer *buf = new scene::SMeshBuffer();
- video::SColor c(255,255,255,255);
- video::S3DVertex vertices[4] =
- {
- video::S3DVertex(-BS/2,0,0, 0,0,0, c, 0,1),
- video::S3DVertex(BS/2,0,0, 0,0,0, c, 1,1),
- video::S3DVertex(BS/2,BS*2,0, 0,0,0, c, 1,0),
- video::S3DVertex(-BS/2,BS*2,0, 0,0,0, c, 0,0),
- };
- u16 indices[] = {0,1,2,2,3,0};
- buf->append(vertices, 4, indices, 6);
- // Set material
- buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
- buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
- buf->getMaterial().setTexture
- (0, driver->getTexture("../data/player.png"));
- buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
- buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
- // Add to mesh
- mesh->addMeshBuffer(buf);
- buf->drop();
- m_node = smgr->addMeshSceneNode(mesh, NULL);
- mesh->drop();
- m_node->setPosition(getAbsolutePos());
- }
- virtual void removeFromScene()
- {
- //dstream<<"Removing from scene"<<std::endl;
- if(m_node != NULL)
- {
- m_node->remove();
- m_node = NULL;
- }
- }
-
- /*
- Special methods
- */
-
- void updateNodePos()
- {
- //m_subpos = BS*2.0 * v3f(sin(m_subpos_c), sin(m_subpos_c+1.0), sin(-m_subpos_c));
-
- if(m_node != NULL)
- {
- //m_node->setPosition(getAbsolutePos() + m_subpos);
- m_node->setPosition(getAbsolutePos());
- }
- }
-
-protected:
- scene::IMeshSceneNode *m_node;
-};
-
class RatObject : public MovingObject
{
public: