Implemented xoft's suggestions
I totally didn't copy this from the fire simulator... (I did, but I changed it quite a bit :P)
This commit is contained in:
parent
277b26b4c2
commit
a1d5d25525
@ -518,12 +518,29 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
|
||||
else
|
||||
{
|
||||
// Push out entity.
|
||||
BLOCKTYPE GotBlock;
|
||||
|
||||
if (NextChunk->GetBlock( RelBlockX + 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += 0.2; }
|
||||
else if (NextChunk->GetBlock( RelBlockX - 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += -0.2; }
|
||||
else if (NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ + 1 ) == E_BLOCK_AIR) { NextPos.z += 0.2; }
|
||||
else if (NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ - 1 ) == E_BLOCK_AIR) { NextPos.z += -0.2; }
|
||||
else { NextPos.y += 0.2; }
|
||||
static const struct
|
||||
{
|
||||
int x, y, z;
|
||||
} gCrossCoords[] =
|
||||
{
|
||||
{ 1, 0, 0},
|
||||
{-1, 0, 0},
|
||||
{ 0, 0, 1},
|
||||
{ 0, 0, -1},
|
||||
} ;
|
||||
|
||||
for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
|
||||
{
|
||||
NextChunk->UnboundedRelGetBlockType(RelBlockX + gCrossCoords[i].x, BlockY, RelBlockZ + gCrossCoords[i].z, GotBlock);
|
||||
if (GotBlock == E_BLOCK_AIR)
|
||||
{
|
||||
NextPos.x += gCrossCoords[i].x;
|
||||
NextPos.z += gCrossCoords[i].z;
|
||||
}
|
||||
else { NextPos.y += 0.2; }
|
||||
} // for i - gCrossCoords[]
|
||||
|
||||
m_bOnGround = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user