Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/GameInterface/Handlers/TerrainHandlers.cpp
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
QUERYHANDLER(GetTerrainTexture) | QUERYHANDLER(GetTerrainTexture) | ||||
{ | { | ||||
ssize_t x, y; | ssize_t x, y; | ||||
g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | ||||
g_CurrentBrush.GetCentre(x, y); | g_CurrentBrush.GetCentre(x, y); | ||||
CTerrain* terrain = g_Game->GetWorld()->GetTerrain(); | CTerrain* terrain = CGame::GetGame()->GetWorld()->GetTerrain(); | ||||
CMiniPatch* tile = terrain->GetTile(x, y); | CMiniPatch* tile = terrain->GetTile(x, y); | ||||
if (tile) | if (tile) | ||||
{ | { | ||||
CTerrainTextureEntry* tex = tile->GetTextureEntry(); | CTerrainTextureEntry* tex = tile->GetTextureEntry(); | ||||
msg->texture = tex->GetTag().FromUTF8(); | msg->texture = tex->GetTag().FromUTF8(); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
Show All 29 Lines | struct TerrainTile | ||||
ssize_t priority; | ssize_t priority; | ||||
}; | }; | ||||
class TerrainArray : public DeltaArray2D<TerrainTile> | class TerrainArray : public DeltaArray2D<TerrainTile> | ||||
{ | { | ||||
public: | public: | ||||
void Init() | void Init() | ||||
{ | { | ||||
m_Terrain = g_Game->GetWorld()->GetTerrain(); | m_Terrain = CGame::GetGame()->GetWorld()->GetTerrain(); | ||||
m_VertsPerSide = g_Game->GetWorld()->GetTerrain()->GetVerticesPerSide(); | m_VertsPerSide = CGame::GetGame()->GetWorld()->GetTerrain()->GetVerticesPerSide(); | ||||
} | } | ||||
void UpdatePriority(ssize_t x, ssize_t y, CTerrainTextureEntry* tex, ssize_t priorityScale, ssize_t& priority) | void UpdatePriority(ssize_t x, ssize_t y, CTerrainTextureEntry* tex, ssize_t priorityScale, ssize_t& priority) | ||||
{ | { | ||||
CMiniPatch* tile = m_Terrain->GetTile(x, y); | CMiniPatch* tile = m_Terrain->GetTile(x, y); | ||||
if (!tile) | if (!tile) | ||||
return; // tile was out-of-bounds | return; // tile was out-of-bounds | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | BEGIN_COMMAND(PaintTerrain) | ||||
cPaintTerrain() | cPaintTerrain() | ||||
{ | { | ||||
m_TerrainDelta.Init(); | m_TerrainDelta.Init(); | ||||
} | } | ||||
void MakeDirty() | void MakeDirty() | ||||
{ | { | ||||
g_Game->GetWorld()->GetTerrain()->MakeDirty(m_i0, m_j0, m_i1, m_j1, RENDERDATA_UPDATE_INDICES); | CGame::GetGame()->GetWorld()->GetTerrain()->MakeDirty(m_i0, m_j0, m_i1, m_j1, RENDERDATA_UPDATE_INDICES); | ||||
} | } | ||||
void Do() | void Do() | ||||
{ | { | ||||
g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | ||||
ssize_t x0, y0; | ssize_t x0, y0; | ||||
g_CurrentBrush.GetBottomLeft(x0, y0); | g_CurrentBrush.GetBottomLeft(x0, y0); | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | BEGIN_COMMAND(ReplaceTerrain) | ||||
cReplaceTerrain() | cReplaceTerrain() | ||||
{ | { | ||||
m_TerrainDelta.Init(); | m_TerrainDelta.Init(); | ||||
} | } | ||||
void MakeDirty() | void MakeDirty() | ||||
{ | { | ||||
g_Game->GetWorld()->GetTerrain()->MakeDirty(m_i0, m_j0, m_i1, m_j1, RENDERDATA_UPDATE_INDICES); | CGame::GetGame()->GetWorld()->GetTerrain()->MakeDirty(m_i0, m_j0, m_i1, m_j1, RENDERDATA_UPDATE_INDICES); | ||||
CmpPtr<ICmpTerrain> cmpTerrain(*g_Game->GetSimulation2(), SYSTEM_ENTITY); | CmpPtr<ICmpTerrain> cmpTerrain(*CGame::GetGame()->GetSimulation2(), SYSTEM_ENTITY); | ||||
if (cmpTerrain) | if (cmpTerrain) | ||||
cmpTerrain->MakeDirty(m_i0, m_j0, m_i1, m_j1); | cmpTerrain->MakeDirty(m_i0, m_j0, m_i1, m_j1); | ||||
} | } | ||||
void Do() | void Do() | ||||
{ | { | ||||
g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | BEGIN_COMMAND(FillTerrain) | ||||
cFillTerrain() | cFillTerrain() | ||||
{ | { | ||||
m_TerrainDelta.Init(); | m_TerrainDelta.Init(); | ||||
} | } | ||||
void MakeDirty() | void MakeDirty() | ||||
{ | { | ||||
g_Game->GetWorld()->GetTerrain()->MakeDirty(m_i0, m_j0, m_i1, m_j1, RENDERDATA_UPDATE_INDICES); | CGame::GetGame()->GetWorld()->GetTerrain()->MakeDirty(m_i0, m_j0, m_i1, m_j1, RENDERDATA_UPDATE_INDICES); | ||||
CmpPtr<ICmpTerrain> cmpTerrain(*g_Game->GetSimulation2(), SYSTEM_ENTITY); | CmpPtr<ICmpTerrain> cmpTerrain(*CGame::GetGame()->GetSimulation2(), SYSTEM_ENTITY); | ||||
if (cmpTerrain) | if (cmpTerrain) | ||||
cmpTerrain->MakeDirty(m_i0, m_j0, m_i1, m_j1); | cmpTerrain->MakeDirty(m_i0, m_j0, m_i1, m_j1); | ||||
} | } | ||||
void Do() | void Do() | ||||
{ | { | ||||
g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | g_CurrentBrush.m_Centre = msg->pos->GetWorldSpace(); | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator