mirror of
https://github.com/celisej567/mcpe.git
synced 2025-12-31 17:49:17 +03:00
* Add Rocket item, WIP rocket launcher
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -188,6 +188,9 @@ xcuserdata/
|
||||
# Avoid including Minecraft Classic assets from Mojang, for now.
|
||||
/game/assets/patches/*.png
|
||||
/game/assets/patches/classic/*.png
|
||||
!/game/assets/patches/n_rocket_launcher.png
|
||||
!/game/assets/patches/n_rocket_launched.png
|
||||
!/game/assets/patches/n_rocket.png
|
||||
|
||||
# Ignore keep directory - where you can keep files for later use
|
||||
/keep
|
||||
|
||||
BIN
game/assets/patches/n_rocket.png
Normal file
BIN
game/assets/patches/n_rocket.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 185 B |
BIN
game/assets/patches/n_rocket_launched.png
Normal file
BIN
game/assets/patches/n_rocket_launched.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 B |
BIN
game/assets/patches/n_rocket_launcher.png
Normal file
BIN
game/assets/patches/n_rocket_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 229 B |
@@ -15,6 +15,11 @@
|
||||
|
||||
grass_sides_tint|true
|
||||
|
||||
# Add festive patches
|
||||
terrain|2|14|n_rocket_launcher.png
|
||||
terrain|3|14|n_rocket_launched.png
|
||||
items|14|2|n_rocket.png
|
||||
|
||||
# Stop now to ignore the below commands. They're for a patch I'm working on that I don't want to release yet.
|
||||
stop_now
|
||||
|
||||
|
||||
@@ -338,6 +338,7 @@
|
||||
<ClInclude Include="$(MC_ROOT)\source\client\renderer\entity\SkeletonRenderer.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\client\renderer\entity\SpiderRenderer.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\client\renderer\entity\ZombieRenderer.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\client\renderer\entity\RocketRenderer.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\app\App.cpp" />
|
||||
@@ -456,6 +457,7 @@
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\renderer\entity\SkeletonRenderer.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\renderer\entity\SpiderRenderer.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\renderer\entity\ZombieRenderer.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\renderer\entity\RocketRenderer.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.vcxproj">
|
||||
|
||||
@@ -434,6 +434,9 @@
|
||||
<ClInclude Include="$(MC_ROOT)\source\client\model\SpiderModel.hpp">
|
||||
<Filter>Header Files\Model</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MC_ROOT)\source\client\renderer\entity\RocketRenderer.hpp">
|
||||
<Filter>Header Files\Renderer\Entity</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\gui\components\AvailableGamesList.cpp">
|
||||
@@ -784,5 +787,8 @@
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\renderer\entity\SpiderRenderer.cpp">
|
||||
<Filter>Source Files\Renderer\Entity</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MC_ROOT)\source\client\renderer\entity\RocketRenderer.cpp">
|
||||
<Filter>Source Files\Renderer\Entity</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -231,6 +231,7 @@
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\entity\Player.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\entity\PrimedTnt.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\entity\TripodCamera.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\entity\Rocket.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\gamemode\CreativeMode.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\gamemode\GameMode.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\gamemode\SurvivalMode.cpp" />
|
||||
@@ -241,6 +242,7 @@
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\item\ItemInstance.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\item\TileItem.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\item\TilePlanterItem.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\item\RocketItem.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\level\Dimension.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\level\Explosion.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\level\Level.cpp" />
|
||||
@@ -291,9 +293,11 @@
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\particle\RedDustParticle.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\particle\SmokeParticle.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\particle\TerrainParticle.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\particle\FireworkParticle.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\phys\AABB.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\phys\HitResult.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\phys\Vec3.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\tile\RocketLauncherTile.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\tile\BookshelfTile.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\tile\Bush.cpp" />
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\tile\ClayTile.cpp" />
|
||||
@@ -364,6 +368,7 @@
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\item\ItemInstance.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\item\TileItem.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\item\TilePlanterItem.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\item\RocketItem.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\level\Dimension.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\level\Explosion.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\level\Level.hpp" />
|
||||
@@ -401,6 +406,7 @@
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\phys\AABB.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\phys\HitResult.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\phys\Vec3.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\tile\RocketLauncherTile.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\tile\BookshelfTile.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\tile\Bush.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\tile\ClayTile.hpp" />
|
||||
@@ -451,6 +457,7 @@
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\entity\Cow.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\entity\Creeper.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\entity\Pig.hpp" />
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\entity\Rocket.hpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -458,6 +458,18 @@
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\entity\WaterAnimal.cpp">
|
||||
<Filter>Source Files\Entity</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\tile\RocketLauncherTile.cpp">
|
||||
<Filter>Source Files\Tile</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\item\RocketItem.cpp">
|
||||
<Filter>Source Files\Item</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\entity\Rocket.cpp">
|
||||
<Filter>Source Files\Entity</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MC_ROOT)\source\world\particle\FireworkParticle.cpp">
|
||||
<Filter>Source Files\Particle</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\entity\Entity.hpp">
|
||||
@@ -775,5 +787,14 @@
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\entity\WaterAnimal.hpp">
|
||||
<Filter>Header Files\Entity</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\tile\RocketLauncherTile.hpp">
|
||||
<Filter>Header Files\Tile</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\item\RocketItem.hpp">
|
||||
<Filter>Header Files\Item</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MC_ROOT)\source\world\entity\Rocket.hpp">
|
||||
<Filter>Header Files\Entity</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -37,6 +37,7 @@ add_library(reminecraftpe-core STATIC
|
||||
client/renderer/entity/CowRenderer.cpp
|
||||
client/renderer/entity/PigRenderer.cpp
|
||||
client/renderer/entity/ChickenRenderer.cpp
|
||||
client/renderer/entity/RocketRenderer.cpp
|
||||
client/renderer/RenderList.cpp
|
||||
client/renderer/Chunk.cpp
|
||||
client/renderer/RenderChunk.cpp
|
||||
@@ -219,6 +220,7 @@ add_library(reminecraftpe-core STATIC
|
||||
world/item/Inventory.cpp
|
||||
world/item/DoorItem.cpp
|
||||
world/item/ItemInstance.cpp
|
||||
world/item/RocketItem.cpp
|
||||
world/item/Item.cpp
|
||||
world/particle/RedDustParticle.cpp
|
||||
world/particle/TerrainParticle.cpp
|
||||
@@ -229,6 +231,7 @@ add_library(reminecraftpe-core STATIC
|
||||
world/particle/SmokeParticle.cpp
|
||||
world/particle/Particle.cpp
|
||||
world/particle/LavaParticle.cpp
|
||||
world/particle/FireworkParticle.cpp
|
||||
world/tile/InvisibleTile.cpp
|
||||
world/tile/Sapling.cpp
|
||||
world/tile/TreeTile.cpp
|
||||
@@ -266,6 +269,7 @@ add_library(reminecraftpe-core STATIC
|
||||
world/tile/ObsidianTile.cpp
|
||||
world/tile/FarmTile.cpp
|
||||
world/tile/DoorTile.cpp
|
||||
world/tile/RocketLauncherTile.cpp
|
||||
renderer/GL/GL.cpp
|
||||
)
|
||||
target_include_directories(reminecraftpe-core PUBLIC . ..)
|
||||
|
||||
@@ -549,6 +549,10 @@ void StartMenuScreen::render(int a, int b, float c)
|
||||
if (!crampedMode)
|
||||
drawSplash();
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
m_pMinecraft->m_pTextures->loadAndBindTexture("terrain.png");
|
||||
this->blit(0, 0, 0, 0, 256, 256, 256, 256);
|
||||
|
||||
Screen::render(a, b, c);
|
||||
}
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ void GameRenderer::renderLevel(float f)
|
||||
|
||||
glDisable(GL_FOG);
|
||||
|
||||
if (true) // @TODO
|
||||
if (false) // TODO: Figure out how to enable weather
|
||||
renderWeather(f);
|
||||
|
||||
if (field_44 == 1.0f)
|
||||
|
||||
@@ -1184,7 +1184,11 @@ void LevelRenderer::takePicture(TripodCamera* pCamera, Entity* pOwner)
|
||||
void LevelRenderer::addParticle(const std::string& name, float x, float y, float z, float vx, float vy, float vz)
|
||||
{
|
||||
// TODO: Who's the genius who decided it'd be better to check a name string rather than an enum?
|
||||
if (m_pMinecraft->m_pMobPersp->distanceToSqr_inline(x, y, z) > 256.0f)
|
||||
float maxDist = 256.0f;
|
||||
if (name == "explodeColor")
|
||||
maxDist = 16384.0f;
|
||||
|
||||
if (m_pMinecraft->m_pMobPersp->distanceToSqr_inline(x, y, z) > maxDist)
|
||||
return;
|
||||
|
||||
ParticleEngine* pe = m_pMinecraft->m_pParticleEngine;
|
||||
@@ -1203,11 +1207,29 @@ void LevelRenderer::addParticle(const std::string& name, float x, float y, float
|
||||
pe->add(new ExplodeParticle(m_pLevel, x, y, z, vx, vy, vz));
|
||||
return;
|
||||
}
|
||||
if (name == "explodeColor")
|
||||
{
|
||||
ExplodeParticle* pExplPart = new ExplodeParticle(m_pLevel, x, y, z, vx, vy, vz);
|
||||
pExplPart->m_bIsUnlit = true;
|
||||
pExplPart->field_F8 = Mth::random();
|
||||
pExplPart->field_FC = Mth::random();
|
||||
pExplPart->field_100 = Mth::random();
|
||||
pExplPart->scale(3.0f);
|
||||
pe->add(pExplPart);
|
||||
return;
|
||||
}
|
||||
if (name == "flame")
|
||||
{
|
||||
pe->add(new FlameParticle(m_pLevel, x, y, z, vx, vy, vz));
|
||||
return;
|
||||
}
|
||||
if (name == "flame2")
|
||||
{
|
||||
FlameParticle* pFlamePart = new FlameParticle(m_pLevel, x, y, z, vx, vy, vz);
|
||||
pFlamePart->scale(4.0f);
|
||||
pe->add(pFlamePart);
|
||||
return;
|
||||
}
|
||||
if (name == "lava")
|
||||
{
|
||||
pe->add(new LavaParticle(m_pLevel, x, y, z));
|
||||
@@ -1230,15 +1252,24 @@ void LevelRenderer::addParticle(const std::string& name, float x, float y, float
|
||||
void LevelRenderer::playSound(const std::string& name, float x, float y, float z, float a, float b)
|
||||
{
|
||||
// TODO: Who's the genius who decided it'd be better to check a name string rather than an enum?
|
||||
float mult = 1.0f, dist = 16.0f;
|
||||
float mult = 1.0f, maxDist = 16.0f;
|
||||
float playerDist = m_pMinecraft->m_pMobPersp->distanceToSqr(x, y, z);
|
||||
|
||||
if (a > 1.0f)
|
||||
{
|
||||
mult = 16.0f;
|
||||
dist = a * mult;
|
||||
maxDist = a * mult;
|
||||
}
|
||||
|
||||
if (dist * dist > m_pMinecraft->m_pMobPersp->distanceToSqr(x, y, z))
|
||||
if (name == "random.explode")
|
||||
{
|
||||
a *= 1.0f - playerDist / 65536.0f;
|
||||
if (a < 0)
|
||||
return;
|
||||
maxDist = 256.0f;
|
||||
}
|
||||
|
||||
if (maxDist * maxDist > playerDist)
|
||||
m_pMinecraft->m_pSoundEngine->play(name, x, y, z, a, b);
|
||||
}
|
||||
|
||||
|
||||
0
source/client/renderer/entity/RocketRenderer.cpp
Normal file
0
source/client/renderer/entity/RocketRenderer.cpp
Normal file
0
source/client/renderer/entity/RocketRenderer.hpp
Normal file
0
source/client/renderer/entity/RocketRenderer.hpp
Normal file
@@ -166,7 +166,6 @@ int Mth::random(int max)
|
||||
|
||||
float Mth::random()
|
||||
{
|
||||
return g_Random.genrand_int32() * (1.0f / 4294967295.0f);
|
||||
// divided by 2^32-1
|
||||
return g_Random.nextFloat();
|
||||
}
|
||||
|
||||
|
||||
@@ -279,6 +279,7 @@ enum eTileID
|
||||
TILE_INFO_UPDATEGAME2 = 249,
|
||||
|
||||
TILE_OBSIDIAN_CRYING = 200, // custom stuff - ID of 200
|
||||
TILE_ROCKET_LAUNCHER,
|
||||
|
||||
ITEM_SHOVEL_IRON = 256,
|
||||
ITEM_PICKAXE_IRON,
|
||||
@@ -385,6 +386,9 @@ enum eTileID
|
||||
ITEM_RECORD_01,
|
||||
ITEM_RECORD_02,
|
||||
ITEM_CAMERA = 456,
|
||||
|
||||
// Custom items
|
||||
ITEM_ROCKET = 470,
|
||||
};
|
||||
|
||||
enum // Textures
|
||||
|
||||
@@ -438,7 +438,9 @@ label_45:
|
||||
bool bPlaySound = true;
|
||||
|
||||
const Tile::SoundType *sound = Tile::tiles[tileID]->m_pSound;
|
||||
if (m_pLevel->getTile(tileX, tileY + 1, tileZ) == Tile::topSnow->m_ID)
|
||||
if (!isPlayer()) // no idea why this wasn't already a thing
|
||||
bPlaySound = false;
|
||||
else if (m_pLevel->getTile(tileX, tileY + 1, tileZ) == Tile::topSnow->m_ID)
|
||||
sound = Tile::topSnow->m_pSound;
|
||||
else if (Tile::tiles[tileID]->m_pMaterial->isLiquid())
|
||||
bPlaySound = false;
|
||||
|
||||
85
source/world/entity/Rocket.cpp
Normal file
85
source/world/entity/Rocket.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
/********************************************************************
|
||||
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
|
||||
********************************************************************/
|
||||
|
||||
#include "Rocket.hpp"
|
||||
#include "Player.hpp"
|
||||
#include "world/level/Level.hpp"
|
||||
|
||||
Rocket::Rocket(Level* level, float x, float y, float z) : Entity(level)
|
||||
{
|
||||
field_B8C = 0;
|
||||
field_B90 = 80;
|
||||
field_C8 = RENDER_CAMERA;
|
||||
|
||||
field_34 = 1;
|
||||
|
||||
setSize(1.0f, 1.5f);
|
||||
field_84 = field_8C * 0.5f - 0.25f;
|
||||
|
||||
setPos(x, y, z);
|
||||
field_3C.x = x;
|
||||
field_3C.y = y;
|
||||
field_3C.z = z;
|
||||
|
||||
m_vel.y = 1.0f;
|
||||
}
|
||||
|
||||
float Rocket::getShadowHeightOffs()
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool Rocket::interact(Player* player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int Rocket::interactPreventDefault()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool Rocket::isPickable()
|
||||
{
|
||||
return !m_bRemoved;
|
||||
}
|
||||
|
||||
bool Rocket::isPushable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Rocket::tick()
|
||||
{
|
||||
field_3C = m_pos;
|
||||
|
||||
m_vel.y *= 0.99f;
|
||||
|
||||
move(m_vel.x, m_vel.y, m_vel.z);
|
||||
|
||||
field_B90--;
|
||||
if (field_B90 == 0)
|
||||
{
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
float yaw = sharedRandom.nextFloat() * float(M_PI) * 2;
|
||||
float pitch = sharedRandom.nextFloat() * float(M_PI) * 2;
|
||||
|
||||
float xo = sharedRandom.nextFloat() * cosf(yaw);
|
||||
float zo = sharedRandom.nextFloat() * sinf(yaw);
|
||||
float yo = sharedRandom.nextFloat() * sinf(pitch);
|
||||
|
||||
m_pLevel->addParticle("explodeColor", m_pos.x, m_pos.y, m_pos.z, xo, yo, zo);
|
||||
}
|
||||
|
||||
m_pLevel->playSound(this, "random.explode", 1.0f, 1.0f);
|
||||
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
32
source/world/entity/Rocket.hpp
Normal file
32
source/world/entity/Rocket.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/********************************************************************
|
||||
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 "Mob.hpp"
|
||||
|
||||
class Level;
|
||||
class Player;
|
||||
|
||||
class Rocket : public Entity
|
||||
{
|
||||
public:
|
||||
Rocket(Level*, float, float, float);
|
||||
|
||||
float getShadowHeightOffs() override;
|
||||
bool interact(Player* player) override;
|
||||
int interactPreventDefault() override;
|
||||
bool isPickable() override;
|
||||
bool isPushable() override;
|
||||
void tick() override;
|
||||
|
||||
public:
|
||||
int field_B8C;
|
||||
int field_B90;
|
||||
};
|
||||
|
||||
@@ -66,6 +66,8 @@ void Inventory::prepareCreativeInventory()
|
||||
addCreativeItem(Tile::sponge->m_ID);
|
||||
addCreativeItem(Tile::sapling->m_ID);
|
||||
addCreativeItem(Tile::cryingObsidian->m_ID);
|
||||
addCreativeItem(Tile::rocketLauncher->m_ID);
|
||||
addCreativeItem(Tile::redStoneOre->m_ID);
|
||||
|
||||
// test stuff
|
||||
addCreativeItem(Tile::water->m_ID);
|
||||
@@ -76,6 +78,7 @@ void Inventory::prepareCreativeInventory()
|
||||
addCreativeItem(Item::camera->m_itemID);
|
||||
addCreativeItem(Item::door_wood->m_itemID);
|
||||
addCreativeItem(Item::door_iron->m_itemID);
|
||||
addCreativeItem(Item::rocket->m_itemID);
|
||||
|
||||
for (int i = 0; i < C_MAX_HOTBAR_ITEMS; i++)
|
||||
m_hotbar[i] = i;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "DoorItem.hpp"
|
||||
#include "TileItem.hpp"
|
||||
#include "TilePlanterItem.hpp"
|
||||
#include "RocketItem.hpp"
|
||||
|
||||
#define ITEM(x) ((x) - 256)
|
||||
|
||||
@@ -194,6 +195,10 @@ void Item::initItems()
|
||||
Item::camera = NEW_X_ITEMN(CameraItem, ITEM_CAMERA)
|
||||
->setIcon(2, 15)
|
||||
->setDescriptionId("camera");
|
||||
|
||||
Item::rocket = NEW_X_ITEMN(RocketItem, ITEM_ROCKET)
|
||||
->setIcon(14, 2)
|
||||
->setDescriptionId("rocket");
|
||||
}
|
||||
|
||||
int Item::getIcon(ItemInstance* pInstance)
|
||||
@@ -411,7 +416,8 @@ Item
|
||||
*Item::diode,
|
||||
*Item::record_01,
|
||||
*Item::record_02,
|
||||
*Item::camera;
|
||||
*Item::camera,
|
||||
*Item::rocket;
|
||||
|
||||
Item::Tier
|
||||
Item::Tier::WOOD (0, 59, 2.0f, 0),
|
||||
|
||||
@@ -198,5 +198,6 @@ public: // Static declarations
|
||||
*diode,
|
||||
*record_01,
|
||||
*record_02,
|
||||
*camera;
|
||||
*camera,
|
||||
*rocket;
|
||||
};
|
||||
|
||||
38
source/world/item/RocketItem.cpp
Normal file
38
source/world/item/RocketItem.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/********************************************************************
|
||||
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
|
||||
********************************************************************/
|
||||
|
||||
#include "RocketItem.hpp"
|
||||
#include "world/level/Level.hpp"
|
||||
#include "world/entity/Player.hpp"
|
||||
#include "world/entity/Rocket.hpp"
|
||||
|
||||
RocketItem::RocketItem(int id) : Item(id)
|
||||
{
|
||||
}
|
||||
|
||||
bool RocketItem::useOn(ItemInstance* inst, Player* player, Level* level, int x, int y, int z, int dir)
|
||||
{
|
||||
if (level->getTile(x, y, z) == Tile::topSnow->m_ID)
|
||||
{
|
||||
dir = DIR_YNEG;
|
||||
}
|
||||
else switch (dir)
|
||||
{
|
||||
case DIR_YNEG: y--; break;
|
||||
case DIR_YPOS: y++; break;
|
||||
case DIR_ZNEG: z--; break;
|
||||
case DIR_ZPOS: z++; break;
|
||||
case DIR_XNEG: x--; break;
|
||||
case DIR_XPOS: x++; break;
|
||||
}
|
||||
|
||||
level->addEntity(new Rocket(level, float(x), float(y), float(z)));
|
||||
|
||||
inst->m_amount--;
|
||||
return true;
|
||||
}
|
||||
18
source/world/item/RocketItem.hpp
Normal file
18
source/world/item/RocketItem.hpp
Normal file
@@ -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 RocketItem : public Item
|
||||
{
|
||||
public:
|
||||
RocketItem(int id);
|
||||
|
||||
bool useOn(ItemInstance*, Player*, Level*, int x, int y, int z, int dir) override;
|
||||
};
|
||||
0
source/world/particle/FireworkParticle.cpp
Normal file
0
source/world/particle/FireworkParticle.cpp
Normal file
0
source/world/particle/FireworkParticle.hpp
Normal file
0
source/world/particle/FireworkParticle.hpp
Normal file
@@ -22,6 +22,7 @@ void Particle::_init()
|
||||
field_F8 = 1.0f;
|
||||
field_FC = 1.0f;
|
||||
field_100 = 1.0f;
|
||||
m_bIsUnlit = false;
|
||||
}
|
||||
|
||||
Particle::Particle(Level* level, float x, float y, float z, float vx, float vy, float vz) : Entity(level)
|
||||
@@ -82,7 +83,7 @@ void Particle::render(Tesselator& t, float f, float a4, float a5, float a6, floa
|
||||
float posX = Lerp(field_3C.x, m_pos.x, f) - xOff;
|
||||
float posY = Lerp(field_3C.y, m_pos.y, f) - yOff;
|
||||
float posZ = Lerp(field_3C.z, m_pos.z, f) - zOff;
|
||||
float fBright = getBrightness(f);
|
||||
float fBright = m_bIsUnlit ? 1.0f : getBrightness(f);
|
||||
|
||||
float sizeX = a4 * field_F0 * 0.1f;
|
||||
float sizeY = a5 * field_F0 * 0.1f;
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
float field_F8;
|
||||
float field_FC;
|
||||
float field_100;
|
||||
bool m_bIsUnlit;
|
||||
|
||||
static float xOff, yOff, zOff;
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ Bush::Bush(int id, int texture) : Tile(id, Material::plant)
|
||||
|
||||
int Bush::getRenderShape()
|
||||
{
|
||||
return 1;
|
||||
return SHAPE_CROSS;
|
||||
}
|
||||
|
||||
bool Bush::isCubeShaped()
|
||||
|
||||
41
source/world/tile/RocketLauncherTile.cpp
Normal file
41
source/world/tile/RocketLauncherTile.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/********************************************************************
|
||||
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
|
||||
********************************************************************/
|
||||
#include "RocketLauncherTile.hpp"
|
||||
#include "world/item/RocketItem.hpp"
|
||||
|
||||
RocketLauncherTile::RocketLauncherTile(int id, int texture) : Tile(id, texture, Material::wood)
|
||||
{
|
||||
}
|
||||
|
||||
AABB* RocketLauncherTile::getAABB(Level*, int x, int y, int z)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int RocketLauncherTile::getRenderShape()
|
||||
{
|
||||
return SHAPE_CROSS;
|
||||
}
|
||||
|
||||
bool RocketLauncherTile::isCubeShaped()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RocketLauncherTile::isSolidRender()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int RocketLauncherTile::use(Level* pLevel, int x, int y, int z, Player* player)
|
||||
{
|
||||
// spawn a rocket
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
23
source/world/tile/RocketLauncherTile.hpp
Normal file
23
source/world/tile/RocketLauncherTile.hpp
Normal file
@@ -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 "Tile.hpp"
|
||||
|
||||
class RocketLauncherTile : public Tile
|
||||
{
|
||||
public:
|
||||
RocketLauncherTile(int id, int texture);
|
||||
|
||||
virtual AABB* getAABB(Level*, int x, int y, int z) override;
|
||||
virtual int getRenderShape() override;
|
||||
virtual bool isCubeShaped() override;
|
||||
virtual bool isSolidRender() override;
|
||||
virtual int use(Level* pLevel, int x, int y, int z, Player* player);
|
||||
};
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "SpongeTile.hpp"
|
||||
#include "BookshelfTile.hpp"
|
||||
#include "WireTile.hpp"
|
||||
#include "RocketLauncherTile.hpp"
|
||||
|
||||
std::string Tile::TILE_DESCRIPTION_PREFIX = "tile.";
|
||||
|
||||
@@ -697,6 +698,12 @@ void Tile::initTiles()
|
||||
->setSoundType(Tile::SOUND_STONE)
|
||||
->setDescriptionId("cryingObsidian");
|
||||
|
||||
// Jolly
|
||||
Tile::rocketLauncher = (new RocketLauncherTile(TILE_ROCKET_LAUNCHER, 16*14+2))
|
||||
->init()
|
||||
->setSoundType(Tile::SOUND_STONE)
|
||||
->setDescriptionId("rocketLauncher");
|
||||
|
||||
for (int i = 0; i < C_MAX_TILES; i++)
|
||||
{
|
||||
if (Tile::tiles[i])
|
||||
@@ -1144,4 +1151,5 @@ Tile
|
||||
*Tile::lapisBlock,
|
||||
*Tile::bookshelf,
|
||||
*Tile::mossStone,
|
||||
*Tile::cryingObsidian;
|
||||
*Tile::cryingObsidian,
|
||||
*Tile::rocketLauncher;
|
||||
|
||||
@@ -213,7 +213,8 @@ public: // static variables
|
||||
* lapisBlock,
|
||||
* bookshelf,
|
||||
* mossStone,
|
||||
* cryingObsidian;
|
||||
* cryingObsidian,
|
||||
* rocketLauncher;
|
||||
|
||||
public:
|
||||
int m_TextureFrame;
|
||||
|
||||
Reference in New Issue
Block a user