Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
Show All 24 Lines | |||||
#include "graphics/GameView.h" | #include "graphics/GameView.h" | ||||
#include "graphics/LOSTexture.h" | #include "graphics/LOSTexture.h" | ||||
#include "graphics/MapIO.h" | #include "graphics/MapIO.h" | ||||
#include "graphics/MapWriter.h" | #include "graphics/MapWriter.h" | ||||
#include "graphics/Patch.h" | #include "graphics/Patch.h" | ||||
#include "graphics/Terrain.h" | #include "graphics/Terrain.h" | ||||
#include "graphics/TerrainTextureEntry.h" | #include "graphics/TerrainTextureEntry.h" | ||||
#include "graphics/TerrainTextureManager.h" | #include "graphics/TerrainTextureManager.h" | ||||
#include "graphics/WaterManager.h" | |||||
#include "gui/ObjectTypes/CMiniMap.h" | #include "gui/ObjectTypes/CMiniMap.h" | ||||
#include "lib/bits.h" | #include "lib/bits.h" | ||||
#include "lib/file/vfs/vfs_path.h" | #include "lib/file/vfs/vfs_path.h" | ||||
#include "lib/status.h" | #include "lib/status.h" | ||||
#include "maths/MathUtil.h" | #include "maths/MathUtil.h" | ||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/Game.h" | #include "ps/Game.h" | ||||
#include "ps/GameSetup/GameSetup.h" | #include "ps/GameSetup/GameSetup.h" | ||||
#include "ps/Loader.h" | #include "ps/Loader.h" | ||||
#include "ps/Shapes.h" | #include "ps/Shapes.h" | ||||
#include "ps/World.h" | #include "ps/World.h" | ||||
#include "renderer/Renderer.h" | #include "renderer/Renderer.h" | ||||
#include "renderer/WaterManager.h" | |||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptInterface.h" | ||||
#include "simulation2/Simulation2.h" | #include "simulation2/Simulation2.h" | ||||
#include "simulation2/components/ICmpOwnership.h" | #include "simulation2/components/ICmpOwnership.h" | ||||
#include "simulation2/components/ICmpPlayer.h" | #include "simulation2/components/ICmpPlayer.h" | ||||
#include "simulation2/components/ICmpPlayerManager.h" | #include "simulation2/components/ICmpPlayerManager.h" | ||||
#include "simulation2/components/ICmpPosition.h" | #include "simulation2/components/ICmpPosition.h" | ||||
#include "simulation2/components/ICmpRangeManager.h" | #include "simulation2/components/ICmpRangeManager.h" | ||||
#include "simulation2/components/ICmpTemplateManager.h" | #include "simulation2/components/ICmpTemplateManager.h" | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
MESSAGEHANDLER(SaveMap) | MESSAGEHANDLER(SaveMap) | ||||
{ | { | ||||
CMapWriter writer; | CMapWriter writer; | ||||
VfsPath pathname = VfsPath(*msg->filename).ChangeExtension(L".pmp"); | VfsPath pathname = VfsPath(*msg->filename).ChangeExtension(L".pmp"); | ||||
writer.SaveMap(pathname, | writer.SaveMap(pathname, | ||||
g_Game->GetWorld()->GetTerrain(), | g_Game->GetWorld()->GetTerrain(), | ||||
g_Renderer.GetWaterManager(), g_Renderer.GetSkyManager(), | &g_Game->GetView()->GetWaterManager(), g_Renderer.GetSkyManager(), | ||||
&g_LightEnv, g_Game->GetView()->GetCamera(), g_Game->GetView()->GetCinema(), | &g_LightEnv, g_Game->GetView()->GetCamera(), g_Game->GetView()->GetCinema(), | ||||
&g_Renderer.GetPostprocManager(), | &g_Renderer.GetPostprocManager(), | ||||
g_Game->GetSimulation2()); | g_Game->GetSimulation2()); | ||||
} | } | ||||
QUERYHANDLER(GetMapSettings) | QUERYHANDLER(GetMapSettings) | ||||
{ | { | ||||
msg->settings = g_Game->GetSimulation2()->GetMapSettingsString(); | msg->settings = g_Game->GetSimulation2()->GetMapSettingsString(); | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | QUERYHANDLER(RasterizeMinimap) | ||||
const ssize_t imageDataSize = dimension * dimension * (bpp / 8); | const ssize_t imageDataSize = dimension * dimension * (bpp / 8); | ||||
std::vector<u8> imageBytes(imageDataSize); | std::vector<u8> imageBytes(imageDataSize); | ||||
float shallowPassageHeight = CMiniMap::GetShallowPassageHeight(); | float shallowPassageHeight = CMiniMap::GetShallowPassageHeight(); | ||||
ssize_t w = dimension; | ssize_t w = dimension; | ||||
ssize_t h = dimension; | ssize_t h = dimension; | ||||
float waterHeight = g_Renderer.GetWaterManager()->m_WaterHeight; | float waterHeight = g_Game->GetView()->GetWaterManager().GetWaterHeight(); | ||||
for (ssize_t j = 0; j < h; ++j) | for (ssize_t j = 0; j < h; ++j) | ||||
{ | { | ||||
// Work backwards to vertically flip the image. | // Work backwards to vertically flip the image. | ||||
ssize_t position = 3 * (h - j - 1) * dimension; | ssize_t position = 3 * (h - j - 1) * dimension; | ||||
for (ssize_t i = 0; i < w; ++i) | for (ssize_t i = 0; i < w; ++i) | ||||
{ | { | ||||
float avgHeight = (terrain->GetVertexGroundLevel(i, j) | float avgHeight = (terrain->GetVertexGroundLevel(i, j) | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator