From e9f4ae6533dcbc62936f70a45f787f65d363215c Mon Sep 17 00:00:00 2001 From: iProgramInCpp Date: Sun, 13 Aug 2023 22:28:07 +0300 Subject: [PATCH] * Separate out the item class headers from the main Item header. --- source/world/item/CameraItem.cpp | 2 +- source/world/item/CameraItem.hpp | 18 +++++++++++ source/world/item/DoorItem.cpp | 2 +- source/world/item/DoorItem.hpp | 21 ++++++++++++ source/world/item/Item.cpp | 5 +++ source/world/item/Item.hpp | 43 ------------------------- source/world/item/TileItem.cpp | 2 +- source/world/item/TileItem.hpp | 23 +++++++++++++ source/world/item/TilePlanterItem.cpp | 2 +- source/world/item/TilePlanterItem.hpp | 21 ++++++++++++ source/world/tile/Tile.cpp | 2 +- windows_vs/minecraftcpp.vcxproj | 4 +++ windows_vs/minecraftcpp.vcxproj.filters | 12 +++++++ 13 files changed, 109 insertions(+), 48 deletions(-) create mode 100644 source/world/item/CameraItem.hpp create mode 100644 source/world/item/DoorItem.hpp create mode 100644 source/world/item/TileItem.hpp create mode 100644 source/world/item/TilePlanterItem.hpp diff --git a/source/world/item/CameraItem.cpp b/source/world/item/CameraItem.cpp index fe1eb59..0bfb06b 100644 --- a/source/world/item/CameraItem.cpp +++ b/source/world/item/CameraItem.cpp @@ -6,7 +6,7 @@ SPDX-License-Identifier: BSD-1-Clause ********************************************************************/ -#include "Item.hpp" +#include "CameraItem.hpp" #include "world/level/Level.hpp" #include "world/entity/TripodCamera.hpp" #include "world/entity/Player.hpp" diff --git a/source/world/item/CameraItem.hpp b/source/world/item/CameraItem.hpp new file mode 100644 index 0000000..7f332cb --- /dev/null +++ b/source/world/item/CameraItem.hpp @@ -0,0 +1,18 @@ +/******************************************************************** + Minecraft: Pocket Edition - Decompilation Project + Copyright (C) 2023 iProgramInCpp + + The following code is licensed under the BSD 1 clause license. + SPDX-License-Identifier: BSD-1-Clause + ********************************************************************/ +#pragma once + +#include "Item.hpp" + +class CameraItem : public Item +{ +public: + CameraItem(int id); + + ItemInstance* use(ItemInstance* inst, Level* level, Player* player) override; +}; diff --git a/source/world/item/DoorItem.cpp b/source/world/item/DoorItem.cpp index 39f5936..1b36791 100644 --- a/source/world/item/DoorItem.cpp +++ b/source/world/item/DoorItem.cpp @@ -6,7 +6,7 @@ SPDX-License-Identifier: BSD-1-Clause ********************************************************************/ -#include "Item.hpp" +#include "DoorItem.hpp" #include "world/level/Level.hpp" #include "world/entity/Player.hpp" #include "world/tile/Tile.hpp" diff --git a/source/world/item/DoorItem.hpp b/source/world/item/DoorItem.hpp new file mode 100644 index 0000000..7e4a96f --- /dev/null +++ b/source/world/item/DoorItem.hpp @@ -0,0 +1,21 @@ +/******************************************************************** + Minecraft: Pocket Edition - Decompilation Project + Copyright (C) 2023 iProgramInCpp + + The following code is licensed under the BSD 1 clause license. + SPDX-License-Identifier: BSD-1-Clause + ********************************************************************/ +#pragma once + +#include "Item.hpp" + +class DoorItem : public Item +{ +public: + DoorItem(int id, Material* pMtl); + + virtual bool useOn(ItemInstance*, Player*, Level*, int, int, int, int); + +public: + Material* m_pMaterial; +}; diff --git a/source/world/item/Item.cpp b/source/world/item/Item.cpp index c113032..490d702 100644 --- a/source/world/item/Item.cpp +++ b/source/world/item/Item.cpp @@ -8,6 +8,11 @@ #include "Item.hpp" +#include "CameraItem.hpp" +#include "DoorItem.hpp" +#include "TileItem.hpp" +#include "TilePlanterItem.hpp" + #define ITEM(x) ((x) - 256) #define NEW_ITEM(id) (new Item(ITEM(id))) diff --git a/source/world/item/Item.hpp b/source/world/item/Item.hpp index bc4b1c5..6ef608a 100644 --- a/source/world/item/Item.hpp +++ b/source/world/item/Item.hpp @@ -200,46 +200,3 @@ public: // Static declarations *record_02, *camera; }; - -class TileItem : public Item -{ -public: - TileItem(int id); - - virtual std::string getDescriptionId(); - virtual std::string getDescriptionId(ItemInstance*); - virtual bool useOn(ItemInstance*, Player*, Level*, int, int, int, int); - -public: - int m_tile; -}; - -class TilePlanterItem : public Item -{ -public: - TilePlanterItem(int id, int place); - - virtual bool useOn(ItemInstance*, Player*, Level*, int, int, int, int); - -public: - int m_tile; -}; - -class DoorItem : public Item -{ -public: - DoorItem(int id, Material *pMtl); - - virtual bool useOn(ItemInstance*, Player*, Level*, int, int, int, int); - -public: - Material* m_pMaterial; -}; - -class CameraItem : public Item -{ -public: - CameraItem(int id); - - ItemInstance* use(ItemInstance* inst, Level* level, Player* player) override; -}; diff --git a/source/world/item/TileItem.cpp b/source/world/item/TileItem.cpp index d17c5d6..8c68943 100644 --- a/source/world/item/TileItem.cpp +++ b/source/world/item/TileItem.cpp @@ -6,7 +6,7 @@ SPDX-License-Identifier: BSD-1-Clause ********************************************************************/ -#include "Item.hpp" +#include "TileItem.hpp" #include "world/level/Level.hpp" #include "world/tile/Tile.hpp" diff --git a/source/world/item/TileItem.hpp b/source/world/item/TileItem.hpp new file mode 100644 index 0000000..9efd050 --- /dev/null +++ b/source/world/item/TileItem.hpp @@ -0,0 +1,23 @@ +/******************************************************************** + Minecraft: Pocket Edition - Decompilation Project + Copyright (C) 2023 iProgramInCpp + + The following code is licensed under the BSD 1 clause license. + SPDX-License-Identifier: BSD-1-Clause + ********************************************************************/ +#pragma once + +#include "Item.hpp" + +class TileItem : public Item +{ +public: + TileItem(int id); + + virtual std::string getDescriptionId(); + virtual std::string getDescriptionId(ItemInstance*); + virtual bool useOn(ItemInstance*, Player*, Level*, int, int, int, int); + +public: + int m_tile; +}; diff --git a/source/world/item/TilePlanterItem.cpp b/source/world/item/TilePlanterItem.cpp index 1aa5ec3..267851d 100644 --- a/source/world/item/TilePlanterItem.cpp +++ b/source/world/item/TilePlanterItem.cpp @@ -6,7 +6,7 @@ SPDX-License-Identifier: BSD-1-Clause ********************************************************************/ -#include "Item.hpp" +#include "TilePlanterItem.hpp" #include "world/level/Level.hpp" #include "world/tile/Tile.hpp" diff --git a/source/world/item/TilePlanterItem.hpp b/source/world/item/TilePlanterItem.hpp new file mode 100644 index 0000000..a42e923 --- /dev/null +++ b/source/world/item/TilePlanterItem.hpp @@ -0,0 +1,21 @@ +/******************************************************************** + Minecraft: Pocket Edition - Decompilation Project + Copyright (C) 2023 iProgramInCpp + + The following code is licensed under the BSD 1 clause license. + SPDX-License-Identifier: BSD-1-Clause + ********************************************************************/ +#pragma once + +#include "Item.hpp" + +class TilePlanterItem : public Item +{ +public: + TilePlanterItem(int id, int place); + + virtual bool useOn(ItemInstance*, Player*, Level*, int, int, int, int); + +public: + int m_tile; +}; diff --git a/source/world/tile/Tile.cpp b/source/world/tile/Tile.cpp index 56841ea..ae821d6 100644 --- a/source/world/tile/Tile.cpp +++ b/source/world/tile/Tile.cpp @@ -7,7 +7,7 @@ ********************************************************************/ #include "world/level/Level.hpp" -#include "world/item/Item.hpp" +#include "world/item/TileItem.hpp" #include "world/entity/ItemEntity.hpp" // Include tile definitions here diff --git a/windows_vs/minecraftcpp.vcxproj b/windows_vs/minecraftcpp.vcxproj index a953370..d068b48 100644 --- a/windows_vs/minecraftcpp.vcxproj +++ b/windows_vs/minecraftcpp.vcxproj @@ -139,9 +139,13 @@ + + + + diff --git a/windows_vs/minecraftcpp.vcxproj.filters b/windows_vs/minecraftcpp.vcxproj.filters index 104243a..033459b 100644 --- a/windows_vs/minecraftcpp.vcxproj.filters +++ b/windows_vs/minecraftcpp.vcxproj.filters @@ -1146,6 +1146,18 @@ thirdparty\zlib + + source\world\item + + + source\world\item + + + source\world\item + + + source\world\item +