mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 11:26:37 +00:00 
			
		
		
		
	Merge pull request #1970 from Capostrophic/landing
Re-enable handling soundgen land for creatures
This commit is contained in:
		
						commit
						f561ab547a
					
				
					 2 changed files with 14 additions and 18 deletions
				
			
		|  | @ -1242,15 +1242,9 @@ namespace MWClass | ||||||
|             return ""; |             return ""; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         // Morrowind ignores land soundgen for NPCs
 | ||||||
|         if(name == "land") |         if(name == "land") | ||||||
|         { |             return ""; | ||||||
|             MWBase::World *world = MWBase::Environment::get().getWorld(); |  | ||||||
|             osg::Vec3f pos(ptr.getRefData().getPosition().asVec3()); |  | ||||||
|             if (world->isUnderwater(ptr.getCell(), pos) || world->isWalkingOnWater(ptr)) |  | ||||||
|                 return "DefaultLandWater"; |  | ||||||
| 
 |  | ||||||
|             return "DefaultLand"; |  | ||||||
|         } |  | ||||||
|         if(name == "swimleft") |         if(name == "swimleft") | ||||||
|             return "Swim Left"; |             return "Swim Left"; | ||||||
|         if(name == "swimright") |         if(name == "swimright") | ||||||
|  |  | ||||||
|  | @ -979,17 +979,13 @@ void CharacterController::handleTextKey(const std::string &groupname, const std: | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (soundgen == "land") // Morrowind ignores land soundgen for some reason
 |  | ||||||
|             return; |  | ||||||
| 
 |  | ||||||
|         std::string sound = mPtr.getClass().getSoundIdFromSndGen(mPtr, soundgen); |         std::string sound = mPtr.getClass().getSoundIdFromSndGen(mPtr, soundgen); | ||||||
|         if(!sound.empty()) |         if(!sound.empty()) | ||||||
|         { |         { | ||||||
|             MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); |             MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); | ||||||
|             if(soundgen == "left" || soundgen == "right") |             // NB: landing sound is not played for NPCs here
 | ||||||
|  |             if(soundgen == "left" || soundgen == "right" || soundgen == "land") | ||||||
|             { |             { | ||||||
|                 // Don't make foot sounds local for the player, it makes sense to keep them
 |  | ||||||
|                 // positioned on the ground.
 |  | ||||||
|                 sndMgr->playSound3D(mPtr, sound, volume, pitch, MWSound::Type::Foot, |                 sndMgr->playSound3D(mPtr, sound, volume, pitch, MWSound::Type::Foot, | ||||||
|                                     MWSound::PlayMode::NoPlayerLocal); |                                     MWSound::PlayMode::NoPlayerLocal); | ||||||
|             } |             } | ||||||
|  | @ -2071,12 +2067,18 @@ void CharacterController::update(float duration) | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // Play landing sound
 |             // Play landing sound for NPCs
 | ||||||
|  |             if (mPtr.getClass().isNpc()) | ||||||
|  |             { | ||||||
|                 MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); |                 MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); | ||||||
|             std::string sound = cls.getSoundIdFromSndGen(mPtr, "land"); |                 std::string sound = "DefaultLand"; | ||||||
|             if (!sound.empty()) |                 osg::Vec3f pos(mPtr.getRefData().getPosition().asVec3()); | ||||||
|  |                 if (world->isUnderwater(mPtr.getCell(), pos) || world->isWalkingOnWater(mPtr)) | ||||||
|  |                     sound = "DefaultLandWater"; | ||||||
|  | 
 | ||||||
|                 sndMgr->playSound3D(mPtr, sound, 1.f, 1.f, MWSound::Type::Foot, MWSound::PlayMode::NoPlayerLocal); |                 sndMgr->playSound3D(mPtr, sound, 1.f, 1.f, MWSound::Type::Foot, MWSound::PlayMode::NoPlayerLocal); | ||||||
|             } |             } | ||||||
|  |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             jumpstate = mAnimation->isPlaying(mCurrentJump) ? JumpState_Landing : JumpState_None; |             jumpstate = mAnimation->isPlaying(mCurrentJump) ? JumpState_Landing : JumpState_None; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue