mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-04 19:36:43 +03:00
* WIP C++03 + Xbox 360 Support * math.h & _USE_MATH_DEFINES on Level.hpp Updated Xenon vcxproj file for new file structure. * * Fix bad GUI scale setup. * * Gui: Use ratios instead of hardcoded sub-1 floating point values, to make the mechanism more clear. * Add Direct Connect Button and Screen (#30) * Add Direct Connect Button and Screen * Remove accidental extra build directories for wasm * Add DirectConnectScreen.cpp to the CMake * Use Hungarian coding style notation * * Fix errors caused by #30 * * Improve the Chat Screen * * Improve the DirectConnectScreen, among other things. * * Update the game title once again. * * Add build-wasm.bat. * * Add info about compiling for wasm * * Fix send to specific GUID actually broadcasting to everyone * * Add command manager. * * Add writeable configuration. * * Allow dynamic screen size change on windows * * Allow the same thing on the emscripten version. * WIP C++03 + Xbox 360 Support * Fixed a possible merging issue that broke RakNet? * Additional Xbox 360 compatability fixes --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com> Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com> Co-authored-by: ts <124226059+uniformization@users.noreply.github.com>
97 lines
1.9 KiB
C++
97 lines
1.9 KiB
C++
/********************************************************************
|
|
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 "DynamicTexture.hpp"
|
|
#include "world/tile/Tile.hpp"
|
|
|
|
WaterSideTexture::WaterSideTexture() : DynamicTexture(Tile::water->m_TextureFrame + 1)
|
|
{
|
|
field_40C = 0;
|
|
field_410 = 0;
|
|
field_414 = 0;
|
|
|
|
m_data1 = new float[0x400];
|
|
m_data2 = new float[0x400];
|
|
m_data3 = new float[0x400];
|
|
m_data4 = new float[0x400];
|
|
m_textureSize = 2;
|
|
|
|
for (int i = 0; i < 256; i++)
|
|
{
|
|
m_data1[i] = 0.0f;
|
|
m_data2[i] = 0.0f;
|
|
m_data3[i] = 0.0f;
|
|
m_data4[i] = 0.0f;
|
|
}
|
|
}
|
|
|
|
WaterSideTexture::~WaterSideTexture()
|
|
{
|
|
SAFE_DELETE(m_data1);
|
|
SAFE_DELETE(m_data2);
|
|
SAFE_DELETE(m_data3);
|
|
SAFE_DELETE(m_data4);
|
|
}
|
|
|
|
void WaterSideTexture::tick()
|
|
{
|
|
field_414++;
|
|
|
|
for (int x = 0; x < 16; x++)
|
|
{
|
|
for (int y = 0; y < 16; y++)
|
|
{
|
|
float f = 0.0f;
|
|
for (int i = y - 2; i <= y; i++)
|
|
f += m_data1[16 * (i & 0xF) + (x & 0xF)];
|
|
|
|
m_data2[16 * y + x] = f / 3.2f + m_data3[16 * y + x] * 0.8f;
|
|
}
|
|
}
|
|
|
|
for (int x = 0; x < 16; x++)
|
|
{
|
|
for (int y = 0; y < 16; y++)
|
|
{
|
|
m_data3[16 * y + x] += m_data4[16 * y + x] * 0.05f;
|
|
|
|
if (m_data3[16 * y + x] < 0)
|
|
m_data3[16 * y + x] = 0;
|
|
|
|
m_data4[16 * y + x] -= 0.3f;
|
|
if (Mth::random() < 0.2f)
|
|
m_data4[16 * y + x] = 0.5f;
|
|
}
|
|
}
|
|
|
|
std::swap(m_data1, m_data2);
|
|
|
|
for (int i = 0; i < 256; i++)
|
|
{
|
|
float m = m_data1[(i - 16 * field_414) & 0xFF];
|
|
if (m < 0.0f)
|
|
m = 0.0f;
|
|
if (m > 1.0f)
|
|
m = 1.0f;
|
|
|
|
m = m * m;
|
|
|
|
int r, g, b, a;
|
|
|
|
r = int(32.0f + 32.0f * m);
|
|
g = int(64.0f + 50.0f * m);
|
|
a = int(146.0f + 50.0f * m);
|
|
b = 255;
|
|
|
|
m_pixels[i * 4 + 0] = uint8_t(r);
|
|
m_pixels[i * 4 + 1] = uint8_t(g);
|
|
m_pixels[i * 4 + 2] = uint8_t(b);
|
|
m_pixels[i * 4 + 3] = uint8_t(a);
|
|
}
|
|
}
|