Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/client/app/Minecraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void Minecraft::handleBuildAction(const BuildActionIntention& action)
player->swing();
}

if (!action.isDestroy() && !m_pGameMode->field_8) // from Minecraft::handleMouseDown
if (!action.isDestroy() && !m_pGameMode->m_bInstaBuild) // from Minecraft::handleMouseDown
{
m_pGameMode->stopDestroyBlock();
}
Expand Down Expand Up @@ -444,7 +444,7 @@ void Minecraft::handleBuildAction(const BuildActionIntention& action)
// @BUG: Hits sometimes pass through fire when done from above
//if (extinguished) break;

if (pTile != Tile::unbreakable || (player->field_B94 >= 100 && !m_hitResult.m_bUnk24))
if (pTile != Tile::unbreakable || (player->m_userType >= 100 && !m_hitResult.m_bUnk24))
{
bool destroyed = false;
if (action.isDestroyStart())
Expand Down
4 changes: 2 additions & 2 deletions source/client/gui/screens/SelectWorldScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void SelectWorldScreen::tick()

// @BUG: Use of deallocated memory. SetScreen frees us
#ifdef ORIGINAL_CODE
field_130 = 0;
m_walkAnimPos = 0;
#endif

return;
Expand Down Expand Up @@ -211,7 +211,7 @@ void SelectWorldScreen::_buttonClicked(Button* pButton)
#else
m_pMinecraft->platform()->showDialog(AppPlatform::DLG_CREATE_WORLD);
m_pMinecraft->platform()->createUserInput();
field_130 = true;
m_walkAnimPos = true;
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion source/client/multiplayer/MultiplayerLocalPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool MultiplayerLocalPlayer::hurt(Entity* pAttacker, int damage)
}

float ang = atan2f(zd, xd);
v020_field_104 = ang * (180.0f / float(M_PI)) - m_rot.x;
m_hurtDir = ang * (180.0f / float(M_PI)) - m_rot.x;

knockback(pAttacker, damage, xd, zd);
}
Expand Down
2 changes: 1 addition & 1 deletion source/client/network/ClientSideNetworkHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& rakGuid, StartGa

m_pLevel->m_bIsClientSide = true;

MultiplayerLocalPlayer *pLocalPlayer = new MultiplayerLocalPlayer(m_pMinecraft, m_pLevel, m_pMinecraft->m_pUser, settings.m_gameType, m_pLevel->m_pDimension->field_50);
MultiplayerLocalPlayer *pLocalPlayer = new MultiplayerLocalPlayer(m_pMinecraft, m_pLevel, m_pMinecraft->m_pUser, settings.m_gameType, m_pLevel->m_pDimension->m_id);
pLocalPlayer->m_guid = ((RakNet::RakPeer*)m_pServerPeer)->GetMyGUID();
pLocalPlayer->m_EntityID = pStartGamePkt->m_entityId;

