Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | BEGIN_COMMAND(RecalculateWaterData) | ||||
void Undo() | void Undo() | ||||
{ | { | ||||
Redo(); | Redo(); | ||||
} | } | ||||
}; | }; | ||||
END_COMMAND(RecalculateWaterData) | END_COMMAND(RecalculateWaterData) | ||||
BEGIN_COMMAND(PickWaterHeight) | |||||
{ | |||||
entity_pos_t m_OldWaterHeight, m_NewWaterHeight; | |||||
void Do() | |||||
{ | |||||
CmpPtr<ICmpWaterManager> cmpWaterManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY); | |||||
ENSURE(cmpWaterManager); | |||||
CVector3D worldPos = msg->screenPos->GetWorldSpace(); | |||||
m_OldWaterHeight = cmpWaterManager->GetWaterLevel( | |||||
entity_pos_t::FromFloat(worldPos.X), entity_pos_t::FromFloat(worldPos.Z)); | |||||
m_NewWaterHeight = entity_pos_t::FromFloat(worldPos.Y); | |||||
SetWaterHeight(m_NewWaterHeight); | |||||
} | |||||
void Redo() | |||||
{ | |||||
SetWaterHeight(m_NewWaterHeight); | |||||
} | |||||
void Undo() | |||||
{ | |||||
SetWaterHeight(m_OldWaterHeight); | |||||
} | |||||
void SetWaterHeight(entity_pos_t height) | |||||
{ | |||||
CmpPtr<ICmpWaterManager> cmpWaterManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY); | |||||
ENSURE(cmpWaterManager); | |||||
cmpWaterManager->SetWaterLevel(height); | |||||
cmpWaterManager->RecomputeWaterData(); | |||||
} | |||||
}; | |||||
END_COMMAND(PickWaterHeight) | |||||
QUERYHANDLER(GetEnvironmentSettings) | QUERYHANDLER(GetEnvironmentSettings) | ||||
{ | { | ||||
msg->settings = GetSettings(); | msg->settings = GetSettings(); | ||||
} | } | ||||
QUERYHANDLER(GetSkySets) | QUERYHANDLER(GetSkySets) | ||||
{ | { | ||||
Show All 12 Lines |
Wildfire Games · Phabricator