BlockArea: Implemented rotation without meta manipulation
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1317 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
e0707a7af6
commit
7ac3131984
@ -93,6 +93,18 @@ function Initialize(Plugin)
|
||||
BA1:SaveToSchematicFile("schematics/lt_YZ2.schematic");
|
||||
end
|
||||
|
||||
-- Debug block area rotation:
|
||||
if (BA1:LoadFromSchematicFile("schematics/rot.schematic")) then
|
||||
BA1:RotateCWNoMeta();
|
||||
BA1:SaveToSchematicFile("schematics/rot1.schematic");
|
||||
BA1:RotateCWNoMeta();
|
||||
BA1:SaveToSchematicFile("schematics/rot2.schematic");
|
||||
BA1:RotateCWNoMeta();
|
||||
BA1:SaveToSchematicFile("schematics/rot3.schematic");
|
||||
BA1:RotateCWNoMeta();
|
||||
BA1:SaveToSchematicFile("schematics/rot4.schematic");
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -969,20 +969,90 @@ void cBlockArea::MirrorYZ(void)
|
||||
|
||||
|
||||
|
||||
void cBlockArea::RotateCWNoMeta(void)
|
||||
void cBlockArea::RotateCCWNoMeta(void)
|
||||
{
|
||||
ASSERT(!"Not implemented yet");
|
||||
// TODO
|
||||
if (HasBlockTypes())
|
||||
{
|
||||
BLOCKTYPE * NewTypes = new BLOCKTYPE[m_SizeX * m_SizeY * m_SizeZ];
|
||||
for (int x = 0; x < m_SizeX; x++)
|
||||
{
|
||||
int NewZ = m_SizeX - x - 1;
|
||||
for (int z = 0; z < m_SizeZ; z++)
|
||||
{
|
||||
int NewX = z;
|
||||
for (int y = 0; y < m_SizeY; y++)
|
||||
{
|
||||
NewTypes[NewX + NewZ * m_SizeX + y * m_SizeX * m_SizeZ] = m_BlockTypes[MakeIndex(x, y, z)];
|
||||
} // for y
|
||||
} // for z
|
||||
} // for x
|
||||
std::swap(m_BlockTypes, NewTypes);
|
||||
delete[] NewTypes;
|
||||
}
|
||||
if (HasBlockTypes())
|
||||
{
|
||||
NIBBLETYPE * NewMetas = new NIBBLETYPE[m_SizeX * m_SizeY * m_SizeZ];
|
||||
for (int x = 0; x < m_SizeX; x++)
|
||||
{
|
||||
int NewZ = m_SizeX - x - 1;
|
||||
for (int z = 0; z < m_SizeZ; z++)
|
||||
{
|
||||
int NewX = z;
|
||||
for (int y = 0; y < m_SizeY; y++)
|
||||
{
|
||||
NewMetas[NewX + NewZ * m_SizeX + y * m_SizeX * m_SizeZ] = m_BlockMetas[MakeIndex(x, y, z)];
|
||||
} // for y
|
||||
} // for z
|
||||
} // for x
|
||||
std::swap(m_BlockMetas, NewMetas);
|
||||
delete[] NewMetas;
|
||||
}
|
||||
std::swap(m_SizeX, m_SizeZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cBlockArea::RotateCCWNoMeta(void)
|
||||
void cBlockArea::RotateCWNoMeta(void)
|
||||
{
|
||||
ASSERT(!"Not implemented yet");
|
||||
// TODO
|
||||
if (HasBlockTypes())
|
||||
{
|
||||
BLOCKTYPE * NewTypes = new BLOCKTYPE[m_SizeX * m_SizeY * m_SizeZ];
|
||||
for (int z = 0; z < m_SizeZ; z++)
|
||||
{
|
||||
int NewX = m_SizeZ - z - 1;
|
||||
for (int x = 0; x < m_SizeX; x++)
|
||||
{
|
||||
int NewZ = x;
|
||||
for (int y = 0; y < m_SizeY; y++)
|
||||
{
|
||||
NewTypes[NewX + NewZ * m_SizeX + y * m_SizeX * m_SizeZ] = m_BlockTypes[MakeIndex(x, y, z)];
|
||||
} // for y
|
||||
} // for x
|
||||
} // for z
|
||||
std::swap(m_BlockTypes, NewTypes);
|
||||
delete[] NewTypes;
|
||||
}
|
||||
if (HasBlockTypes())
|
||||
{
|
||||
NIBBLETYPE * NewMetas = new NIBBLETYPE[m_SizeX * m_SizeY * m_SizeZ];
|
||||
for (int z = 0; z < m_SizeZ; z++)
|
||||
{
|
||||
int NewX = m_SizeZ - z - 1;
|
||||
for (int x = 0; x < m_SizeX; x++)
|
||||
{
|
||||
int NewZ = x;
|
||||
for (int y = 0; y < m_SizeY; y++)
|
||||
{
|
||||
NewMetas[NewX + NewZ * m_SizeX + y * m_SizeX * m_SizeZ] = m_BlockMetas[MakeIndex(x, y, z)];
|
||||
} // for y
|
||||
} // for x
|
||||
} // for z
|
||||
std::swap(m_BlockMetas, NewMetas);
|
||||
delete[] NewMetas;
|
||||
}
|
||||
std::swap(m_SizeX, m_SizeZ);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user