Merged in a patch for sounds by l0udPL
http://forum.mc-server.org/showthread.php?tid=434&pid=4564#pid4564 git-svn-id: http://mc-server.googlecode.com/svn/trunk@858 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -37,6 +37,8 @@ void cNoteEntity::UsedBy( cPlayer * a_Player )
|
||||
void cNoteEntity::MakeSound( void )
|
||||
{
|
||||
char instrument;
|
||||
AString sampleName;
|
||||
|
||||
switch (m_World->GetBlock(m_PosX, m_PosY - 1, m_PosZ))
|
||||
{
|
||||
case E_BLOCK_PLANKS:
|
||||
@@ -45,6 +47,7 @@ void cNoteEntity::MakeSound( void )
|
||||
{
|
||||
// TODO: add other wood-based blocks if needed
|
||||
instrument = E_INST_DOUBLE_BASS;
|
||||
sampleName = "note.db";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -53,6 +56,7 @@ void cNoteEntity::MakeSound( void )
|
||||
case E_BLOCK_SOULSAND:
|
||||
{
|
||||
instrument = E_INST_SNARE_DRUM;
|
||||
sampleName = "note.snare";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -61,6 +65,7 @@ void cNoteEntity::MakeSound( void )
|
||||
case E_BLOCK_GLOWSTONE:
|
||||
{
|
||||
instrument = E_INST_CLICKS;
|
||||
sampleName = "note.hat";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -74,17 +79,23 @@ void cNoteEntity::MakeSound( void )
|
||||
{
|
||||
// TODO: add other stone-based blocks if needed
|
||||
instrument = E_INST_BASS_DRUM;
|
||||
sampleName = "note.bassattack";
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
instrument = E_INST_HARP_PIANO;
|
||||
sampleName = "note.harp";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, instrument, m_Pitch, E_BLOCK_NOTE_BLOCK);
|
||||
|
||||
// TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all
|
||||
float calcPitch = pow(2.0f, ((float)m_Pitch - 12.0f) / 12.0f);
|
||||
m_World->BroadcastSoundEffect(sampleName, m_PosX * 8, m_PosY * 8, m_PosZ * 8, 3.0f, calcPitch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user