fixes and fixes

This commit is contained in:
UnknownShadow200 2018-04-23 11:47:30 +10:00
parent 1e0f7df47f
commit c252baa696
5 changed files with 10 additions and 6 deletions

View File

@ -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, &centre, &Block_MinBB[block]);
Vector3_Add(&maxRaw, &centre, &Block_MaxBB[block]);
Vector3_Add(&Block_MinBB[block], &minRaw, &centre);
Vector3_Add(&Block_MaxBB[block], &maxRaw, &centre);
Block_CalcRenderBounds(block);
}

View File

@ -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;
}

View File

@ -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();

View File

@ -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) {

View File

@ -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);