mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
CMake: Refactor build system
This commit is contained in:
84
source/client/CMakeLists.txt
Normal file
84
source/client/CMakeLists.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
add_library(reminecraftpe-client STATIC
|
||||
app/App.cpp app/App.hpp
|
||||
app/AppPlatform.cpp app/AppPlatform.hpp
|
||||
app/Minecraft.cpp app/Minecraft.hpp
|
||||
app/NinecraftApp.cpp app/NinecraftApp.hpp
|
||||
model/Cube.cpp model/Cube.hpp
|
||||
model/HumanoidModel.cpp model/HumanoidModel.hpp
|
||||
model/Model.cpp model/Model.hpp
|
||||
model/PigModel.cpp model/PigModel.hpp
|
||||
model/PolygonQuad.cpp model/PolygonQuad.hpp
|
||||
network/ClientSideNetworkHandler.cpp network/ClientSideNetworkHandler.hpp
|
||||
options/Options.cpp options/Options.hpp
|
||||
player/LocalPlayer.cpp player/LocalPlayer.hpp
|
||||
player/input/Controller.cpp player/input/Controller.hpp
|
||||
player/input/ControllerTurnInput.cpp player/input/ControllerTurnInput.hpp
|
||||
player/input/CustomInputHolder.cpp player/input/CustomInputHolder.hpp
|
||||
player/input/IBuildInput.cpp player/input/IBuildInput.hpp
|
||||
player/input/IInputHolder.cpp player/input/IInputHolder.hpp
|
||||
player/input/IMoveInput.cpp player/input/IMoveInput.hpp
|
||||
player/input/ITouchScreenModel.cpp player/input/ITouchScreenModel.hpp
|
||||
player/input/ITurnInput.cpp player/input/ITurnInput.hpp
|
||||
player/input/IncludeExcludeArea.cpp player/input/IncludeExcludeArea.hpp
|
||||
player/input/Keyboard.cpp player/input/Keyboard.hpp
|
||||
player/input/KeyboardInput.cpp player/input/KeyboardInput.hpp
|
||||
player/input/Mouse.cpp player/input/Mouse.hpp
|
||||
player/input/MouseDevice.cpp player/input/MouseDevice.hpp
|
||||
player/input/MouseHandler.cpp player/input/MouseHandler.hpp
|
||||
player/input/MouseTurnInput.cpp player/input/MouseTurnInput.hpp
|
||||
player/input/Multitouch.cpp player/input/Multitouch.hpp
|
||||
player/input/PolygonArea.cpp player/input/PolygonArea.hpp
|
||||
player/input/RectangleArea.cpp player/input/RectangleArea.hpp
|
||||
player/input/TouchAreaModel.cpp player/input/TouchAreaModel.hpp
|
||||
player/input/TouchInputHolder.cpp player/input/TouchInputHolder.hpp
|
||||
player/input/TouchscreenInput_TestFps.cpp player/input/TouchscreenInput_TestFps.hpp
|
||||
player/input/UnifiedTurnBuild.cpp player/input/UnifiedTurnBuild.hpp
|
||||
renderer/Chunk.cpp renderer/Chunk.hpp
|
||||
renderer/Culler.cpp renderer/Culler.hpp
|
||||
renderer/DynamicTexture.cpp renderer/DynamicTexture.hpp
|
||||
renderer/FireTexture.cpp
|
||||
renderer/FoliageColor.cpp renderer/FoliageColor.hpp
|
||||
renderer/Font.cpp renderer/Font.hpp
|
||||
renderer/Frustum.cpp renderer/Frustum.hpp
|
||||
renderer/FrustumCuller.cpp renderer/FrustumCuller.hpp
|
||||
renderer/GameRenderer.cpp renderer/GameRenderer.hpp
|
||||
renderer/GrassColor.cpp renderer/GrassColor.hpp
|
||||
renderer/ItemInHandRenderer.cpp renderer/ItemInHandRenderer.hpp
|
||||
renderer/LavaSideTexture.cpp
|
||||
renderer/LavaTexture.cpp
|
||||
renderer/LevelRenderer.cpp renderer/LevelRenderer.hpp
|
||||
renderer/LightLayer.cpp renderer/LightLayer.hpp
|
||||
renderer/LightUpdate.cpp renderer/LightUpdate.hpp
|
||||
renderer/Matrix.cpp renderer/Matrix.hpp
|
||||
renderer/PatchManager.cpp renderer/PatchManager.hpp
|
||||
renderer/RenderChunk.cpp renderer/RenderChunk.hpp
|
||||
renderer/RenderList.cpp renderer/RenderList.hpp
|
||||
renderer/Tesselator.cpp renderer/Tesselator.hpp
|
||||
renderer/Textures.cpp renderer/Textures.hpp
|
||||
renderer/TileRenderer.cpp renderer/TileRenderer.hpp
|
||||
renderer/WaterSideTexture.cpp
|
||||
renderer/WaterTexture.cpp
|
||||
renderer/entity/EntityRenderDispatcher.cpp renderer/entity/EntityRenderDispatcher.hpp
|
||||
renderer/entity/EntityRenderer.cpp renderer/entity/EntityRenderer.hpp
|
||||
renderer/entity/FallingTileRenderer.cpp renderer/entity/FallingTileRenderer.hpp
|
||||
renderer/entity/HumanoidMobRenderer.cpp renderer/entity/HumanoidMobRenderer.hpp
|
||||
renderer/entity/ItemRenderer.cpp renderer/entity/ItemRenderer.hpp
|
||||
renderer/entity/ItemSpriteRenderer.cpp renderer/entity/ItemSpriteRenderer.hpp
|
||||
renderer/entity/MobRenderer.cpp renderer/entity/MobRenderer.hpp
|
||||
renderer/entity/TntRenderer.cpp renderer/entity/TntRenderer.hpp
|
||||
renderer/entity/TripodCameraRenderer.cpp renderer/entity/TripodCameraRenderer.hpp
|
||||
sound/SoundData.cpp sound/SoundData.hpp
|
||||
sound/SoundEngine.cpp sound/SoundEngine.hpp
|
||||
sound/SoundRepository.cpp sound/SoundRepository.hpp
|
||||
sound/SoundSystem.cpp sound/SoundSystem.hpp
|
||||
)
|
||||
add_subdirectory(gui)
|
||||
#add_subdirectory(player/input)
|
||||
|
||||
#add_library(reminecraftpe-client INTERFACE)
|
||||
target_link_libraries(reminecraftpe-client PUBLIC
|
||||
reminecraftpe-gui
|
||||
reminecraftpe-renderer
|
||||
#reminecraftpe-network
|
||||
#reminecraftpe-input
|
||||
)
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "client/gui/Screen.hpp"
|
||||
#include "network/RakNetInstance.hpp"
|
||||
#include "network/NetEventCallback.hpp"
|
||||
#include "client/player/LocalPlayer.hpp"
|
||||
#include "client/player/input/IInputHolder.hpp"
|
||||
#include "client/player/input/MouseHandler.hpp"
|
||||
#include "client/player/input/BuildActionIntention.hpp"
|
||||
@@ -24,7 +25,6 @@
|
||||
#include "client/renderer/entity/EntityRenderDispatcher.hpp"
|
||||
#include "client/sound/SoundEngine.hpp"
|
||||
#include "world/level/Level.hpp"
|
||||
#include "world/entity/LocalPlayer.hpp"
|
||||
#include "world/gamemode/GameMode.hpp"
|
||||
#include "world/particle/ParticleEngine.hpp"
|
||||
|
||||
|
||||
31
source/client/gui/CMakeLists.txt
Normal file
31
source/client/gui/CMakeLists.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
add_library(reminecraftpe-gui STATIC
|
||||
Gui.cpp Gui.hpp
|
||||
GuiComponent.cpp GuiComponent.hpp
|
||||
Screen.cpp Screen.hpp
|
||||
components/AvailableGamesList.cpp components/AvailableGamesList.hpp
|
||||
components/Button.cpp components/Button.hpp
|
||||
components/OptionList.cpp components/OptionList.hpp
|
||||
components/RolledSelectionList.cpp components/RolledSelectionList.hpp
|
||||
components/ScrolledSelectionList.cpp components/ScrolledSelectionList.hpp
|
||||
components/SmallButton.cpp components/SmallButton.hpp
|
||||
components/TextInputBox.cpp components/TextInputBox.hpp
|
||||
components/WorldSelectionList.cpp components/WorldSelectionList.hpp
|
||||
screens/ChatScreen.cpp screens/ChatScreen.hpp
|
||||
screens/ConfirmScreen.cpp screens/ConfirmScreen.hpp
|
||||
screens/CreateWorldScreen.cpp screens/CreateWorldScreen.hpp
|
||||
screens/DeathScreen.cpp screens/DeathScreen.hpp
|
||||
screens/DeathScreen.cpp screens/DeathScreen.hpp
|
||||
screens/DeleteWorldScreen.cpp screens/DeleteWorldScreen.hpp
|
||||
screens/DirectConnectScreen.cpp screens/DirectConnectScreen.hpp
|
||||
screens/IngameBlockSelectionScreen.cpp screens/IngameBlockSelectionScreen.hpp
|
||||
screens/InvalidLicenseScreen.cpp screens/InvalidLicenseScreen.hpp
|
||||
screens/JoinGameScreen.cpp screens/JoinGameScreen.hpp
|
||||
screens/OptionsScreen.cpp screens/OptionsScreen.hpp
|
||||
screens/PauseScreen.cpp screens/PauseScreen.hpp
|
||||
screens/ProgressScreen.cpp screens/ProgressScreen.hpp
|
||||
screens/RenameMPLevelScreen.cpp screens/RenameMPLevelScreen.hpp
|
||||
screens/SavingWorldScreen.cpp screens/SavingWorldScreen.hpp
|
||||
screens/SelectWorldScreen.cpp screens/SelectWorldScreen.hpp
|
||||
screens/StartMenuScreen.cpp screens/StartMenuScreen.hpp
|
||||
)
|
||||
target_link_libraries(reminecraftpe-gui PUBLIC reminecraftpe-common reminecraftpe-client)
|
||||
@@ -6,6 +6,8 @@
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
|
||||
#include "compat/KeyCodes.hpp"
|
||||
|
||||
#include "TextInputBox.hpp"
|
||||
#include "client/app/Minecraft.hpp"
|
||||
#ifndef ORIGINAL_CODE
|
||||
|
||||
243
source/client/player/LocalPlayer.cpp
Normal file
243
source/client/player/LocalPlayer.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
/********************************************************************
|
||||
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 "LocalPlayer.hpp"
|
||||
#include "client/app/Minecraft.hpp"
|
||||
|
||||
int dword_250ADC, dword_250AE0;
|
||||
|
||||
LocalPlayer::LocalPlayer(Minecraft* pMinecraft, Level* pLevel, User* pUser, int i) : Player(pLevel)
|
||||
{
|
||||
field_BEC = 0;
|
||||
field_BF0 = 0.0f;
|
||||
field_BF8 = 0.0f;
|
||||
field_BFC = 0.0f;
|
||||
field_C00 = 0.0f;
|
||||
field_C04 = 0.0f;
|
||||
field_C08 = 0.0f;
|
||||
field_C0C = 0.0f;
|
||||
field_C10 = 0.0f;
|
||||
field_C14 = 0.0f;
|
||||
field_C18 = 0.0f;
|
||||
field_C1C = 0.0f;
|
||||
m_nAutoJumpFrames = 0;
|
||||
// multiplayer related
|
||||
field_C24 = 0.0f;
|
||||
field_C28 = 0.0f;
|
||||
field_C2C = 0.0f;
|
||||
field_C30 = 0.0f;
|
||||
field_C34 = 0.0f;
|
||||
// multiplayer related -- end
|
||||
field_C38 = 0;
|
||||
m_pMoveInput = nullptr;
|
||||
|
||||
m_pMinecraft = pMinecraft;
|
||||
m_name = pUser->field_0;
|
||||
|
||||
field_BC4 = i;
|
||||
field_C38 = m_pInventory->getSelectedItemId();
|
||||
}
|
||||
|
||||
LocalPlayer::~LocalPlayer()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalPlayer::aiStep()
|
||||
{
|
||||
m_pMoveInput->tick(this);
|
||||
if (m_pMoveInput->m_bSneakButton && field_A4 < 0.2f)
|
||||
field_A4 = 0.2f;
|
||||
|
||||
Mob::aiStep();
|
||||
Player::aiStep();
|
||||
}
|
||||
|
||||
void LocalPlayer::animateRespawn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LocalPlayer::calculateFlight(float x, float y, float z)
|
||||
{
|
||||
float f1 = m_pMinecraft->getOptions()->field_244;
|
||||
float x1 = f1 * x;
|
||||
float z1 = f1 * z;
|
||||
|
||||
float y1 = 0.0f;
|
||||
if (Keyboard::isKeyDown(m_pMinecraft->getOptions()->getKey(KM_FLY_UP)))
|
||||
y1 = f1 * 0.2f;
|
||||
if (Keyboard::isKeyDown(m_pMinecraft->getOptions()->getKey(KM_FLY_DOWN)))
|
||||
y1 = f1 * -0.2f;
|
||||
|
||||
field_BFC += x1;
|
||||
float f2 = m_pMinecraft->getOptions()->field_8 * 0.35f;
|
||||
float f3 = f2 * (field_BFC - field_C00);
|
||||
float f4 = field_C04 + 0.5f * (f3 - field_C04);
|
||||
field_C04 = f4;
|
||||
if ((f3 <= 0.0f || f3 <= f4) && (f3 >= 0.0f || f3 >= f4))
|
||||
f4 = f3;
|
||||
field_C00 += f4;
|
||||
field_BF0 = f4 * 10.0f;
|
||||
|
||||
field_C08 += y1;
|
||||
float f5 = f2 * (field_C08 - field_C0C);
|
||||
float f6 = field_C10 + 0.5f * (f5 - field_C10);
|
||||
field_C10 = f6;
|
||||
if ((f5 <= 0.0f || f5 <= f6) && (f5 >= 0.0f || f5 >= f6))
|
||||
f6 = f5;
|
||||
field_C0C += f6;
|
||||
field_BF4 = f6 * 10.0f;
|
||||
|
||||
field_C14 += z1;
|
||||
float f7 = f2 * (field_C14 - field_C18);
|
||||
float f8 = field_C1C + 0.5f * (f7 - field_C1C);
|
||||
field_C1C = f8;
|
||||
if ((f7 <= 0.0f || f7 <= f8) && (f7 >= 0.0f || f7 >= f8))
|
||||
f8 = f7;
|
||||
field_C18 += f8;
|
||||
field_BF8 = f8 * 10.0f;
|
||||
}
|
||||
|
||||
void LocalPlayer::closeContainer()
|
||||
{
|
||||
Player::closeContainer();
|
||||
m_pMinecraft->setScreen(nullptr);
|
||||
}
|
||||
|
||||
void LocalPlayer::respawn()
|
||||
{
|
||||
m_pMinecraft->respawnPlayer(this);
|
||||
}
|
||||
|
||||
bool LocalPlayer::isSneaking()
|
||||
{
|
||||
return m_pMoveInput->m_bSneakButton;
|
||||
}
|
||||
|
||||
int LocalPlayer::move(float x, float y, float z)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
LocalPlayer* pLP = m_pMinecraft->m_pLocalPlayer;
|
||||
if (Minecraft::DEADMAU5_CAMERA_CHEATS && pLP == this && m_pMinecraft->getOptions()->m_bFlyCheat)
|
||||
{
|
||||
//@HUH: Using m_pMinecraft->m_pLocalPlayer instead of this, even though they're the same
|
||||
pLP->m_bNoCollision = true;
|
||||
|
||||
float field_94_old = field_94;
|
||||
|
||||
pLP->calculateFlight(x, y, z);
|
||||
pLP->m_distanceFallen = 0.0f;
|
||||
pLP->m_vel.y = 0.0f;
|
||||
|
||||
// This looks very funny.
|
||||
result = pLP->Entity::move(field_BF0, field_BF4, field_BF8);
|
||||
|
||||
pLP->field_7C = true;
|
||||
|
||||
field_94 = field_94_old;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef ORIGINAL_CODE
|
||||
// @BUG: In the original Minecraft, you can't stop flying! If you do, you'll just fall through to the bottom of the world. :(
|
||||
pLP->m_bNoCollision = false;
|
||||
#endif
|
||||
|
||||
// autojump stuff
|
||||
if (m_nAutoJumpFrames > 0)
|
||||
{
|
||||
m_nAutoJumpFrames--;
|
||||
m_pMoveInput->m_bJumpButton = true;
|
||||
}
|
||||
|
||||
float posX = m_pos.x;
|
||||
float posY = m_pos.y;
|
||||
|
||||
result = Entity::move(x, y, z);
|
||||
|
||||
//@BUG: backing up posZ too late
|
||||
float posZ = m_pos.z;
|
||||
|
||||
if (m_nAutoJumpFrames <= 0)
|
||||
{
|
||||
if (Mth::floor(posX * 2) == Mth::floor(m_pos.x * 2) &&
|
||||
Mth::floor(posY * 2) == Mth::floor(m_pos.y * 2) &&
|
||||
Mth::floor(posZ * 2) == Mth::floor(m_pos.z * 2))
|
||||
return result;
|
||||
|
||||
float dist = Mth::sqrt(x * x + z * z);
|
||||
int x1 = Mth::floor(x / dist + m_pos.x);
|
||||
int z1 = Mth::floor(z / dist + m_pos.z);
|
||||
|
||||
TileID tileOnTop = m_pLevel->getTile(x1, int(m_pos.y - 1.0f), z1);
|
||||
|
||||
// not standing on top of a tile?
|
||||
if (!m_pLevel->isSolidTile(x1, int(m_pos.y - 1.0f), z1))
|
||||
return 0;
|
||||
|
||||
// aren't inside of a tile right now
|
||||
if (m_pLevel->isSolidTile(x1, int(m_pos.y), z1))
|
||||
return 0;
|
||||
|
||||
// don't have anything on top of us
|
||||
if (m_pLevel->isSolidTile(x1, int(m_pos.y + 1.0f), z1))
|
||||
return 1;
|
||||
|
||||
// are we trying to walk into stairs or a slab?
|
||||
if (tileOnTop != Tile::stairs_stone->m_ID && tileOnTop != Tile::stairs_wood->m_ID && tileOnTop != Tile::stoneSlabHalf->m_ID && m_pMinecraft->getOptions()->m_bAutoJump)
|
||||
// Nope, we're walking towards a full block. Trigger an auto jump.
|
||||
m_nAutoJumpFrames = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void LocalPlayer::tick()
|
||||
{
|
||||
Player::tick();
|
||||
|
||||
if (m_pMinecraft->isOnline())
|
||||
{
|
||||
if (fabsf(m_pos.x - field_C24) > 0.1f ||
|
||||
fabsf(m_pos.y - field_C28) > 0.01f ||
|
||||
fabsf(m_pos.z - field_C2C) > 0.1f ||
|
||||
fabsf(field_C30 - m_pitch) > 1.0f ||
|
||||
fabsf(field_C34 - m_yaw) > 1.0f)
|
||||
{
|
||||
m_pMinecraft->m_pRakNetInstance->send(new MovePlayerPacket(m_EntityID, m_pos.x, m_pos.y - field_84, m_pos.z, m_pitch, m_yaw));
|
||||
field_C24 = m_pos.x;
|
||||
field_C28 = m_pos.y;
|
||||
field_C2C = m_pos.z;
|
||||
field_C30 = m_pitch;
|
||||
field_C34 = m_yaw;
|
||||
}
|
||||
|
||||
if (field_C38 != m_pInventory->getSelectedItemId())
|
||||
{
|
||||
field_C38 = m_pInventory->getSelectedItemId();
|
||||
m_pMinecraft->m_pRakNetInstance->send(new PlayerEquipmentPacket(m_EntityID, field_C38));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocalPlayer::updateAi()
|
||||
{
|
||||
Player::updateAi();
|
||||
|
||||
field_B00 = m_pMoveInput->m_horzInput;
|
||||
field_B04 = m_pMoveInput->m_vertInput;
|
||||
|
||||
field_B0C = m_pMoveInput->m_bJumpButton || m_nAutoJumpFrames > 0;
|
||||
}
|
||||
|
||||
bool LocalPlayer::isLocalPlayer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
61
source/client/player/LocalPlayer.hpp
Normal file
61
source/client/player/LocalPlayer.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
/********************************************************************
|
||||
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 "world/entity/Player.hpp"
|
||||
#include "client/player/input/IMoveInput.hpp"
|
||||
#include "client/player/input/User.hpp"
|
||||
|
||||
class Minecraft;
|
||||
|
||||
class LocalPlayer : public Player
|
||||
{
|
||||
public:
|
||||
LocalPlayer(Minecraft*, Level*, User*, int);
|
||||
virtual ~LocalPlayer();
|
||||
|
||||
// TODO: void addAdditonalSaveData();
|
||||
virtual void animateRespawn() override;
|
||||
virtual void aiStep() override;
|
||||
virtual bool isSneaking() override;
|
||||
virtual int move(float x, float y, float z) override;
|
||||
virtual void tick() override;
|
||||
virtual void updateAi() override;
|
||||
virtual bool isLocalPlayer() override;
|
||||
|
||||
void calculateFlight(float, float, float);
|
||||
void closeContainer(); //@HUH: oddly enough not a virtual/override
|
||||
void respawn();
|
||||
|
||||
public:
|
||||
int field_BEC;
|
||||
float field_BF0;
|
||||
float field_BF4;
|
||||
float field_BF8;
|
||||
float field_BFC;
|
||||
float field_C00;
|
||||
float field_C04;
|
||||
float field_C08;
|
||||
float field_C0C;
|
||||
float field_C10;
|
||||
float field_C14;
|
||||
float field_C18;
|
||||
float field_C1C;
|
||||
int m_nAutoJumpFrames;
|
||||
// multiplayer related
|
||||
float field_C24;
|
||||
float field_C28;
|
||||
float field_C2C;
|
||||
float field_C30;
|
||||
float field_C34;
|
||||
// multiplayer related -- end
|
||||
int field_C38;
|
||||
Minecraft* m_pMinecraft;
|
||||
IMoveInput* m_pMoveInput;
|
||||
};
|
||||
25
source/client/player/input/CMakeLists.txt
Normal file
25
source/client/player/input/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
add_library(reminecraftpe-input STATIC
|
||||
Controller.cpp Controller.hpp
|
||||
ControllerTurnInput.cpp ControllerTurnInput.hpp
|
||||
CustomInputHolder.cpp CustomInputHolder.hpp
|
||||
IBuildInput.cpp IBuildInput.hpp
|
||||
IInputHolder.cpp IInputHolder.hpp
|
||||
IMoveInput.cpp IMoveInput.hpp
|
||||
ITouchScreenModel.cpp ITouchScreenModel.hpp
|
||||
ITurnInput.cpp ITurnInput.hpp
|
||||
IncludeExcludeArea.cpp IncludeExcludeArea.hpp
|
||||
Keyboard.cpp Keyboard.hpp
|
||||
KeyboardInput.cpp KeyboardInput.hpp
|
||||
Mouse.cpp Mouse.hpp
|
||||
MouseDevice.cpp MouseDevice.hpp
|
||||
MouseHandler.cpp MouseHandler.hpp
|
||||
MouseTurnInput.cpp MouseTurnInput.hpp
|
||||
Multitouch.cpp Multitouch.hpp
|
||||
PolygonArea.cpp PolygonArea.hpp
|
||||
RectangleArea.cpp RectangleArea.hpp
|
||||
TouchAreaModel.cpp TouchAreaModel.hpp
|
||||
TouchInputHolder.cpp TouchInputHolder.hpp
|
||||
TouchscreenInput_TestFps.cpp TouchscreenInput_TestFps.hpp
|
||||
UnifiedTurnBuild.cpp UnifiedTurnBuild.hpp
|
||||
)
|
||||
target_link_libraries(reminecraftpe-input PRIVATE reminecraftpe-client)
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/Matrix.hpp"
|
||||
#include "Matrix.hpp"
|
||||
#include "world/phys/AABB.hpp"
|
||||
|
||||
class Frustum
|
||||
@@ -36,4 +36,4 @@ public:
|
||||
|
||||
public:
|
||||
Frustum x;
|
||||
};
|
||||
};
|
||||
|
||||
62
source/client/renderer/Matrix.cpp
Normal file
62
source/client/renderer/Matrix.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/********************************************************************
|
||||
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 "Matrix.hpp"
|
||||
|
||||
Matrix::Matrix()
|
||||
{
|
||||
c[0] = 0.0f;
|
||||
|
||||
memset(c, 0, sizeof c);
|
||||
}
|
||||
|
||||
Matrix::Matrix(float x)
|
||||
{
|
||||
memset(c, 0, sizeof c);
|
||||
c[0] = c[4 * 1 + 1] = c[4 * 2 + 2] = c[4 * 3 + 3] = x;
|
||||
}
|
||||
|
||||
Matrix::Matrix(float* p)
|
||||
{
|
||||
memcpy(c, p, sizeof c);
|
||||
}
|
||||
|
||||
Matrix::Matrix(float a, float b, float q, float d, float e, float f, float g, float h, float i, float j, float k, float l, float m, float n, float o, float p)
|
||||
{
|
||||
c[0] = a, c[1] = b, c[2] = q, c[3] = d, c[4] = e, c[5] = f, c[6] = g, c[7] = h, c[8] = i, c[9] = j, c[10] = k, c[11] = l, c[12] = m, c[13] = n, c[14] = o, c[15] = p;
|
||||
}
|
||||
|
||||
void Matrix::fetchGL(GLenum pname)
|
||||
{
|
||||
glGetFloatv(pname, c);
|
||||
}
|
||||
|
||||
Matrix operator*(const Matrix& a, const Matrix& b)
|
||||
{
|
||||
Matrix result;
|
||||
|
||||
//this is ugly
|
||||
result.c[0] = a.c[0] * b.c[0] + a.c[1] * b.c[4] + a.c[2] * b.c[8] + a.c[3] * b.c[12];
|
||||
result.c[1] = a.c[0] * b.c[1] + a.c[1] * b.c[5] + a.c[2] * b.c[9] + a.c[3] * b.c[13];
|
||||
result.c[2] = a.c[0] * b.c[2] + a.c[1] * b.c[6] + a.c[2] * b.c[10] + a.c[3] * b.c[14];
|
||||
result.c[3] = a.c[0] * b.c[3] + a.c[1] * b.c[7] + a.c[2] * b.c[11] + a.c[3] * b.c[15];
|
||||
result.c[4] = a.c[4] * b.c[0] + a.c[5] * b.c[4] + a.c[6] * b.c[8] + a.c[7] * b.c[12];
|
||||
result.c[5] = a.c[4] * b.c[1] + a.c[5] * b.c[5] + a.c[6] * b.c[9] + a.c[7] * b.c[13];
|
||||
result.c[6] = a.c[4] * b.c[2] + a.c[5] * b.c[6] + a.c[6] * b.c[10] + a.c[7] * b.c[14];
|
||||
result.c[7] = a.c[4] * b.c[3] + a.c[5] * b.c[7] + a.c[6] * b.c[11] + a.c[7] * b.c[15];
|
||||
result.c[8] = a.c[8] * b.c[0] + a.c[9] * b.c[4] + a.c[10] * b.c[8] + a.c[11] * b.c[12];
|
||||
result.c[9] = a.c[8] * b.c[1] + a.c[9] * b.c[5] + a.c[10] * b.c[9] + a.c[11] * b.c[13];
|
||||
result.c[10] = a.c[8] * b.c[2] + a.c[9] * b.c[6] + a.c[10] * b.c[10] + a.c[11] * b.c[14];
|
||||
result.c[11] = a.c[8] * b.c[3] + a.c[9] * b.c[7] + a.c[10] * b.c[11] + a.c[11] * b.c[15];
|
||||
result.c[12] = a.c[12] * b.c[0] + a.c[13] * b.c[4] + a.c[14] * b.c[8] + a.c[15] * b.c[12];
|
||||
result.c[13] = a.c[12] * b.c[1] + a.c[13] * b.c[5] + a.c[14] * b.c[9] + a.c[15] * b.c[13];
|
||||
result.c[14] = a.c[12] * b.c[2] + a.c[13] * b.c[6] + a.c[14] * b.c[10] + a.c[15] * b.c[14];
|
||||
result.c[15] = a.c[12] * b.c[3] + a.c[13] * b.c[7] + a.c[14] * b.c[11] + a.c[15] * b.c[15];
|
||||
|
||||
return result;
|
||||
}
|
||||
31
source/client/renderer/Matrix.hpp
Normal file
31
source/client/renderer/Matrix.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/********************************************************************
|
||||
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 <cstring>
|
||||
#include "common/Mth.hpp"
|
||||
#include "thirdparty/GL/GL.hpp"
|
||||
|
||||
class Matrix
|
||||
{
|
||||
public:
|
||||
Matrix(); // create an empty matrix
|
||||
Matrix(float a); // create an identity matrix
|
||||
Matrix(float* p); // load matrix from memory
|
||||
Matrix(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l, float m, float n, float o, float p);
|
||||
void fetchGL(GLenum pname);
|
||||
|
||||
friend Matrix operator*(const Matrix& a, const Matrix& b);
|
||||
|
||||
public:
|
||||
float c[16];
|
||||
};
|
||||
|
||||
Matrix operator*(const Matrix& a, const Matrix& b);
|
||||
|
||||
@@ -129,14 +129,26 @@ void EntityRenderDispatcher::render(Entity* entity, float a, float b, float c, f
|
||||
if (pRenderer)
|
||||
{
|
||||
#ifndef ORIGINAL_CODE
|
||||
if (pRenderer == &m_HumanoidMobRenderer)
|
||||
m_HumanoidMobRenderer.m_pHumanoidModel->field_10BE = entity->isSneaking();
|
||||
if (pRenderer == &m_HumanoidRenderer)
|
||||
m_HumanoidRenderer.m_pHumanoidModel->field_10BE = entity->isSneaking();
|
||||
else
|
||||
m_HumanoidMobRenderer.m_pHumanoidModel->field_10BE = false;
|
||||
m_HumanoidRenderer.m_pHumanoidModel->field_10BE = false;
|
||||
#endif
|
||||
|
||||
pRenderer->render(entity, a, b, c, d, e);
|
||||
}
|
||||
|
||||
/*
|
||||
glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
AABB hitbox = entity->m_hitbox;
|
||||
float hx = hitbox.min.x, hy = hitbox.min.y, hz = hitbox.min.z;
|
||||
float hw = hitbox.max.x - hx, hh = hitbox.max.y - hy, hd = hitbox.max.z - hz;
|
||||
printf("%f\n", hx);
|
||||
Cube cube(0, 0);
|
||||
cube.addBox(hx, hy, hz, hw, hh, hd);
|
||||
//cube.setPos(a, b, c);
|
||||
cube.render(e);
|
||||
*/
|
||||
}
|
||||
|
||||
void EntityRenderDispatcher::setLevel(Level* level)
|
||||
|
||||
@@ -156,8 +156,8 @@ void MobRenderer::renderName(Mob* mob, float x, float y, float z)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)mob;
|
||||
if (player == m_pDispatcher->m_pMinecraft->m_pLocalPlayer)
|
||||
return;
|
||||
//if (player == m_pDispatcher->m_pMinecraft->m_pLocalPlayer)
|
||||
// return;
|
||||
|
||||
// @TODO: don't know why but I have to add this correction. look into it and fix it!
|
||||
renderNameTag(mob, player->m_name, x, y - 1.5f, z, mob->isSneaking() ? 32 : 64);
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
// mcpe01_canada.apk file.
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef MISSING_SOUND_DATA
|
||||
#include "../../sound_data/sounds.h"
|
||||
#include "sound_data/sounds.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user