mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-05 18:10:09 +03:00
clang-tidy: fix many warnings
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
AppPlatform_sdl::AppPlatform_sdl(std::string storageDir, SDL_Window *window)
|
AppPlatform_sdl::AppPlatform_sdl(std::string storageDir, SDL_Window *window)
|
||||||
: AppPlatform_sdl_base(storageDir, window)
|
: AppPlatform_sdl_base(storageDir, window)
|
||||||
{
|
{
|
||||||
setIcon(loadTexture("icon.png"));
|
setIcon(AppPlatform_sdl::loadTexture("icon.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take Screenshot
|
// Take Screenshot
|
||||||
@@ -81,7 +81,7 @@ ret:
|
|||||||
}
|
}
|
||||||
if (rows != NULL)
|
if (rows != NULL)
|
||||||
{
|
{
|
||||||
delete rows[height];
|
delete[] rows;
|
||||||
}
|
}
|
||||||
if (file != NULL)
|
if (file != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -134,8 +134,6 @@ void Gui::render(float f, bool bHaveScreen, int mouseX, int mouseY)
|
|||||||
if (!m->m_pLevel || !m->m_pLocalPlayer)
|
if (!m->m_pLevel || !m->m_pLocalPlayer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool isTouchscreen = m->isTouchscreen();
|
|
||||||
|
|
||||||
field_4 = -90.0f;
|
field_4 = -90.0f;
|
||||||
|
|
||||||
#ifndef ENH_TRANSPARENT_HOTBAR
|
#ifndef ENH_TRANSPARENT_HOTBAR
|
||||||
@@ -257,15 +255,15 @@ void Gui::render(float f, bool bHaveScreen, int mouseX, int mouseY)
|
|||||||
emptyHeartX += 9 * b1;
|
emptyHeartX += 9 * b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ORIGINAL_CODE
|
||||||
// @NOTE: At the default scale, this would go off screen.
|
// @NOTE: At the default scale, this would go off screen.
|
||||||
|
|
||||||
int heartX = cenX - 191; // why?
|
int heartX = cenX - 191; // why?
|
||||||
int heartYStart = height - 10;
|
int heartYStart = height - 10;
|
||||||
|
#else
|
||||||
//@NOTE: Alpha-style health UI. I'll probably remove this on release.
|
//@NOTE: Alpha-style health UI. I'll probably remove this on release.
|
||||||
#ifndef ORIGINAL_CODE
|
int heartX = cenX - 91;
|
||||||
heartX = cenX - 91;
|
int heartYStart = height - 32;
|
||||||
heartYStart = height - 32;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int playerHealth = pLP->m_health;
|
int playerHealth = pLP->m_health;
|
||||||
@@ -301,12 +299,12 @@ void Gui::render(float f, bool bHaveScreen, int mouseX, int mouseY)
|
|||||||
int breathFull = int(ceilf((float(breathRaw - 2) * 10.0f) / 300.0f));
|
int breathFull = int(ceilf((float(breathRaw - 2) * 10.0f) / 300.0f));
|
||||||
int breathMeter = int(ceilf((float(breathRaw) * 10.0f) / 300.0f)) - breathFull;
|
int breathMeter = int(ceilf((float(breathRaw) * 10.0f) / 300.0f)) - breathFull;
|
||||||
|
|
||||||
|
#ifdef ORIGINAL_CODE
|
||||||
int bubbleX = cenX - 191;
|
int bubbleX = cenX - 191;
|
||||||
int bubbleY = height - 19;
|
int bubbleY = height - 19;
|
||||||
|
#else
|
||||||
#ifndef ORIGINAL_CODE
|
int bubbleX = cenX - 91;
|
||||||
bubbleX = cenX - 91;
|
int bubbleY = height - 41;
|
||||||
bubbleY = height - 41;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//@NOTE: Not sure this works as it should
|
//@NOTE: Not sure this works as it should
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ void OptionList::drawOnOffSwitch(int x, int y, bool state, bool disabled)
|
|||||||
|
|
||||||
void OptionList::renderItem(int index, int x, int y, int height, Tesselator& t)
|
void OptionList::renderItem(int index, int x, int y, int height, Tesselator& t)
|
||||||
{
|
{
|
||||||
Font* f = m_pMinecraft->m_pFont;
|
|
||||||
OptionItem* pItem = m_items[index];
|
OptionItem* pItem = m_items[index];
|
||||||
|
|
||||||
pItem->render(this, x, y);
|
pItem->render(this, x, y);
|
||||||
@@ -347,6 +346,8 @@ void OptionList::initDefaultMenu()
|
|||||||
|
|
||||||
#ifdef __EMSCRIPTEN
|
#ifdef __EMSCRIPTEN
|
||||||
m_items[idxLM]->setDisabled(true);
|
m_items[idxLM]->setDisabled(true);
|
||||||
|
#else
|
||||||
|
(void)idxLM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!GetPatchManager()->IsGrassSidesTinted())
|
if (!GetPatchManager()->IsGrassSidesTinted())
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ void ScrolledSelectionList::renderScrollBackground()
|
|||||||
|
|
||||||
void ScrolledSelectionList::checkInput(int mouseX, int mouseY)
|
void ScrolledSelectionList::checkInput(int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
int nItems = getNumberOfItems();
|
|
||||||
if (Mouse::isButtonDown(BUTTON_LEFT))
|
if (Mouse::isButtonDown(BUTTON_LEFT))
|
||||||
{
|
{
|
||||||
if (float(mouseY) >= field_C && float(mouseY) <= field_10 && abs(mouseY - field_28) > 5)
|
if (float(mouseY) >= field_C && float(mouseY) <= field_10 && abs(mouseY - field_28) > 5)
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ void TextInputBox::keyPressed(Minecraft* minecraft, int key)
|
|||||||
if (!m_bFocused)
|
if (!m_bFocused)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool bShiftPressed = minecraft->platform()->shiftPressed();
|
|
||||||
|
|
||||||
#ifndef HANDLE_CHARS_SEPARATELY
|
#ifndef HANDLE_CHARS_SEPARATELY
|
||||||
|
bool bShiftPressed = minecraft->platform()->shiftPressed();
|
||||||
|
|
||||||
char chr = '\0';
|
char chr = '\0';
|
||||||
if (key >= AKEYCODE_A && key <= AKEYCODE_Z)
|
if (key >= AKEYCODE_A && key <= AKEYCODE_Z)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void PauseScreen::init()
|
|||||||
m_btnOptions.m_yPos = currY;
|
m_btnOptions.m_yPos = currY;
|
||||||
m_btnOptions.m_xPos = m_btnBack.m_xPos;
|
m_btnOptions.m_xPos = m_btnBack.m_xPos;
|
||||||
#endif
|
#endif
|
||||||
currY += inc;
|
//currY += inc;
|
||||||
|
|
||||||
// add the buttons to the screen:
|
// add the buttons to the screen:
|
||||||
m_buttons.push_back(&m_btnBack);
|
m_buttons.push_back(&m_btnBack);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ UnifiedTurnBuild::UnifiedTurnBuild(int a, int width, int height, float d, float
|
|||||||
{
|
{
|
||||||
m_includeExcludeArea.field_4 = false;
|
m_includeExcludeArea.field_4 = false;
|
||||||
|
|
||||||
setScreenSize(width, height);
|
UnifiedTurnBuild::setScreenSize(width, height);
|
||||||
field_B8 = getTimeS();
|
field_B8 = getTimeS();
|
||||||
field_CC = field_B8;
|
field_CC = field_B8;
|
||||||
field_D0 = 0;
|
field_D0 = 0;
|
||||||
|
|||||||
@@ -764,10 +764,10 @@ bool LevelRenderer::updateDirtyChunks(Mob* pMob, bool b)
|
|||||||
ChunkVector* v40; // r0
|
ChunkVector* v40; // r0
|
||||||
Chunk* v42[3]; // [sp+1Ch] [bp+0h] BYREF
|
Chunk* v42[3]; // [sp+1Ch] [bp+0h] BYREF
|
||||||
Chunk* a3; // [sp+28h] [bp+Ch] BYREF
|
Chunk* a3; // [sp+28h] [bp+Ch] BYREF
|
||||||
Entity* pMob_1; // [sp+2Ch] [bp+10h] BYREF
|
//Entity* pMob_1; // [sp+2Ch] [bp+10h] BYREF
|
||||||
|
|
||||||
v3 = 0;
|
v3 = 0;
|
||||||
pMob_1 = pMob;
|
//pMob_1 = pMob;
|
||||||
DirtyChunkSorter dcs(pMob);
|
DirtyChunkSorter dcs(pMob);
|
||||||
memset(v42, 0, sizeof v42);
|
memset(v42, 0, sizeof v42);
|
||||||
field_88_Beg = this->field_88.begin();
|
field_88_Beg = this->field_88.begin();
|
||||||
|
|||||||
@@ -796,7 +796,7 @@ bool TileRenderer::tesselateWaterInWorld(Tile* tile1, int x, int y, int z)
|
|||||||
|
|
||||||
label_8:
|
label_8:
|
||||||
bFlag2 = bFlag1;
|
bFlag2 = bFlag1;
|
||||||
bool bRenderedSides = false;
|
//bool bRenderedSides = false;
|
||||||
|
|
||||||
for (int dir = 0; dir < 4; dir++)
|
for (int dir = 0; dir < 4; dir++)
|
||||||
{
|
{
|
||||||
@@ -868,7 +868,7 @@ label_8:
|
|||||||
texV_2 = C_RATIO * (float(texY) + (1.0f - height2) * 16.0f);
|
texV_2 = C_RATIO * (float(texY) + (1.0f - height2) * 16.0f);
|
||||||
texV_3 = C_RATIO * (float(texY + 16.0f) - 0.01f);
|
texV_3 = C_RATIO * (float(texY + 16.0f) - 0.01f);
|
||||||
bFlag2 = true;
|
bFlag2 = true;
|
||||||
bRenderedSides = true;
|
//bRenderedSides = true;
|
||||||
|
|
||||||
float brightMul = dir >= DIR_XNEG ? 0.6f : 0.8f;
|
float brightMul = dir >= DIR_XNEG ? 0.6f : 0.8f;
|
||||||
float bright = tile->getBrightness(m_pLevelSource, checkX, y, checkZ);
|
float bright = tile->getBrightness(m_pLevelSource, checkX, y, checkZ);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ EntityRenderDispatcher* EntityRenderDispatcher::getInstance()
|
|||||||
|
|
||||||
EntityRenderer* EntityRenderDispatcher::getRenderer(Entity* pEnt)
|
EntityRenderer* EntityRenderDispatcher::getRenderer(Entity* pEnt)
|
||||||
{
|
{
|
||||||
switch (pEnt->field_C8)
|
switch (pEnt->m_renderType)
|
||||||
{
|
{
|
||||||
case RENDER_TNT:
|
case RENDER_TNT:
|
||||||
return &m_TntRenderer;
|
return &m_TntRenderer;
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ TripodCameraRenderer::TripodCameraRenderer() :
|
|||||||
|
|
||||||
float TripodCameraRenderer::getFlashTime(TripodCamera* camera, float f)
|
float TripodCameraRenderer::getFlashTime(TripodCamera* camera, float f)
|
||||||
{
|
{
|
||||||
if (camera->field_B90 > 7 || camera->field_B90 < 0)
|
if (camera->m_iTimer > 7 || camera->m_iTimer < 0)
|
||||||
return -1.0f;
|
return -1.0f;
|
||||||
|
|
||||||
return 0.125f * (float(camera->field_B90) - f);
|
return 0.125f * (float(camera->m_iTimer) - f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TripodCameraRenderer::render(Entity* entity, float x, float y, float z, float a, float b)
|
void TripodCameraRenderer::render(Entity* entity, float x, float y, float z, float a, float b)
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& guid, LoginPacke
|
|||||||
sgp.m_version = 2;
|
sgp.m_version = 2;
|
||||||
sgp.m_time = m_pLevel->getTime();
|
sgp.m_time = m_pLevel->getTime();
|
||||||
|
|
||||||
RakNet::BitStream sgpbs;
|
RakNet::BitStream *sgpbs;
|
||||||
sgp.write(&sgpbs);
|
sgp.write(sgpbs);
|
||||||
m_pRakNetPeer->Send(&sgpbs, HIGH_PRIORITY, RELIABLE_ORDERED, 0, guid, false);
|
m_pRakNetPeer->Send(sgpbs, HIGH_PRIORITY, RELIABLE_ORDERED, 0, guid, false);
|
||||||
|
|
||||||
// send the connecting player info about all other players in the world
|
// send the connecting player info about all other players in the world
|
||||||
for (int i = 0; i < int(m_pLevel->m_players.size()); i++)
|
for (int i = 0; i < int(m_pLevel->m_players.size()); i++)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void LevelDataPacket::write(RakNet::BitStream* pbs)
|
|||||||
|
|
||||||
if (pCompressedData)
|
if (pCompressedData)
|
||||||
{
|
{
|
||||||
float ratio = 100.0f * float(compSize) / float(uncompSize);
|
//float ratio = 100.0f * float(compSize) / float(uncompSize);
|
||||||
//LOG_I("Compression ratio: %.2f (%d comp, %d uncomp)", ratio, int(compSize), int(uncompSize));
|
//LOG_I("Compression ratio: %.2f (%d comp, %d uncomp)", ratio, int(compSize), int(uncompSize));
|
||||||
|
|
||||||
int cs2 = int(compSize), us2 = int(uncompSize);
|
int cs2 = int(compSize), us2 = int(uncompSize);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void Entity::_init()
|
|||||||
field_B8 = 0;
|
field_B8 = 0;
|
||||||
field_BC = 300;
|
field_BC = 300;
|
||||||
field_C0 = 0;
|
field_C0 = 0;
|
||||||
field_C8 = 0; // @NOTE: Render type? (eEntityRenderType)
|
m_renderType = RENDER_NONE;
|
||||||
m_distanceFallen = 0.0f;
|
m_distanceFallen = 0.0f;
|
||||||
field_D0 = 300;
|
field_D0 = 300;
|
||||||
field_D4 = 0;
|
field_D4 = 0;
|
||||||
@@ -64,7 +64,7 @@ Entity::Entity(Level* pLevel)
|
|||||||
|
|
||||||
m_pLevel = pLevel;
|
m_pLevel = pLevel;
|
||||||
m_EntityID = ++entityCounter;
|
m_EntityID = ++entityCounter;
|
||||||
setPos(0, 0, 0);
|
Entity::setPos(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity::~Entity()
|
Entity::~Entity()
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public:
|
|||||||
int field_BC;
|
int field_BC;
|
||||||
int field_C0;
|
int field_C0;
|
||||||
int field_C4;
|
int field_C4;
|
||||||
int field_C8; // @NOTE: Render type? (eEntityRenderType)
|
int m_renderType;
|
||||||
float m_distanceFallen;
|
float m_distanceFallen;
|
||||||
int field_D0;
|
int field_D0;
|
||||||
uint8_t field_D4;
|
uint8_t field_D4;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ FallingTile::FallingTile(Level* level, float x, float y, float z, int id) : Enti
|
|||||||
m_vel.z = 0.0f;
|
m_vel.z = 0.0f;
|
||||||
|
|
||||||
#if defined(ENH_ALLOW_SAND_GRAVITY)
|
#if defined(ENH_ALLOW_SAND_GRAVITY)
|
||||||
field_C8 = RENDER_FALLING_TILE;
|
m_renderType = RENDER_FALLING_TILE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void ItemEntity::_init(ItemInstance* itemInstance, float x, float y, float z)
|
|||||||
{
|
{
|
||||||
_init(itemInstance);
|
_init(itemInstance);
|
||||||
|
|
||||||
field_C8 = RENDER_ITEM;
|
m_renderType = RENDER_ITEM;
|
||||||
setPos(x, y, z);
|
setPos(x, y, z);
|
||||||
|
|
||||||
m_yaw = 360.0f * Mth::random();
|
m_yaw = 360.0f * Mth::random();
|
||||||
@@ -149,6 +149,7 @@ void ItemEntity::checkInTile(float x, float y, float z)
|
|||||||
if (!solidYP && 1.0f - ydiff < mindist) mindist = 1.0f - ydiff, mindir = 3;
|
if (!solidYP && 1.0f - ydiff < mindist) mindist = 1.0f - ydiff, mindir = 3;
|
||||||
if (!solidZN && zdiff < mindist) mindist = zdiff, mindir = 4;
|
if (!solidZN && zdiff < mindist) mindist = zdiff, mindir = 4;
|
||||||
if (!solidZP && 1.0f - zdiff < mindist) mindist = 1.0f - zdiff, mindir = 5;
|
if (!solidZP && 1.0f - zdiff < mindist) mindist = 1.0f - zdiff, mindir = 5;
|
||||||
|
(void)mindist;
|
||||||
|
|
||||||
// the -1 case will be handled accordingly
|
// the -1 case will be handled accordingly
|
||||||
float force = 0.1f + 0.2f * sharedRandom.nextFloat();
|
float force = 0.1f + 0.2f * sharedRandom.nextFloat();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Player::Player(Level* pLevel) : Mob(pLevel)
|
|||||||
field_BC4 = 0;
|
field_BC4 = 0;
|
||||||
m_bHaveRespawnPos = false;
|
m_bHaveRespawnPos = false;
|
||||||
|
|
||||||
field_C8 = 2;
|
m_renderType = RENDER_HUMANOID;
|
||||||
|
|
||||||
m_pInventory = new Inventory(this);
|
m_pInventory = new Inventory(this);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
void PrimedTnt::_init()
|
void PrimedTnt::_init()
|
||||||
{
|
{
|
||||||
m_fuseTimer = 0;
|
m_fuseTimer = 0;
|
||||||
field_C8 = RENDER_TNT;
|
m_renderType = RENDER_TNT;
|
||||||
field_34 = 1;
|
field_34 = 1;
|
||||||
setSize(0.98f, 0.98f);
|
setSize(0.98f, 0.98f);
|
||||||
field_84 = field_8C * 0.5f;
|
field_84 = field_8C * 0.5f;
|
||||||
|
|||||||
@@ -12,12 +12,11 @@
|
|||||||
|
|
||||||
TripodCamera::TripodCamera(Level* level, Player* player, float x, float y, float z) : Mob(level)
|
TripodCamera::TripodCamera(Level* level, Player* player, float x, float y, float z) : Mob(level)
|
||||||
{
|
{
|
||||||
field_B8C = 0;
|
m_iTimer = 80;
|
||||||
field_B90 = 80;
|
|
||||||
m_bActive = false;
|
m_bActive = false;
|
||||||
|
|
||||||
m_owner = player;
|
m_owner = player;
|
||||||
field_C8 = RENDER_CAMERA;
|
m_renderType = RENDER_CAMERA;
|
||||||
|
|
||||||
field_60 = m_pitch = player->m_pitch;
|
field_60 = m_pitch = player->m_pitch;
|
||||||
field_5C = m_yaw = player->m_yaw;
|
field_5C = m_yaw = player->m_yaw;
|
||||||
@@ -83,14 +82,14 @@ void TripodCamera::tick()
|
|||||||
if (!m_bActive)
|
if (!m_bActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
field_B90--;
|
m_iTimer--;
|
||||||
if (field_B90 == 0)
|
if (m_iTimer == 0)
|
||||||
{
|
{
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field_B90 == 8)
|
if (m_iTimer == 8)
|
||||||
{
|
{
|
||||||
m_pLevel->takePicture(this, m_owner);
|
m_pLevel->takePicture(this, m_owner);
|
||||||
m_pLevel->addParticle("explode", m_pos.x, m_pos.y + 0.6f, m_pos.z, 0.0f, 0.0f, 0.0f);
|
m_pLevel->addParticle("explode", m_pos.x, m_pos.y + 0.6f, m_pos.z, 0.0f, 0.0f, 0.0f);
|
||||||
@@ -99,7 +98,7 @@ void TripodCamera::tick()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field_B90 > 8)
|
if (m_iTimer > 8)
|
||||||
{
|
{
|
||||||
m_pLevel->addParticle("smoke", m_pos.x, m_pos.y + 1.0f, m_pos.z, 0.0f, 0.0f, 0.0f);
|
m_pLevel->addParticle("smoke", m_pos.x, m_pos.y + 1.0f, m_pos.z, 0.0f, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ public:
|
|||||||
void tick() override;
|
void tick() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int field_B8C;
|
int m_iTimer;
|
||||||
int field_B90;
|
|
||||||
Player* m_owner;
|
Player* m_owner;
|
||||||
bool m_bActive;
|
bool m_bActive;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1706,6 +1706,7 @@ float Level::getSeenPercent(Vec3 vec, AABB aabb)
|
|||||||
float aabbSizeZ = aabb.max.z - aabb.min.z;
|
float aabbSizeZ = aabb.max.z - aabb.min.z;
|
||||||
|
|
||||||
// This shoots a bunch of rays from a point and checks if the rays hit something. Stuupiiiddd
|
// This shoots a bunch of rays from a point and checks if the rays hit something. Stuupiiiddd
|
||||||
|
// FIXME(Er2): clang-analyzer-security.FloatLoopCounter
|
||||||
for (float xi = 0.0f; xi <= 1.0f; xi += 1.0f / (1.0f + 2 * aabbSizeX))
|
for (float xi = 0.0f; xi <= 1.0f; xi += 1.0f / (1.0f + 2 * aabbSizeX))
|
||||||
{
|
{
|
||||||
for (float yi = 0.0f; yi <= 1.0f; yi += 1.0f / (1.0f + 2 * aabbSizeY))
|
for (float yi = 0.0f; yi <= 1.0f; yi += 1.0f / (1.0f + 2 * aabbSizeY))
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ LevelChunk* ChunkCache::getChunk(int x, int z)
|
|||||||
if (m_pChunkSource)
|
if (m_pChunkSource)
|
||||||
pChunk = m_pChunkSource->getChunk(x, z);
|
pChunk = m_pChunkSource->getChunk(x, z);
|
||||||
|
|
||||||
|
if (!pChunk)
|
||||||
|
return nullptr;
|
||||||
m_chunkMap[z][x] = pChunk;
|
m_chunkMap[z][x] = pChunk;
|
||||||
pChunk->lightLava();
|
pChunk->lightLava();
|
||||||
}
|
}
|
||||||
@@ -92,6 +94,8 @@ LevelChunk* ChunkCache::getChunk(int x, int z)
|
|||||||
pChunk = m_chunkMap[z][x];
|
pChunk = m_chunkMap[z][x];
|
||||||
if (pChunk)
|
if (pChunk)
|
||||||
pChunk->load();
|
pChunk->load();
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
if (!pChunk->field_234 && hasChunk(x + 1, z + 1) && hasChunk(x, z + 1) && hasChunk(x + 1, z))
|
if (!pChunk->field_234 && hasChunk(x + 1, z + 1) && hasChunk(x, z + 1) && hasChunk(x + 1, z))
|
||||||
postProcess(this, x, z);
|
postProcess(this, x, z);
|
||||||
|
|||||||
@@ -74,19 +74,19 @@ bool BirchFeature::place(Level* level, Random* random, int x, int y, int z)
|
|||||||
for (int i = lowerY; i <= upperY; i++, diff = i - upperY)
|
for (int i = lowerY; i <= upperY; i++, diff = i - upperY)
|
||||||
{
|
{
|
||||||
int c1 = 1 - diff / 2;
|
int c1 = 1 - diff / 2;
|
||||||
int c2 = diff / 2 - 1;
|
//int c2 = diff / 2 - 1;
|
||||||
for (int ax = x - c1; ax <= x + c1; ax++)
|
for (int ax = x - c1; ax <= x + c1; ax++)
|
||||||
{
|
{
|
||||||
int c3 = c2;
|
//int c3 = c2;
|
||||||
int c4 = diff / 2 - 1;
|
int c4 = diff / 2 - 1;
|
||||||
if (c2 < 0)
|
//if (c2 < 0)
|
||||||
c3 = -c2;
|
// c3 = -c2;
|
||||||
|
|
||||||
//int c5 = c3;
|
//int c5 = c3;
|
||||||
|
|
||||||
for (int az = z - c1; az <= z + c1; az++, c4++)
|
for (int az = z - c1; az <= z + c1; az++, c4++)
|
||||||
{
|
{
|
||||||
if ((abs(ax - x) != c1 || abs(az - z) != c1 || (random->nextInt(2) != 0 && diff != 0)) && !Tile::solid[level->getTile(ax, i, az)])
|
if ((abs(ax - x) != c1 || abs(az - z) != c1 || (random->nextInt(2) != 0 && diff != 0)) && !Tile::solid[level->getTile(ax, i, az)])
|
||||||
{
|
{
|
||||||
level->setTileAndDataNoUpdate(ax, i, az, Tile::leaves->m_ID, 2);
|
level->setTileAndDataNoUpdate(ax, i, az, Tile::leaves->m_ID, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,19 +74,19 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z)
|
|||||||
for (int i = lowerY; i <= upperY; i++, diff = i - upperY)
|
for (int i = lowerY; i <= upperY; i++, diff = i - upperY)
|
||||||
{
|
{
|
||||||
int c1 = 1 - diff / 2;
|
int c1 = 1 - diff / 2;
|
||||||
int c2 = diff / 2 - 1;
|
//int c2 = diff / 2 - 1;
|
||||||
for (int ax = x - c1; ax <= x + c1; ax++)
|
for (int ax = x - c1; ax <= x + c1; ax++)
|
||||||
{
|
{
|
||||||
int c3 = c2;
|
//int c3 = c2;
|
||||||
int c4 = diff / 2 - 1;
|
int c4 = diff / 2 - 1;
|
||||||
if (c2 < 0)
|
//if (c2 < 0)
|
||||||
c3 = -c2;
|
// c3 = -c2;
|
||||||
|
|
||||||
//int c5 = c3;
|
//int c5 = c3;
|
||||||
|
|
||||||
for (int az = z - c1; az <= z + c1; az++, c4++)
|
for (int az = z - c1; az <= z + c1; az++, c4++)
|
||||||
{
|
{
|
||||||
if ((abs(ax - x) != c1 || abs(az - z) != c1 || (random->nextInt(2) != 0 && diff != 0)) && !Tile::solid[level->getTile(ax, i, az)])
|
if ((abs(ax - x) != c1 || abs(az - z) != c1 || (random->nextInt(2) != 0 && diff != 0)) && !Tile::solid[level->getTile(ax, i, az)])
|
||||||
{
|
{
|
||||||
level->setTileNoUpdate(ax, i, az, Tile::leaves->m_ID);
|
level->setTileNoUpdate(ax, i, az, Tile::leaves->m_ID);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ ExternalFileLevelStorageSource::ExternalFileLevelStorageSource(const std::string
|
|||||||
if (createFolderIfNotExists(m_worldsPath.c_str()))
|
if (createFolderIfNotExists(m_worldsPath.c_str()))
|
||||||
{
|
{
|
||||||
std::vector<LevelSummary> vls;
|
std::vector<LevelSummary> vls;
|
||||||
getLevelList(vls);
|
ExternalFileLevelStorageSource::getLevelList(vls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ClothTile::ClothTile(int id, int type) : Tile(id, TEXTURE_CLOTH_64, Material::cl
|
|||||||
{
|
{
|
||||||
field_6C = type;
|
field_6C = type;
|
||||||
|
|
||||||
m_TextureFrame = getTexture(0, type);
|
m_TextureFrame = ClothTile::getTexture(0, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClothTile::getTexture(int dir)
|
int ClothTile::getTexture(int dir)
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ bool Sapling::maybeGrowTree(Level* level, int x, int y, int z, Random* random)
|
|||||||
BirchFeature birchFeature;
|
BirchFeature birchFeature;
|
||||||
SpruceFeature spruceFeature;
|
SpruceFeature spruceFeature;
|
||||||
|
|
||||||
|
/*
|
||||||
Feature* pFeature = &treeFeature;
|
Feature* pFeature = &treeFeature;
|
||||||
|
|
||||||
int data = level->getData(x, y, z);
|
int data = level->getData(x, y, z);
|
||||||
@@ -52,6 +53,7 @@ bool Sapling::maybeGrowTree(Level* level, int x, int y, int z, Random* random)
|
|||||||
pFeature = &spruceFeature;
|
pFeature = &spruceFeature;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return treeFeature.place(level, random, x, y, z);
|
return treeFeature.place(level, random, x, y, z);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user