From 08bbf9687742c0b159cc1d963ab470796f74c6c8 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 10 Apr 2011 12:34:12 +0300 Subject: items now fall by gravity... also some other random updating --- src/clientobject.cpp | 78 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 20 deletions(-) (limited to 'src/clientobject.cpp') diff --git a/src/clientobject.cpp b/src/clientobject.cpp index a6aa033ef..901b3d072 100644 --- a/src/clientobject.cpp +++ b/src/clientobject.cpp @@ -258,6 +258,27 @@ void ItemCAO::removeFromScene() void ItemCAO::updateLight(u8 light_at_pos) { + if(m_node == NULL) + return; + + u8 li = decode_light(light_at_pos); + video::SColor color(255,li,li,li); + + scene::IMesh *mesh = m_node->getMesh(); + if(mesh == NULL) + return; + + u16 mc = mesh->getMeshBufferCount(); + for(u16 j=0; jgetMeshBuffer(j); + video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices(); + u16 vc = buf->getVertexCount(); + for(u16 i=0; i>cmd; + char buf[4]; + // command + is.read(buf, 1); + u8 cmd = buf[0]; if(cmd == 0) { - v3f newpos; - is>>newpos.X; - is>>newpos.Y; - is>>newpos.Z; - m_position = newpos; + // pos + is.read(buf, 4); + m_position.X = (float)readS32((u8*)buf)/1000.0; + is.read(buf, 4); + m_position.Y = (float)readS32((u8*)buf)/1000.0; + is.read(buf, 4); + m_position.Z = (float)readS32((u8*)buf)/1000.0; updateNodePos(); } } void ItemCAO::initialize(const std::string &data) { - dstream<<"ItemCAO: Got init data: "<