From ea8545dff189312ad1300fddb2f2ead7d5cf1c59 Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Thu, 15 Nov 2012 18:57:47 +0000 Subject: [PATCH] - Added the "wait" music disc - Vines can now be placed on leaves git-svn-id: http://mc-server.googlecode.com/svn/trunk@1045 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockID.h | 3 ++- source/Blocks/BlockVine.h | 10 ++++++---- source/Defines.h | 2 +- source/Items/ItemHandler.cpp | 4 ++-- source/Items/ItemHandler.h | 2 +- source/JukeboxEntity.cpp | 6 +++--- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/source/BlockID.h b/source/BlockID.h index b82341a8a..6dd30a069 100644 --- a/source/BlockID.h +++ b/source/BlockID.h @@ -452,7 +452,8 @@ enum ENUM_ITEM_ID E_ITEM_STAL_DISC = 2263, E_ITEM_STRAD_DISC = 2264, E_ITEM_WARD_DISC = 2265, - E_ITEM_11_DISC = 2266 + E_ITEM_11_DISC = 2266, + E_ITEM_WAIT_DISC = 2267 }; diff --git a/source/Blocks/BlockVine.h b/source/Blocks/BlockVine.h index b71997f2a..cdef18520 100644 --- a/source/Blocks/BlockVine.h +++ b/source/Blocks/BlockVine.h @@ -35,10 +35,12 @@ public: return true; } - if (g_BlockIsSolid[a_World->GetBlock( a_BlockX, a_BlockY + 1, a_BlockZ )]) + BLOCKTYPE TopBlock = a_World->GetBlock( a_BlockX, a_BlockY + 1, a_BlockZ); + if (g_BlockIsSolid[TopBlock] || TopBlock==E_BLOCK_LEAVES) { AddDirection( a_BlockX, a_BlockY, a_BlockZ, a_Dir, true ); - if (g_BlockIsSolid[a_World->GetBlock( a_BlockX, a_BlockY, a_BlockZ )]==false) + BLOCKTYPE BaseBlock = a_World->GetBlock( a_BlockX, a_BlockY, a_BlockZ); + if (g_BlockIsSolid[BaseBlock] == false && BaseBlock!=E_BLOCK_LEAVES) { AddDirection( a_BlockX, a_BlockY, a_BlockZ, a_Dir, false ); a_World->SetBlock( a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_VINES, 0); @@ -47,8 +49,8 @@ public: } AddDirection( a_BlockX, a_BlockY, a_BlockZ, a_Dir, true ); - - return g_BlockIsSolid[a_World->GetBlock( a_BlockX, a_BlockY, a_BlockZ)]; + BLOCKTYPE BaseBlock = a_World->GetBlock( a_BlockX, a_BlockY, a_BlockZ); + return g_BlockIsSolid[BaseBlock] || BaseBlock==E_BLOCK_LEAVES; } diff --git a/source/Defines.h b/source/Defines.h index 74a8c7b5c..1844d7872 100644 --- a/source/Defines.h +++ b/source/Defines.h @@ -67,7 +67,7 @@ inline bool IsValidBlock( int a_BlockType ) //tolua_export inline bool IsValidItem( int a_ItemID ) //tolua_export { //tolua_export if( (a_ItemID >= 256 && a_ItemID <= 388) - || (a_ItemID >= 2256 && a_ItemID <= 2266) ) + || (a_ItemID >= 2256 && a_ItemID <= 2267) ) { return true; } diff --git a/source/Items/ItemHandler.cpp b/source/Items/ItemHandler.cpp index f23a13120..c4e6537e2 100644 --- a/source/Items/ItemHandler.cpp +++ b/source/Items/ItemHandler.cpp @@ -36,7 +36,7 @@ bool cItemHandler::m_HandlerInitialized = false; -cItemHandler * cItemHandler::m_ItemHandler[2266]; +cItemHandler * cItemHandler::m_ItemHandler[2268]; @@ -177,7 +177,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType) void cItemHandler::Deinit() { - for(int i = 0; i < 2266; i++) + for(int i = 0; i < 2267; i++) { delete m_ItemHandler[i]; } diff --git a/source/Items/ItemHandler.h b/source/Items/ItemHandler.h index dfd5739af..da32ed19e 100644 --- a/source/Items/ItemHandler.h +++ b/source/Items/ItemHandler.h @@ -75,7 +75,7 @@ protected: int m_ItemType; static cItemHandler *CreateItemHandler(int m_ItemType); - static cItemHandler *m_ItemHandler[2266]; + static cItemHandler *m_ItemHandler[2268]; static bool m_HandlerInitialized; //used to detect if the itemhandlers are initialized }; diff --git a/source/JukeboxEntity.cpp b/source/JukeboxEntity.cpp index e72f95926..c190ffa11 100644 --- a/source/JukeboxEntity.cpp +++ b/source/JukeboxEntity.cpp @@ -21,7 +21,7 @@ cJukeboxEntity::cJukeboxEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld cJukeboxEntity::~cJukeboxEntity() { - if (m_Record >= 2256 && m_Record <= 2266) + if (m_Record >= 2256 && m_Record <= 2267) { EjectRecord(); m_Record = 0; @@ -37,14 +37,14 @@ void cJukeboxEntity::UsedBy( cPlayer * a_Player ) if (m_Record == 0) { const cItem & HeldItem = a_Player->GetEquippedItem(); - if (HeldItem.m_ItemType >= 2256 && HeldItem.m_ItemType <= 2266) + if (HeldItem.m_ItemType >= 2256 && HeldItem.m_ItemType <= 2267) { m_Record = HeldItem.m_ItemType; a_Player->UseEquippedItem(); PlayRecord(); } } - else if (m_Record >= 2256 && m_Record <= 2266) + else if (m_Record >= 2256 && m_Record <= 2267) { EjectRecord(); m_Record = 0;