diff --git a/src/Client/Block.c b/src/Client/Block.c index 5bac98a3b..079292365 100644 --- a/src/Client/Block.c +++ b/src/Client/Block.c @@ -315,12 +315,12 @@ void Block_RecalculateBB(BlockID block) { Real32 leftX = Block_GetSpriteBB_LeftX(elemSize, texX, texY, bmp); Real32 rightX = Block_GetSpriteBB_RightX(elemSize, texX, texY, bmp); - Vector3 centre = Vector3_Create3(0.5f, 0, 0.5f); + Vector3 centre = VECTOR3_CONST(0.5f, 0.0f, 0.5f); Vector3 minRaw = Vector3_RotateY3(leftX - 0.5f, bottomY, 0, 45.0f * MATH_DEG2RAD); Vector3 maxRaw = Vector3_RotateY3(rightX - 0.5f, topY, 0, 45.0f * MATH_DEG2RAD); - Vector3_Add(&minRaw, ¢re, &Block_MinBB[block]); - Vector3_Add(&maxRaw, ¢re, &Block_MaxBB[block]); + Vector3_Add(&Block_MinBB[block], &minRaw, ¢re); + Vector3_Add(&Block_MaxBB[block], &maxRaw, ¢re); Block_CalcRenderBounds(block); } diff --git a/src/Client/D3D9Api.c b/src/Client/D3D9Api.c index f4fcd65f1..8175fe364 100644 --- a/src/Client/D3D9Api.c +++ b/src/Client/D3D9Api.c @@ -193,7 +193,7 @@ void D3D9_SetTexturePartData(IDirect3DTexture9* texture, Int32 x, Int32 y, Bitma UInt32 stride = (UInt32)(bmp->Width) * BITMAP_SIZEOF_PIXEL; for (yy = 0; yy < bmp->Height; yy++) { - Platform_MemCpy(src, dst, stride); + Platform_MemCpy(dst, src, stride); src += stride; dst += rect.Pitch; } diff --git a/src/Client/Game.c b/src/Client/Game.c index 7d4557d4f..5f3e04a83 100644 --- a/src/Client/Game.c +++ b/src/Client/Game.c @@ -283,6 +283,8 @@ Int32 Game_CalcRenderType(STRING_PURE String* type) { void Game_OnResize(void* obj) { Size2D size = Window_GetClientSize(); Game_Width = size.Width; Game_Height = size.Height; + if (Game_Width == 0) Game_Width = 1; + if (Game_Height == 0) Game_Height = 1; Gfx_OnWindowResize(); Game_UpdateProjection(); diff --git a/src/Client/Stream.c b/src/Client/Stream.c index 0cc0cd708..8b6f95fbe 100644 --- a/src/Client/Stream.c +++ b/src/Client/Stream.c @@ -271,15 +271,18 @@ bool Stream_ReadUtf8Char(Stream* stream, UInt16* codepoint) { bool Stream_ReadLine(Stream* stream, STRING_TRANSIENT String* text) { String_Clear(text); + bool readAny = false; for (;;) { UInt16 codepoint; - if (!Stream_ReadUtf8Char(stream, &codepoint)) return false; + if (!Stream_ReadUtf8Char(stream, &codepoint)) break; + readAny = true; /* Handle \r\n or \n line endings */ if (codepoint == '\r') continue; if (codepoint == '\n') return true; String_Append(text, Convert_UnicodeToCP437(codepoint)); } + return readAny; } void Stream_WriteLine(Stream* stream, STRING_TRANSIENT String* text) { diff --git a/src/Client/Vectors.h b/src/Client/Vectors.h index 9c5c9315d..6e692bd97 100644 --- a/src/Client/Vectors.h +++ b/src/Client/Vectors.h @@ -70,7 +70,6 @@ Vector3 Vector3_GetDirVector(Real32 yawRad, Real32 pitchRad); NOTE: This is not an identity function. Returned pitch is always within [-90, 90] degrees.*/ void Vector3_GetHeading(Vector3 dir, Real32* yawRad, Real32* pitchRad); - void Matrix_RotateX(Matrix* result, Real32 angle); void Matrix_RotateY(Matrix* result, Real32 angle); void Matrix_RotateZ(Matrix* result, Real32 angle);