1
0

Implemented xoft's suggestions again

This commit is contained in:
Tiger Wang 2013-09-12 10:25:13 +01:00
parent a1d5d25525
commit 8163ca9549

View File

@ -1,4 +1,3 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Entity.h" #include "Entity.h"
@ -520,27 +519,25 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
// Push out entity. // Push out entity.
BLOCKTYPE GotBlock; BLOCKTYPE GotBlock;
static const struct static const Vector3i CrossCoords[] =
{ {
int x, y, z; Vector3i(1, 0, 0),
} gCrossCoords[] = Vector3i(-1, 0, 0),
{ Vector3i(0, 0, 1),
{ 1, 0, 0}, Vector3i(0, 0, -1),
{-1, 0, 0},
{ 0, 0, 1},
{ 0, 0, -1},
} ; } ;
Vector3i PushDirection(0, 1, 0);
for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
for (int i = 0; i < ARRAYCOUNT(CrossCoords); i++)
{ {
NextChunk->UnboundedRelGetBlockType(RelBlockX + gCrossCoords[i].x, BlockY, RelBlockZ + gCrossCoords[i].z, GotBlock); NextChunk->UnboundedRelGetBlockType(RelBlockX + CrossCoords[i].x, BlockY, RelBlockZ + CrossCoords[i].z, GotBlock);
if (GotBlock == E_BLOCK_AIR) if (!g_BlockIsSolid[GotBlock])
{ {
NextPos.x += gCrossCoords[i].x; PushDirection = CrossCoords[i];
NextPos.z += gCrossCoords[i].z; break;
} }
else { NextPos.y += 0.2; } } // for i - CrossCoords[]
} // for i - gCrossCoords[] NextPos += Vector3d(PushDirection) * 0.2;
m_bOnGround = true; m_bOnGround = true;