From: Kahrl Date: Thu, 8 Sep 2011 12:21:56 +0000 (+0200) Subject: attempting to merge Queatz/the-wielded-tool and kahrl/viewbobbing, something doesn... X-Git-Tag: 0.3.dev-20111021~75^2~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=71418639d3e81a0c4f03633042f9c3472572a87e;p=oweals%2Fminetest.git attempting to merge Queatz/the-wielded-tool and kahrl/viewbobbing, something doesn't work right yet --- 71418639d3e81a0c4f03633042f9c3472572a87e diff --cc src/client.cpp index 81dedd144,d491f9d36..71a826a1f --- a/src/client.cpp +++ b/src/client.cpp @@@ -1999,11 -1998,24 +1999,19 @@@ NodeMetadata* Client::getNodeMetadata(v return m_env.getMap().getNodeMetadata(p); } -v3f Client::getPlayerPosition(v3f *eye_position) +LocalPlayer* Client::getLocalPlayer() { - //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out - LocalPlayer *player = m_env.getLocalPlayer(); - assert(player != NULL); - if (eye_position) - *eye_position = player->getEyePosition(); - return player->getPosition(); + return m_env.getLocalPlayer(); } + void Client::setPlayerWield(scene::ISceneNode *wield) + { + //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out + LocalPlayer *player = m_env.getLocalPlayer(); + assert(player != NULL); + player->wield = wield; + } + void Client::setPlayerControl(PlayerControl &control) { //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out diff --cc src/client.h index 930987c02,398a3b849..e7a81a111 --- a/src/client.h +++ b/src/client.h @@@ -208,8 -206,11 +208,9 @@@ public // Wrapper to Map NodeMetadata* getNodeMetadata(v3s16 p); - // Get the player position, and optionally put the - // eye position in *eye_position - v3f getPlayerPosition(v3f *eye_position=NULL); + LocalPlayer* getLocalPlayer(); + void setPlayerWield(scene::ISceneNode *wield); void setPlayerControl(PlayerControl &control); void selectPlayerItem(u16 item); diff --cc src/game.cpp index 24f356e46,86f1939c3..af4886137 --- a/src/game.cpp +++ b/src/game.cpp @@@ -827,6 -970,49 +827,44 @@@ void the_game f32 camera_yaw = 0; // "right/left" f32 camera_pitch = 0; // "up/down" + /* + Tool + */ + - v3f tool_wield_position(0.6, -0.6, 1.0); ++ v3f tool_wield_position(0.06*BS, 1.619*BS, 0.1*BS); + v3f tool_wield_rotation(-25, 180, -25); + float tool_wield_animation = 0.0; + scene::IMeshSceneNode *tool_wield; + { + 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(-0.5,0,0, 0,0,0, c, 0,1), + video::S3DVertex(0.5,0,0, 0,0,0, c, 1,1), + video::S3DVertex(0.5,0.5,0, 0,0,0, c, 1,0), + video::S3DVertex(-0.5,0.5,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_BILINEAR_FILTER, false); + buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; + // Add to mesh + mesh->addMeshBuffer(buf); + buf->drop(); + - tool_wield = smgr->addMeshSceneNode(mesh, camera); ++ tool_wield = smgr->addMeshSceneNode(mesh, camera.getPlayerNode()); + mesh->drop(); + } + tool_wield->setVisible(false); + tool_wield->setPosition(tool_wield_position); + tool_wield->setRotation(tool_wield_rotation); + + client.setPlayerWield(tool_wield); + /* Clouds */