summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-25 22:45:22 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-25 22:45:22 +0100
commit56f13f83bb7126ca7c651a0bb70e862e1d867b9e (patch)
treea171e0d8194e9108f3493571810a2f385a437902 /Tools
parentMerge remote-tracking branch 'origin/master' into redstonefixes (diff)
parentFixed cFile compilation on Linux. (diff)
downloadcuberite-56f13f83bb7126ca7c651a0bb70e862e1d867b9e.tar
cuberite-56f13f83bb7126ca7c651a0bb70e862e1d867b9e.tar.gz
cuberite-56f13f83bb7126ca7c651a0bb70e862e1d867b9e.tar.bz2
cuberite-56f13f83bb7126ca7c651a0bb70e862e1d867b9e.tar.lz
cuberite-56f13f83bb7126ca7c651a0bb70e862e1d867b9e.tar.xz
cuberite-56f13f83bb7126ca7c651a0bb70e862e1d867b9e.tar.zst
cuberite-56f13f83bb7126ca7c651a0bb70e862e1d867b9e.zip
Diffstat (limited to 'Tools')
-rw-r--r--Tools/AnvilStats/Globals.h1
-rw-r--r--Tools/AnvilStats/Processor.cpp4
-rw-r--r--Tools/BiomeVisualiser/BiomeColors.cpp114
-rw-r--r--Tools/BiomeVisualiser/BiomeColors.h15
-rw-r--r--Tools/BiomeVisualiser/BiomeRenderer.cpp36
-rw-r--r--Tools/BiomeVisualiser/BiomeVisualiser.vcproj8
6 files changed, 144 insertions, 34 deletions
diff --git a/Tools/AnvilStats/Globals.h b/Tools/AnvilStats/Globals.h
index db5d3c635..48e1f8492 100644
--- a/Tools/AnvilStats/Globals.h
+++ b/Tools/AnvilStats/Globals.h
@@ -138,6 +138,7 @@ typedef unsigned short UInt16;
// CRT stuff:
+#include <sys/stat.h>
#include <assert.h>
#include <stdio.h>
#include <math.h>
diff --git a/Tools/AnvilStats/Processor.cpp b/Tools/AnvilStats/Processor.cpp
index 8e1cc4c4b..4ecd685ad 100644
--- a/Tools/AnvilStats/Processor.cpp
+++ b/Tools/AnvilStats/Processor.cpp
@@ -554,8 +554,8 @@ void cProcessor::PopulateFileQueue(const AString & a_WorldFolder)
{
Path.push_back(cFile::PathSeparator);
}
- AStringList AllFiles = GetDirectoryContents(Path.c_str());
- for (AStringList::iterator itr = AllFiles.begin(), end = AllFiles.end(); itr != end; ++itr)
+ AStringVector AllFiles = cFile::GetFolderContents(Path.c_str());
+ for (AStringVector::iterator itr = AllFiles.begin(), end = AllFiles.end(); itr != end; ++itr)
{
if (itr->rfind(".mca") != itr->length() - 4)
{
diff --git a/Tools/BiomeVisualiser/BiomeColors.cpp b/Tools/BiomeVisualiser/BiomeColors.cpp
new file mode 100644
index 000000000..1fd0cb7a0
--- /dev/null
+++ b/Tools/BiomeVisualiser/BiomeColors.cpp
@@ -0,0 +1,114 @@
+
+// BiomeColors.cpp
+
+// Implements the g_BiomeColors[] array preparation based on a stored biome-to-color map
+
+#include "Globals.h"
+#include "BiomeColors.h"
+
+
+
+
+
+int g_BiomeColors[256];
+
+
+
+
+
+static struct
+{
+ EMCSBiome Biome;
+ int Color;
+} g_BiomeColorMap[] =
+{
+ { biOcean, 0x000070 },
+ { biPlains, 0x8db360 },
+ { biDesert, 0xfa9418 },
+ { biExtremeHills, 0x606060 },
+ { biForest, 0x056621 },
+ { biTaiga, 0x0b6659 },
+ { biSwampland, 0x2fffda },
+ { biRiver, 0x3030af },
+ { biHell, 0x7f0000 },
+ { biSky, 0x007fff },
+ { biFrozenOcean, 0xa0a0df },
+ { biFrozenRiver, 0xa0a0ff },
+ { biIcePlains, 0xffffff },
+ { biIceMountains, 0xa0a0a0 },
+ { biMushroomIsland, 0xff00ff },
+ { biMushroomShore, 0xa000ff },
+ { biBeach, 0xfade55 },
+ { biDesertHills, 0xd25f12 },
+ { biForestHills, 0x22551c },
+ { biTaigaHills, 0x163933 },
+ { biExtremeHillsEdge, 0x7f8f7f },
+ { biJungle, 0x537b09 },
+ { biJungleHills, 0x2c4205 },
+
+ { biJungleEdge, 0x628b17 },
+ { biDeepOcean, 0x000030 },
+ { biStoneBeach, 0xa2a284 },
+ { biColdBeach, 0xfaf0c0 },
+ { biBirchForest, 0x307444 },
+ { biBirchForestHills, 0x1f5f32 },
+ { biRoofedForest, 0x40511a },
+ { biColdTaiga, 0x31554a },
+ { biColdTaigaHills, 0x597d72 },
+ { biMegaTaiga, 0x596651 },
+ { biMegaTaigaHills, 0x596659 },
+ { biExtremeHillsPlus, 0x507050 },
+ { biSavanna, 0xbdb25f },
+ { biSavannaPlateau, 0xa79d64 },
+ { biMesa, 0xd94515 },
+ { biMesaPlateauF, 0xb09765 },
+ { biMesaPlateau, 0xca8c65 },
+
+ // M variants:
+ { biSunflowerPlains, 0xb5db88 },
+ { biDesertM, 0xffbc40 },
+ { biExtremeHillsM, 0x888888 },
+ { biFlowerForest, 0x2d8e49 },
+ { biTaigaM, 0x338e81 },
+ { biSwamplandM, 0x07f9b2 },
+ { biIcePlainsSpikes, 0xb4dcdc },
+ { biJungleM, 0x7ba331 },
+ { biJungleEdgeM, 0x628b17 },
+ { biBirchForestM, 0x589c6c },
+ { biBirchForestHillsM, 0x47875a },
+ { biRoofedForestM, 0x687942 },
+ { biColdTaigaM, 0x243f36 },
+ { biMegaSpruceTaiga, 0x454f3e },
+ { biMegaSpruceTaigaHills, 0x454f4e },
+ { biExtremeHillsPlusM, 0x789878 },
+ { biSavannaM, 0xe5da87 },
+ { biSavannaPlateauM, 0xa79d74 },
+ { biMesaBryce, 0xff6d3d },
+ { biMesaPlateauFM, 0xd8bf8d },
+ { biMesaPlateauM, 0xf2b48d },
+} ;
+
+
+
+
+
+static class cBiomeColorsInitializer
+{
+public:
+ cBiomeColorsInitializer(void)
+ {
+ // Reset all colors to gray:
+ for (size_t i = 0; i < ARRAYCOUNT(g_BiomeColors); i++)
+ {
+ g_BiomeColors[i] = 0x7f7f7f;
+ }
+ for (size_t i = 0; i < ARRAYCOUNT(g_BiomeColorMap); i++)
+ {
+ g_BiomeColors[g_BiomeColorMap[i].Biome] = g_BiomeColorMap[i].Color;
+ }
+ }
+} g_Initializer;
+
+
+
+
diff --git a/Tools/BiomeVisualiser/BiomeColors.h b/Tools/BiomeVisualiser/BiomeColors.h
new file mode 100644
index 000000000..0cb0f578c
--- /dev/null
+++ b/Tools/BiomeVisualiser/BiomeColors.h
@@ -0,0 +1,15 @@
+
+// BiomeColors.h
+
+// Declares the g_BiomeColors[] array used for biome color lookup
+
+
+
+
+
+extern int g_BiomeColors[256];
+
+
+
+
+
diff --git a/Tools/BiomeVisualiser/BiomeRenderer.cpp b/Tools/BiomeVisualiser/BiomeRenderer.cpp
index 98548179c..758eb4b48 100644
--- a/Tools/BiomeVisualiser/BiomeRenderer.cpp
+++ b/Tools/BiomeVisualiser/BiomeRenderer.cpp
@@ -7,6 +7,7 @@
#include "BiomeRenderer.h"
#include "Pixmap.h"
#include "Timer.h"
+#include "BiomeColors.h"
@@ -96,40 +97,11 @@ bool cBiomeRenderer::Render(cPixmap & a_Pixmap)
int cBiomeRenderer::GetBiomeColor(EMCSBiome a_Biome)
{
- if ((a_Biome < 0) || (a_Biome > biMaxBiome))
+ if ((a_Biome < 0) || (a_Biome >= ARRAYCOUNT(g_BiomeColors)))
{
- return 0xcfcfcf; // LtGray for unknown biomes
+ return 0xff0000;
}
-
- static int BiomeColor[] =
- {
- // RGB:
- 0x0000ff, /* Ocean */
- 0x00cf3f, /* Plains */
- 0xffff00, /* Desert */
- 0x7f7f7f, /* Extreme Hills */
- 0x00cf00, /* Forest */
- 0x007f3f, /* Taiga */
- 0x3f7f00, /* Swampland */
- 0x003fff, /* River */
- 0x7f0000, /* Hell */
- 0x007fff, /* Sky */
- 0x3f3fff, /* Frozen Ocean */
- 0x3f3fff, /* Frozen River */
- 0x7fffcf, /* Ice Plains */
- 0x3fcf7f, /* Ice Mountains */
- 0xcf00cf, /* Mushroom Island */
- 0x7f00ff, /* Mushroom Island Shore */
- 0xffff3f, /* Beach */
- 0xcfcf00, /* Desert Hills */
- 0x00cf3f, /* Forest Hills */
- 0x006f1f, /* Taiga Hills */
- 0x7f8f7f, /* Extreme Hills Edge */
- 0x004f00, /* Jungle */
- 0x003f00, /* Jungle Hills */
- } ;
-
- return BiomeColor[a_Biome];
+ return g_BiomeColors[a_Biome];
}
diff --git a/Tools/BiomeVisualiser/BiomeVisualiser.vcproj b/Tools/BiomeVisualiser/BiomeVisualiser.vcproj
index 5f840129d..2616313a2 100644
--- a/Tools/BiomeVisualiser/BiomeVisualiser.vcproj
+++ b/Tools/BiomeVisualiser/BiomeVisualiser.vcproj
@@ -269,6 +269,10 @@
>
</File>
<File
+ RelativePath=".\BiomeColors.cpp"
+ >
+ </File>
+ <File
RelativePath=".\BiomeRenderer.cpp"
>
</File>
@@ -489,6 +493,10 @@
</Filter>
</Filter>
</Filter>
+ <File
+ RelativePath=".\BiomeColors.h"
+ >
+ </File>
</Files>
<Globals>
</Globals>