2012-02-16 13:42:35 +00:00
|
|
|
|
2011-12-31 21:08:23 +00:00
|
|
|
#ifndef __C_CHUNK_INL_H__
|
|
|
|
|
#define __C_CHUNK_INL_H__
|
|
|
|
|
|
|
|
|
|
#ifndef MAX
|
|
|
|
|
# define MAX(a,b) (((a)>(b))?(a):(b))
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-02-16 13:42:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-31 21:08:23 +00:00
|
|
|
__C_CHUNK_INLINE__
|
2012-03-14 20:56:09 +00:00
|
|
|
void cChunk::SpreadLightOfBlock(BLOCKTYPE * a_LightBuffer, int a_X, int a_Y, int a_Z, BLOCKTYPE a_Falloff)
|
2011-12-31 21:08:23 +00:00
|
|
|
{
|
2012-03-14 20:56:09 +00:00
|
|
|
unsigned char CurrentLight = cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z );
|
|
|
|
|
cChunkDef::SetNibble( a_LightBuffer, a_X-1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X-1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
|
|
|
|
cChunkDef::SetNibble( a_LightBuffer, a_X+1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X+1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
|
|
|
|
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y-1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y-1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
|
|
|
|
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y+1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y+1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
|
|
|
|
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z-1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z-1 ), MAX(0,CurrentLight-a_Falloff) ) );
|
|
|
|
|
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z+1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z+1 ), MAX(0,CurrentLight-a_Falloff) ) );
|
2012-03-05 16:41:57 +00:00
|
|
|
MarkDirty();
|
2011-12-31 21:08:23 +00:00
|
|
|
}
|
|
|
|
|
|
2012-02-16 13:42:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-13 20:26:36 +00:00
|
|
|
#endif
|
2012-02-16 13:42:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|