summaryrefslogtreecommitdiffstats
path: root/source/blocks
diff options
context:
space:
mode:
Diffstat (limited to 'source/blocks')
-rw-r--r--source/blocks/Block.cpp14
-rw-r--r--source/blocks/Block.h3
-rw-r--r--source/blocks/BlockCactus.h7
-rw-r--r--source/blocks/BlockChest.h6
-rw-r--r--source/blocks/BlockCloth.h7
-rw-r--r--source/blocks/BlockCrops.h7
-rw-r--r--source/blocks/BlockDirt.h7
-rw-r--r--source/blocks/BlockDoor.cpp11
-rw-r--r--source/blocks/BlockDoor.h1
-rw-r--r--source/blocks/BlockFire.h8
-rw-r--r--source/blocks/BlockFlower.h8
-rw-r--r--source/blocks/BlockGravel.h18
-rw-r--r--source/blocks/BlockLadder.h8
-rw-r--r--source/blocks/BlockLeaves.h5
-rw-r--r--source/blocks/BlockMelon.h7
-rw-r--r--source/blocks/BlockMushroom.h7
-rw-r--r--source/blocks/BlockRedstoneRepeater.h7
-rw-r--r--source/blocks/BlockRedstoneTorch.h7
-rw-r--r--source/blocks/BlockSand.h18
-rw-r--r--source/blocks/BlockSapling.h7
-rw-r--r--source/blocks/BlockSign.h7
-rw-r--r--source/blocks/BlockSlab.h11
-rw-r--r--source/blocks/BlockSnow.h7
-rw-r--r--source/blocks/BlockStairs.h4
-rw-r--r--source/blocks/BlockStems.h7
-rw-r--r--source/blocks/BlockSugarcane.h5
-rw-r--r--source/blocks/BlockTallGrass.h8
-rw-r--r--source/blocks/BlockTorch.h5
-rw-r--r--source/blocks/BlockVine.h7
-rw-r--r--source/blocks/BlockWood.h7
-rw-r--r--source/blocks/BlockWorkbench.h7
31 files changed, 213 insertions, 25 deletions
diff --git a/source/blocks/Block.cpp b/source/blocks/Block.cpp
index 7764e2881..98868de7d 100644
--- a/source/blocks/Block.cpp
+++ b/source/blocks/Block.cpp
@@ -2,6 +2,8 @@
#include "Block.h"
#include "../cItem.h"
#include "../cWorld.h"
+#include "BlockSand.h"
+#include "BlockGravel.h"
#include "BlockDoor.h"
#include "BlockFire.h"
#include "BlockRedstone.h"
@@ -75,6 +77,10 @@ cBlockHandler *cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockID)
{
switch(a_BlockID)
{
+ case E_BLOCK_SAND:
+ return new cBlockSandHandler(a_BlockID);
+ case E_BLOCK_GRAVEL:
+ return new cBlockGravelHandler(a_BlockID);
case E_BLOCK_WOODEN_DOOR:
case E_BLOCK_IRON_DOOR:
return new cBlockDoorHandler(a_BlockID);
@@ -349,6 +355,14 @@ void cBlockHandler::DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z)
+AString cBlockHandler::GetStepSound() {
+ return "step.stone";
+}
+
+
+
+
+
bool cBlockHandler::CanBePlacedAt(cWorld *a_World, int a_X, int a_Y, int a_Z, char a_Dir)
{
return CanBeAt(a_World, a_X, a_Y, a_Z);
diff --git a/source/blocks/Block.h b/source/blocks/Block.h
index ef22e01b5..859870c4a 100644
--- a/source/blocks/Block.h
+++ b/source/blocks/Block.h
@@ -41,7 +41,8 @@ public:
virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta);
// This function handles the dropping of a block based on the Drop id, drop count and drop meta. This will not destroy the block
virtual void DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z);
-
+ /// Returns step sound name of block
+ virtual AString GetStepSound();
// Indicates whether this block needs random ticks DEFAULT: False
virtual bool NeedsRandomTicks();
diff --git a/source/blocks/BlockCactus.h b/source/blocks/BlockCactus.h
index e5bfdda03..9da9d796b 100644
--- a/source/blocks/BlockCactus.h
+++ b/source/blocks/BlockCactus.h
@@ -50,6 +50,13 @@ public:
{
return false;
}
+
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.cloth";
+ }
+
};
diff --git a/source/blocks/BlockChest.h b/source/blocks/BlockChest.h
index fd444a9d2..65c0ffa5c 100644
--- a/source/blocks/BlockChest.h
+++ b/source/blocks/BlockChest.h
@@ -18,5 +18,9 @@ public:
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
}
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockCloth.h b/source/blocks/BlockCloth.h
index f2ce78fb5..d83b18ebb 100644
--- a/source/blocks/BlockCloth.h
+++ b/source/blocks/BlockCloth.h
@@ -14,5 +14,10 @@ public:
{
return a_BlockMeta;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.cloth";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockCrops.h b/source/blocks/BlockCrops.h
index b5b543e76..ebf911131 100644
--- a/source/blocks/BlockCrops.h
+++ b/source/blocks/BlockCrops.h
@@ -55,5 +55,10 @@ public:
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) == E_BLOCK_FARMLAND;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockDirt.h b/source/blocks/BlockDirt.h
index f6ba1c887..28993d29c 100644
--- a/source/blocks/BlockDirt.h
+++ b/source/blocks/BlockDirt.h
@@ -63,5 +63,10 @@ public:
}
} // for i - repeat twice
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.gravel";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockDoor.cpp b/source/blocks/BlockDoor.cpp
index ecee2c12d..283f546b6 100644
--- a/source/blocks/BlockDoor.cpp
+++ b/source/blocks/BlockDoor.cpp
@@ -62,4 +62,13 @@ void cBlockDoorHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYP
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, a_BlockMeta);
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
}
-} \ No newline at end of file
+}
+
+AString cBlockDoorHandler::GetStepSound(void)
+{
+ if (m_BlockID == E_BLOCK_WOODEN_DOOR)
+ return "step.wood";
+
+ else
+ return "step.stone";
+}
diff --git a/source/blocks/BlockDoor.h b/source/blocks/BlockDoor.h
index 0ccc3fdac..6af8bd955 100644
--- a/source/blocks/BlockDoor.h
+++ b/source/blocks/BlockDoor.h
@@ -10,6 +10,7 @@ public:
virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override;
virtual void OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override;
virtual void OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override;
+ virtual AString GetStepSound(void) override;
virtual char GetDropCount() override;
virtual bool IsUseable() override
{
diff --git a/source/blocks/BlockFire.h b/source/blocks/BlockFire.h
index 3e605636b..1b9f68060 100644
--- a/source/blocks/BlockFire.h
+++ b/source/blocks/BlockFire.h
@@ -25,5 +25,9 @@ public:
return true;
}
-
-}; \ No newline at end of file
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
+
+};
diff --git a/source/blocks/BlockFlower.h b/source/blocks/BlockFlower.h
index b94e6cb6d..920cf1c8f 100644
--- a/source/blocks/BlockFlower.h
+++ b/source/blocks/BlockFlower.h
@@ -29,4 +29,10 @@ public:
{
return false;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
+
+};
diff --git a/source/blocks/BlockGravel.h b/source/blocks/BlockGravel.h
new file mode 100644
index 000000000..d4f36a894
--- /dev/null
+++ b/source/blocks/BlockGravel.h
@@ -0,0 +1,18 @@
+#pragma once
+#include "Block.h"
+
+
+class cBlockGravelHandler : public cBlockHandler
+{
+public:
+ cBlockGravelHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.gravel";
+ }
+
+};
diff --git a/source/blocks/BlockLadder.h b/source/blocks/BlockLadder.h
index 4c7f37b1f..e30fc884d 100644
--- a/source/blocks/BlockLadder.h
+++ b/source/blocks/BlockLadder.h
@@ -30,5 +30,11 @@ public:
char Dir = cLadder::MetaDataToDirection(a_World->GetBlockMeta( a_X, a_Y, a_Z));
return CanBePlacedAt(a_World, a_X, a_Y, a_Z, Dir);
}
+
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockLeaves.h b/source/blocks/BlockLeaves.h
index c7bca92ac..c2ec697ae 100644
--- a/source/blocks/BlockLeaves.h
+++ b/source/blocks/BlockLeaves.h
@@ -108,6 +108,11 @@ public:
a_World->DigBlock(a_X, a_Y, a_Z);
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
};
diff --git a/source/blocks/BlockMelon.h b/source/blocks/BlockMelon.h
index 0f1797a0b..3abcc6efb 100644
--- a/source/blocks/BlockMelon.h
+++ b/source/blocks/BlockMelon.h
@@ -21,4 +21,9 @@ public:
MTRand r1;
return (char)(3 + r1.randInt(4));
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
+};
diff --git a/source/blocks/BlockMushroom.h b/source/blocks/BlockMushroom.h
index 5ec429c5f..ca787dce6 100644
--- a/source/blocks/BlockMushroom.h
+++ b/source/blocks/BlockMushroom.h
@@ -39,4 +39,9 @@ public:
{
return false;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
+};
diff --git a/source/blocks/BlockRedstoneRepeater.h b/source/blocks/BlockRedstoneRepeater.h
index 26b2b9877..c2ed30e2c 100644
--- a/source/blocks/BlockRedstoneRepeater.h
+++ b/source/blocks/BlockRedstoneRepeater.h
@@ -44,4 +44,9 @@ public:
{
return false;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
+};
diff --git a/source/blocks/BlockRedstoneTorch.h b/source/blocks/BlockRedstoneTorch.h
index 88e884861..42d3a0366 100644
--- a/source/blocks/BlockRedstoneTorch.h
+++ b/source/blocks/BlockRedstoneTorch.h
@@ -20,4 +20,9 @@ public:
{
return E_ITEM_REDSTONE_TORCH_ON;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
+};
diff --git a/source/blocks/BlockSand.h b/source/blocks/BlockSand.h
new file mode 100644
index 000000000..71096c5a7
--- /dev/null
+++ b/source/blocks/BlockSand.h
@@ -0,0 +1,18 @@
+#pragma once
+#include "Block.h"
+
+
+class cBlockSandHandler : public cBlockHandler
+{
+public:
+ cBlockSandHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.sand";
+ }
+
+};
diff --git a/source/blocks/BlockSapling.h b/source/blocks/BlockSapling.h
index 6bef614cf..e4ca998cb 100644
--- a/source/blocks/BlockSapling.h
+++ b/source/blocks/BlockSapling.h
@@ -48,4 +48,9 @@ public:
{
return false;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
+};
diff --git a/source/blocks/BlockSign.h b/source/blocks/BlockSign.h
index 2a7ac2753..b0f9d7f7f 100644
--- a/source/blocks/BlockSign.h
+++ b/source/blocks/BlockSign.h
@@ -39,4 +39,9 @@ public:
{
return false;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
+};
diff --git a/source/blocks/BlockSlab.h b/source/blocks/BlockSlab.h
index f6443ff91..11d1933c3 100644
--- a/source/blocks/BlockSlab.h
+++ b/source/blocks/BlockSlab.h
@@ -39,4 +39,13 @@ public:
}
return result;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ if (m_BlockID == E_BLOCK_WOODEN_SLAB || m_BlockID ==E_BLOCK_DOUBLE_WOODEN_SLAB)
+ return "step.wood";
+
+ else
+ return "step.stone";
+ }
+};
diff --git a/source/blocks/BlockSnow.h b/source/blocks/BlockSnow.h
index ac0c0ac69..ba9d35183 100644
--- a/source/blocks/BlockSnow.h
+++ b/source/blocks/BlockSnow.h
@@ -35,5 +35,10 @@ public:
{
return false;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.cloth";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockStairs.h b/source/blocks/BlockStairs.h
index b6898f8e1..4e06a6e3f 100644
--- a/source/blocks/BlockStairs.h
+++ b/source/blocks/BlockStairs.h
@@ -18,5 +18,5 @@ public:
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
}
-
-}; \ No newline at end of file
+ //TODO: step sound
+};
diff --git a/source/blocks/BlockStems.h b/source/blocks/BlockStems.h
index a58a2bdf4..aa6229536 100644
--- a/source/blocks/BlockStems.h
+++ b/source/blocks/BlockStems.h
@@ -37,5 +37,10 @@ public:
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) == E_BLOCK_FARMLAND;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockSugarcane.h b/source/blocks/BlockSugarcane.h
index b3db0a795..4b0cb5408 100644
--- a/source/blocks/BlockSugarcane.h
+++ b/source/blocks/BlockSugarcane.h
@@ -59,6 +59,11 @@ public:
return false;
}
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
+
};
diff --git a/source/blocks/BlockTallGrass.h b/source/blocks/BlockTallGrass.h
index ac66c1714..6e7854db8 100644
--- a/source/blocks/BlockTallGrass.h
+++ b/source/blocks/BlockTallGrass.h
@@ -32,4 +32,10 @@ public:
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
}
-}; \ No newline at end of file
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
+
+};
diff --git a/source/blocks/BlockTorch.h b/source/blocks/BlockTorch.h
index 9a124189f..f3b172bf9 100644
--- a/source/blocks/BlockTorch.h
+++ b/source/blocks/BlockTorch.h
@@ -154,6 +154,11 @@ public:
{
return 0;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
};
diff --git a/source/blocks/BlockVine.h b/source/blocks/BlockVine.h
index 86f73b6b2..6b8d85339 100644
--- a/source/blocks/BlockVine.h
+++ b/source/blocks/BlockVine.h
@@ -26,5 +26,10 @@ public:
{
return false;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.grass";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockWood.h b/source/blocks/BlockWood.h
index 453ee48a1..5e6615c1b 100644
--- a/source/blocks/BlockWood.h
+++ b/source/blocks/BlockWood.h
@@ -13,5 +13,10 @@ public:
{
return a_BlockMeta;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
-}; \ No newline at end of file
+};
diff --git a/source/blocks/BlockWorkbench.h b/source/blocks/BlockWorkbench.h
index 52c3ad738..6c5f0d3e8 100644
--- a/source/blocks/BlockWorkbench.h
+++ b/source/blocks/BlockWorkbench.h
@@ -21,6 +21,11 @@ public:
{
return true;
}
+
+ virtual AString GetStepSound(void) override
+ {
+ return "step.wood";
+ }
-}; \ No newline at end of file
+};