| 31 | |
| 32 | |
| 33 | void cNoteEntity::MakeSound(void) |
| 34 | { |
| 35 | char instrument; |
| 36 | AString sampleName; |
| 37 | |
| 38 | switch (m_World->GetBlock(m_PosX, m_PosY - 1, m_PosZ)) |
| 39 | { |
| 40 | case E_BLOCK_PLANKS: |
| 41 | case E_BLOCK_LOG: |
| 42 | case E_BLOCK_NOTE_BLOCK: |
| 43 | { |
| 44 | // TODO: add other wood-based blocks if needed |
| 45 | instrument = E_INST_DOUBLE_BASS; |
| 46 | sampleName = "note.db"; |
| 47 | break; |
| 48 | } |
| 49 | |
| 50 | case E_BLOCK_SAND: |
| 51 | case E_BLOCK_GRAVEL: |
| 52 | case E_BLOCK_SOULSAND: |
| 53 | { |
| 54 | instrument = E_INST_SNARE_DRUM; |
| 55 | sampleName = "note.snare"; |
| 56 | break; |
| 57 | } |
| 58 | |
| 59 | case E_BLOCK_GLASS: |
| 60 | case E_BLOCK_GLASS_PANE: |
| 61 | case E_BLOCK_GLOWSTONE: |
| 62 | { |
| 63 | instrument = E_INST_CLICKS; |
| 64 | sampleName = "note.hat"; |
| 65 | break; |
| 66 | } |
| 67 | |
| 68 | case E_BLOCK_STONE: |
| 69 | case E_BLOCK_STONE_BRICKS: |
| 70 | case E_BLOCK_COBBLESTONE: |
| 71 | case E_BLOCK_OBSIDIAN: |
| 72 | case E_BLOCK_NETHERRACK: |
| 73 | case E_BLOCK_BRICK: |
| 74 | case E_BLOCK_NETHER_BRICK: |
| 75 | { |
| 76 | // TODO: add other stone-based blocks if needed |
| 77 | instrument = E_INST_BASS_DRUM; |
| 78 | sampleName = "note.bassattack"; |
| 79 | break; |
| 80 | } |
| 81 | |
| 82 | default: |
| 83 | { |
| 84 | instrument = E_INST_HARP_PIANO; |
| 85 | sampleName = "note.harp"; |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, instrument, m_Pitch, E_BLOCK_NOTE_BLOCK); |
no test coverage detected