Removed my hackish Light functions
This commit is contained in:
parent
228ccc5c6a
commit
f558f3c6d2
@ -1356,102 +1356,6 @@ void cChunk::UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ)
|
||||
|
||||
|
||||
|
||||
NIBBLETYPE cChunk::UnboundedRelGetSkyLight(int a_RelX, int a_RelY, int a_RelZ)
|
||||
{
|
||||
if ((a_RelY < 0) || (a_RelY > cChunkDef::Height))
|
||||
{
|
||||
LOGWARNING("UnboundedRelGetSkyLight(): requesting a block with a_RelY out of range: %d", a_RelY);
|
||||
return 127;
|
||||
}
|
||||
|
||||
// Is it in this chunk?
|
||||
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return 127;
|
||||
}
|
||||
return GetSkyLight(a_RelX, a_RelY, a_RelZ);
|
||||
}
|
||||
|
||||
// Not in this chunk, try walking the neighbors first:
|
||||
if ((a_RelX < 0) && (m_NeighborXM != NULL))
|
||||
{
|
||||
return m_NeighborXM->UnboundedRelGetSkyLight(a_RelX + cChunkDef::Width, a_RelY, a_RelZ);
|
||||
}
|
||||
if ((a_RelX >= cChunkDef::Width) && (m_NeighborXP != NULL))
|
||||
{
|
||||
return m_NeighborXP->UnboundedRelGetSkyLight(a_RelX - cChunkDef::Width, a_RelY, a_RelZ);
|
||||
}
|
||||
if ((a_RelZ < 0) && (m_NeighborZM != NULL))
|
||||
{
|
||||
return m_NeighborZM->UnboundedRelGetSkyLight(a_RelX, a_RelY, a_RelZ + cChunkDef::Width);
|
||||
}
|
||||
if ((a_RelZ >= cChunkDef::Width) && (m_NeighborZP != NULL))
|
||||
{
|
||||
return m_NeighborZP->UnboundedRelGetSkyLight(a_RelX, a_RelY, a_RelZ - cChunkDef::Width);
|
||||
}
|
||||
|
||||
// Neighbors not available, use the chunkmap to locate the chunk:
|
||||
return m_ChunkMap->GetBlockSkyLight(
|
||||
m_PosX * cChunkDef::Width + a_RelX,
|
||||
ZERO_CHUNK_Y * cChunkDef::Height + a_RelY,
|
||||
m_PosZ * cChunkDef::Width + a_RelZ
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NIBBLETYPE cChunk::UnboundedRelGetBlockLight(int a_RelX, int a_RelY, int a_RelZ)
|
||||
{
|
||||
if ((a_RelY < 0) || (a_RelY > cChunkDef::Height))
|
||||
{
|
||||
LOGWARNING("UnboundedRelGetBlockLight(): requesting a block with a_RelY out of range: %d", a_RelY);
|
||||
return 127;
|
||||
}
|
||||
|
||||
// Is it in this chunk?
|
||||
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return 127;
|
||||
}
|
||||
return GetBlockLight(a_RelX, a_RelY, a_RelZ);
|
||||
}
|
||||
|
||||
// Not in this chunk, try walking the neighbors first:
|
||||
if ((a_RelX < 0) && (m_NeighborXM != NULL))
|
||||
{
|
||||
return m_NeighborXM->UnboundedRelGetBlockLight(a_RelX + cChunkDef::Width, a_RelY, a_RelZ);
|
||||
}
|
||||
if ((a_RelX >= cChunkDef::Width) && (m_NeighborXP != NULL))
|
||||
{
|
||||
return m_NeighborXP->UnboundedRelGetBlockLight(a_RelX - cChunkDef::Width, a_RelY, a_RelZ);
|
||||
}
|
||||
if ((a_RelZ < 0) && (m_NeighborZM != NULL))
|
||||
{
|
||||
return m_NeighborZM->UnboundedRelGetBlockLight(a_RelX, a_RelY, a_RelZ + cChunkDef::Width);
|
||||
}
|
||||
if ((a_RelZ >= cChunkDef::Width) && (m_NeighborZP != NULL))
|
||||
{
|
||||
return m_NeighborZP->UnboundedRelGetBlockLight(a_RelX, a_RelY, a_RelZ - cChunkDef::Width);
|
||||
}
|
||||
|
||||
// Neighbors not available, use the chunkmap to locate the chunk:
|
||||
return m_ChunkMap->GetBlockBlockLight(
|
||||
m_PosX * cChunkDef::Width + a_RelX,
|
||||
ZERO_CHUNK_Y * cChunkDef::Height + a_RelY,
|
||||
m_PosZ * cChunkDef::Width + a_RelZ
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int cChunk::GetHeight( int a_X, int a_Z )
|
||||
{
|
||||
ASSERT((a_X >= 0) && (a_X < Width) && (a_Z >= 0) && (a_Z < Width));
|
||||
|
@ -317,8 +317,6 @@ public:
|
||||
/// Same as QueueTickBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s in such a case), ignores unsuccessful attempts
|
||||
void UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ);
|
||||
|
||||
NIBBLETYPE UnboundedRelGetBlockLight(int a_RelX, int a_RelY, int a_RelZ);
|
||||
NIBBLETYPE UnboundedRelGetSkyLight(int a_RelX, int a_RelY, int a_RelZ);
|
||||
|
||||
// Simulator data:
|
||||
cFireSimulatorChunkData & GetFireSimulatorData (void) { return m_FireSimulatorData; }
|
||||
|
Loading…
Reference in New Issue
Block a user