Expand Down
2 changes: 1 addition & 1 deletion source/client/renderer/GameRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void GameRenderer::bobView(Matrix& matrix, float f)
float f1 = Mth::Lerp(player->m_oBob, player->m_bob, f);
float f2 = Mth::Lerp(player->m_oTilt, player->m_tilt, f);
// @NOTE: Multiplying by M_PI inside of the paren makes it stuttery for some reason? Anyways it works now :)
float f3 = -(player->m_walkDist + (player->m_walkDist - player->field_90) * f) * float(M_PI);
float f3 = -(player->m_walkDist + (player->m_walkDist - player->m_walkDistO) * f) * float(M_PI);
float f4 = Mth::sin(f3);
float f5 = Mth::cos(f3);
float f6 = Mth::cos(f3 - 0.2f);
Expand Down
4 changes: 2 additions & 2 deletions source/client/renderer/entity/MobRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ void MobRenderer::render(const Entity& entity, const Vec3& pos, float rot, float
scale(mob, matrix, a);
matrix->translate(Vec3(0.0f, -24.0f * fScale - (1.0f / 128.0f), 0.0f));

float x1 = mob.field_128 + (mob.m_walkAnimSpeed - mob.field_128) * a;
float x1 = mob.m_walkAnimSpeedO + (mob.m_walkAnimSpeed - mob.m_walkAnimSpeedO) * a;
if (x1 > 1.0f)
x1 = 1.0f;
float x2 = mob.field_130 - mob.m_walkAnimSpeed * (1.0f - a);
float x2 = mob.m_walkAnimPos - mob.m_walkAnimSpeed * (1.0f - a);

_setupShaderParameters(entity, a);

Expand Down
4 changes: 2 additions & 2 deletions source/client/renderer/entity/TripodCameraRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ TripodCameraRenderer::TripodCameraRenderer()

float TripodCameraRenderer::getFlashTime(const TripodCamera& camera, float f)
{
if (camera.field_B90 > 7 || camera.field_B90 < 0)
if (camera.m_countdown > 7 || camera.m_countdown < 0)
return -1.0f;

return 0.125f * (float(camera.field_B90) - f);
return 0.125f * (float(camera.m_countdown) - f);
}

void TripodCameraRenderer::render(const Entity& entity, const Vec3& pos, float rot, float a)
Expand Down
2 changes: 1 addition & 1 deletion source/client/sound/SoundEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void SoundEngine::play(const std::string& name, const Vec3& pos, float volume, f

void SoundEngine::playUI(const std::string& name, float volume, float pitch)
{
volume *= 0.25F; // present on Java b1.2_02, but not Pocket for some reason
volume *= 0.25f; // present on Java b1.2_02, but not Pocket for some reason
float vol = m_pOptions->m_masterVolume.get() * volume;
if (vol <= 0.0f)
return;
Expand Down
20 changes: 10 additions & 10 deletions source/common/SmoothFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
#include "SmoothFloat.hpp"

SmoothFloat::SmoothFloat() :
field_0(0),
field_4(0),
field_8(0)
m_desiredValue(0),
m_currentValue(0),
m_velocity(0)
{
}

float SmoothFloat::getNewDeltaValue(float a1, float a2)
float SmoothFloat::getNewDeltaValue(float inputDelta, float speed)
{
field_0 += a1;
m_desiredValue += inputDelta;

float v1 = (field_0 - field_4) * a2;
field_8 += 0.5f * (v1 - field_8);
float v1 = (m_desiredValue - m_currentValue) * speed;
m_velocity += 0.5f * (v1 - m_velocity);

if ((v1 > 0.0f && field_8 < v1) || (v1 < 0.0f && field_8 > v1))
v1 = field_8;
if ((v1 > 0.0f && m_velocity < v1) || (v1 < 0.0f && m_velocity > v1))
v1 = m_velocity;

field_4 += v1;
m_currentValue += v1;

return v1;
}
10 changes: 6 additions & 4 deletions source/common/SmoothFloat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ class SmoothFloat
{
public:
SmoothFloat();
float getNewDeltaValue(float, float);

public:
float getNewDeltaValue(float inputDelta, float speed);

private:
float field_0;
float field_4;
float field_8;
float m_desiredValue;
float m_currentValue;
float m_velocity;
};

4 changes: 2 additions & 2 deletions source/network/packets/StartGamePacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void StartGamePacket::write(RakNet::BitStream& bs)
bs.Write(m_entityId);
// probably older, you figure it out
#if NETWORK_PROTOCOL_VERSION >= 29
bs.Write(m_time);
bs.Write(m_lifetime);
#endif
bs.Write(m_pos.x);
bs.Write(m_pos.y);
Expand All @@ -43,7 +43,7 @@ void StartGamePacket::read(RakNet::BitStream& bs)
#endif
bs.Read(m_entityId);
#if NETWORK_PROTOCOL_VERSION >= 29
bs.Read(m_time);
bs.Read(m_lifetime);
#endif
bs.Read(m_pos.x);
bs.Read(m_pos.y);
Expand Down
2 changes: 1 addition & 1 deletion source/world/entity/Animal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ float Animal::getWalkTargetValue(const TilePos& pos) const
/*bool Animal::hurt(Entity* pCulprit, int damage)
{
// Run around erratically for three seconds.
field_BA4 = 60;
m_goCrazyTicks = 60;

m_pAttackTarget = nullptr;
field_BB4 = 0;
Expand Down
2 changes: 1 addition & 1 deletion source/world/entity/Arrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void Arrow::playerTouch(Player* pPlayer)
{
if (!m_pLevel->m_bIsClientSide)
{
// had m_owner == pPlayer, but this logic breaks when loaded from a save, and m_owner is null
// had m_pPlayer == pPlayer, but this logic breaks when loaded from a save, and m_pPlayer is null
if (m_bInGround && m_bIsPlayerOwned && m_shakeTime <= 0)
{
ItemStack arrow(Item::arrow, 1);
Expand Down
1 change: 1 addition & 0 deletions source/world/entity/Chicken.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Chicken : public Animal
public:
Chicken(Level* pLevel);

public:
std::string getAmbientSound() const override { return "mob.chicken"; }
std::string getDeathSound() const override { return "mob.chickenhurt"; }
std::string getHurtSound() const override { return "mob.chickenhurt"; }
Expand Down
1 change: 1 addition & 0 deletions source/world/entity/Cow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Cow : public Animal
public:
Cow(Level* pLevel);

public:
std::string getAmbientSound() const override { return "mob.cow"; };
std::string getDeathSound() const override { return "mob.cowhurt"; }
std::string getHurtSound() const override { return "mob.cowhurt"; }
Expand Down
5 changes: 3 additions & 2 deletions source/world/entity/Creeper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Creeper : public Monster
public:
Creeper(Level* pLevel);

public:
void tick() override;
std::string getHurtSound() const override { return "mob.creeper"; }
std::string getDeathSound() const override { return "mob.creeperdeath"; }
Expand All @@ -18,8 +19,8 @@ class Creeper : public Monster
void setSwellDir(int value) { m_entityData.set<int>(DATA_SWELL_DIR, value); }
int getDeathLoot() const override { return ITEM_SULPHUR; }

virtual void die(Entity* pCulprit) override;
virtual void checkHurtTarget(Entity*, float) override;
void die(Entity* pCulprit) override;
void checkHurtTarget(Entity*, float) override;

private:
void _defineEntityData();
Expand Down
15 changes: 6 additions & 9 deletions source/world/entity/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ Random Entity::sharedRandom;
void Entity::_init()
{
m_bInAChunk = false;
field_20 = 0;
field_24 = 0;
field_28 = 0;
field_30 = 1.0f;
m_viewScale = 1.0f;
m_dimensionId = DIMENSION_OVERWORLD;
m_bBlocksBuilding = false;
m_pLevel = nullptr;
Expand All @@ -44,7 +41,7 @@ void Entity::_init()
m_heightOffset = 0.0f;
m_bbWidth = 0.6f;
m_bbHeight = 1.8f;
field_90 = 0.0f;
m_walkDistO = 0.0f;
m_walkDist = 0.0f;
m_bMakeStepSound = true;
m_ySlideOffset = 0.0f;
Expand Down Expand Up @@ -470,7 +467,7 @@ void Entity::baseTick()
{
//@TODO: untangle the gotos

field_90 = m_walkDist;
m_walkDistO = m_walkDist;
m_oPos = m_pos;
m_tickCount++;
m_oRot = m_rot;
Expand Down Expand Up @@ -728,9 +725,9 @@ float Entity::distanceToSqr(const Vec3& pos) const
return m_pos.distanceToSqr(pos);
}

int Entity::interactPreventDefault()
bool Entity::interactPreventDefault() const
{
return 0;
return false;
}

bool Entity::interact(Player* player)
Expand Down Expand Up @@ -778,7 +775,7 @@ bool Entity::shouldRender(Vec3& camPos) const

bool Entity::shouldRenderAtSqrDistance(float distSqr) const
{
float maxDist = (field_30 * 64.0f) * (((m_hitbox.max.z - m_hitbox.min.z) + (m_hitbox.max.x - m_hitbox.min.x) + (m_hitbox.max.y - m_hitbox.min.y)) / 3.0f);
float maxDist = (m_viewScale * 64.0f) * (((m_hitbox.max.z - m_hitbox.min.z) + (m_hitbox.max.x - m_hitbox.min.x) + (m_hitbox.max.y - m_hitbox.min.y)) / 3.0f);

return maxDist * maxDist > distSqr;
}
Expand Down
9 changes: 3 additions & 6 deletions source/world/entity/Entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class Entity
virtual float distanceToSqr(const Vec3& pos) const;
virtual float distanceTo(const Vec3& pos) const;
virtual float distanceToSqr(const Entity*) const;
virtual int interactPreventDefault();
virtual bool interactPreventDefault() const;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
virtual bool interact(Player*);
Expand Down Expand Up @@ -242,11 +242,8 @@ class Entity
bool m_bInAChunk;
ChunkPos m_chunkPos;
int m_chunkPosY;
int field_20; // unused Vec3?
int field_24;
int field_28;
Entity::ID m_EntityID;
float field_30;
float m_viewScale;
//TileSource* m_pTileSource;
DimensionId m_dimensionId;
bool m_bBlocksBuilding;
Expand All @@ -270,7 +267,7 @@ class Entity
float m_heightOffset;
float m_bbWidth;
float m_bbHeight;
float field_90;
float m_walkDistO;
float m_walkDist;
Vec3 m_posPrev;
float m_ySlideOffset;
Expand Down
6 changes: 3 additions & 3 deletions source/world/entity/FallingTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void FallingTile::_init(Level*, const Vec3& pos, int id)
_defineEntityData();

setTile(id);
field_E0 = 0;
m_time = 0;
m_bBlocksBuilding = false;
setSize(0.98f, 0.98f);
m_heightOffset = m_bbHeight * 0.5f;
Expand Down Expand Up @@ -61,7 +61,7 @@ void FallingTile::tick()
remove();

m_oPos = m_pos;
field_E0++;
m_time++;

m_vel.y -= 0.04f;
move(m_vel);
Expand All @@ -77,7 +77,7 @@ void FallingTile::tick()

if (!m_bOnGround)
{
if (field_E0 > 100 && !m_pLevel->m_bIsClientSide)
if (m_time > 100 && !m_pLevel->m_bIsClientSide)
{
spawnAtLocation(getTile(), 1);
remove();
Expand Down
2 changes: 1 addition & 1 deletion source/world/entity/FallingTile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ class FallingTile : public Entity
Level* getLevel() { return m_pLevel; }

public:
int field_E0;
int m_time;
};

Loading