2004-05-29 22:56:24 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Name: MiniPatch.h
|
|
|
|
// Author: Rich Cross
|
|
|
|
// Contact: rich@wildfiregames.com
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2004-06-03 20:38:14 +02:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
2004-05-29 22:56:24 +02:00
|
|
|
#include "Patch.h"
|
2004-06-08 14:10:51 +02:00
|
|
|
#include "MiniPatch.h"
|
|
|
|
#include "Terrain.h"
|
2004-05-29 22:56:24 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Constructor
|
|
|
|
CMiniPatch::CMiniPatch() : Tex1(0), Tex1Priority(0), m_Parent(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Destructor
|
|
|
|
CMiniPatch::~CMiniPatch()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// GetTileIndex: get the index of this tile in the root terrain object;
|
|
|
|
// on return, parameters x,y contain index in [0,MapSize)
|
|
|
|
void CMiniPatch::GetTileIndex(u32& x,u32& z)
|
|
|
|
{
|
2004-06-03 02:20:20 +02:00
|
|
|
const ptrdiff_t tindex = this - &m_Parent->m_MiniPatches[0][0];
|
2004-06-07 21:59:20 +02:00
|
|
|
x=(m_Parent->m_X*PATCH_SIZE)+tindex%PATCH_SIZE;
|
|
|
|
z=(m_Parent->m_Z*PATCH_SIZE)+tindex/PATCH_SIZE;
|
2004-05-29 22:56:24 +02:00
|
|
|
}
|
|
|
|
|