mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 15:45:31 +00:00
Avoid left shift of negative value
This commit is contained in:
parent
6a3ff5ed81
commit
df459199dd
1 changed files with 3 additions and 3 deletions
|
@ -125,7 +125,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
for (int cellX=0; cellX<mCellSize; ++cellX)
|
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 vertexY = static_cast<int>(float(cellY) / float(mCellSize) * 9);
|
||||||
|
|
||||||
int texelX = (x-mMinX) * mCellSize + cellX;
|
int texelX = (x-mMinX) * mCellSize + cellX;
|
||||||
|
@ -135,9 +135,9 @@ namespace MWRender
|
||||||
|
|
||||||
float y2 = 0;
|
float y2 = 0;
|
||||||
if (land && (land->mDataTypes & ESM::Land::DATA_WNAM))
|
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
|
else
|
||||||
y2 = (SCHAR_MIN << 4) / 2048.f;
|
y2 = SCHAR_MIN / 128.f;
|
||||||
if (y2 < 0)
|
if (y2 < 0)
|
||||||
{
|
{
|
||||||
r = static_cast<unsigned char>(14 * y2 + 38);
|
r = static_cast<unsigned char>(14 * y2 + 38);
|
||||||
|
|
Loading…
Reference in a new issue