X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fcontent_cao.cpp;h=861dc83e74cfaae16e7fcb05587f161c2cb561c6;hb=f4fedfed070ffd85c3446bc5d38d2fbd577640d6;hp=c34b47d51df0fd64b89e4a0b892cbcb198fe52a0;hpb=ac4884c3d677ef51bcce47f95ccd49d874022692;p=dragonfireclient.git diff --git a/src/content_cao.cpp b/src/content_cao.cpp index c34b47d51..861dc83e7 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -300,8 +300,6 @@ void GenericCAO::initialize(const std::string &data) m_is_visible = false; player->setCAO(this); } - if (m_client->getProtoVersion() < 33) - m_env->addPlayerName(m_name); } } @@ -337,9 +335,6 @@ void GenericCAO::processInitData(const std::string &data) GenericCAO::~GenericCAO() { - if (m_is_player && m_client->getProtoVersion() < 33) { - m_env->removePlayerName(m_name); - } removeFromScene(true); } @@ -664,7 +659,10 @@ void GenericCAO::updateLight(u8 light_at_pos) void GenericCAO::updateLightNoCheck(u8 light_at_pos) { - u8 li = decode_light(light_at_pos); + if (m_glow < 0) + return; + + u8 li = decode_light(light_at_pos + m_glow); if (li != m_last_light) { m_last_light = li; video::SColor color(255,li,li,li); @@ -864,16 +862,17 @@ void GenericCAO::step(float dtime, ClientEnvironment *env) float moved = lastpos.getDistanceFrom(pos_translator.vect_show); m_step_distance_counter += moved; - if(m_step_distance_counter > 1.5*BS) - { - m_step_distance_counter = 0; - if(!m_is_local_player && m_prop.makes_footstep_sound) - { + if (m_step_distance_counter > 1.5f * BS) { + m_step_distance_counter = 0.0f; + if (!m_is_local_player && m_prop.makes_footstep_sound) { INodeDefManager *ndef = m_client->ndef(); - v3s16 p = floatToInt(getPosition() + v3f(0, - (m_prop.collisionbox.MinEdge.Y-0.5)*BS, 0), BS); + v3s16 p = floatToInt(getPosition() + + v3f(0.0f, (m_prop.collisionbox.MinEdge.Y - 0.5f) * BS, 0.0f), BS); MapNode n = m_env->getMap().getNodeNoEx(p); SimpleSoundSpec spec = ndef->get(n).sound_footstep; + // Reduce footstep gain, as non-local-player footsteps are + // somehow louder. + spec.gain *= 0.6f; m_client->sound()->playSoundAt(spec, false, getPosition()); } } @@ -983,6 +982,7 @@ void GenericCAO::updateTextures(std::string mod) m_previous_texture_modifier = m_current_texture_modifier; m_current_texture_modifier = mod; + m_glow = m_prop.glow; if (m_spritenode) { if (m_prop.visual == "sprite") { @@ -1028,6 +1028,13 @@ void GenericCAO::updateTextures(std::string mod) material.setFlag(video::EMF_LIGHTING, false); material.setFlag(video::EMF_BILINEAR_FILTER, false); + // don't filter low-res textures, makes them look blurry + // player models have a res of 64 + const core::dimension2d &size = texture->getOriginalSize(); + const u32 res = std::min(size.Height, size.Width); + use_trilinear_filter &= res > 64; + use_bilinear_filter &= res > 64; + m_animated_meshnode->getMaterial(i) .setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter); m_animated_meshnode->getMaterial(i) @@ -1155,9 +1162,17 @@ void GenericCAO::updateAnimation() #endif } +void GenericCAO::updateAnimationSpeed() +{ + if (!m_animated_meshnode) + return; + + m_animated_meshnode->setAnimationSpeed(m_animation_speed); +} + void GenericCAO::updateBonePosition() { - if(m_bone_position.empty() || !m_animated_meshnode) + if (m_bone_position.empty() || !m_animated_meshnode) return; m_animated_meshnode->setJointMode(irr::scene::EJUOR_CONTROL); // To write positions to the mesh on render @@ -1244,6 +1259,8 @@ void GenericCAO::processMessage(const std::string &data) collision_box.MinEdge *= BS; collision_box.MaxEdge *= BS; player->setCollisionbox(collision_box); + player->setCanZoom(m_prop.can_zoom); + player->setEyeHeight(m_prop.eye_height); } if ((m_is_player && !m_is_local_player) && m_prop.nametag.empty()) @@ -1355,6 +1372,9 @@ void GenericCAO::processMessage(const std::string &data) updateAnimation(); } } + } else if (cmd == GENERIC_CMD_SET_ANIMATION_SPEED) { + m_animation_speed = readF1000(is); + updateAnimationSpeed(); } else if (cmd == GENERIC_CMD_SET_BONE_POSITION) { std::string bone = deSerializeString(is); v3f position = readV3F1000(is);