Avoid left shift of negative value

0.6.3
Andrei Kortunov 7 years ago
parent 6a3ff5ed81
commit df459199dd

@ -125,7 +125,7 @@ namespace MWRender
{
for (int cellX=0; cellX<mCellSize; ++cellX)
{
int vertexX = static_cast<int>(float(cellX)/float(mCellSize) * 9);
int vertexX = static_cast<int>(float(cellX) / float(mCellSize) * 9);
int vertexY = static_cast<int>(float(cellY) / float(mCellSize) * 9);
int texelX = (x-mMinX) * mCellSize + cellX;
@ -135,9 +135,9 @@ namespace MWRender
float y2 = 0;
if (land && (land->mDataTypes & ESM::Land::DATA_WNAM))
y2 = (land->mWnam[vertexY * 9 + vertexX] << 4) / 2048.f;
y2 = land->mWnam[vertexY * 9 + vertexX] / 128.f;
else
y2 = (SCHAR_MIN << 4) / 2048.f;
y2 = SCHAR_MIN / 128.f;
if (y2 < 0)
{
r = static_cast<unsigned char>(14 * y2 + 38);

Loading…
Cancel
Save