From c5af1c81fc41e858a4a718e9cad065fd071dc986 Mon Sep 17 00:00:00 2001 From: CounterPillow Date: Sun, 29 Apr 2012 02:26:14 +0200 Subject: [PATCH] Added a special case for the swamp biome. Addresses issue #708. --- overviewer_core/src/primitives/base.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/overviewer_core/src/primitives/base.c b/overviewer_core/src/primitives/base.c index 5a66a9a..ae93db7 100644 --- a/overviewer_core/src/primitives/base.c +++ b/overviewer_core/src/primitives/base.c @@ -206,6 +206,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec }; if (color_table) { + unsigned char biome; int dx, dz; unsigned char tablex, tabley; float temp = 0.0, rain = 0.0; @@ -215,7 +216,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec /* average over all neighbors */ for (dx = -1; dx <= 1; dx++) { for (dz = -1; dz <= 1; dz++) { - unsigned char biome = get_data(state, BIOMES, state->x + dx, state->y, state->z + dz); + biome = get_data(state, BIOMES, state->x + dx, state->y, state->z + dz); if (biome >= NUM_BIOMES) { /* note -- biome 255 shows up on map borders. who knows what it is? certainly not I. @@ -257,6 +258,18 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec r = PyInt_AsLong(PyTuple_GET_ITEM(color, 0)); g = PyInt_AsLong(PyTuple_GET_ITEM(color, 1)); b = PyInt_AsLong(PyTuple_GET_ITEM(color, 2)); + + /* swamp hack + All values are guessed. They are probably somewhat odd or + completely wrong, but this looks okay for me, and I'm male, + so I can only distinct about 10 different colors anyways. + Blame my Y-Chromosone. */ + if(biome == 6) { + r = PyInt_AsLong(PyTuple_GET_ITEM(color, 0)) * 0.8; + g = PyInt_AsLong(PyTuple_GET_ITEM(color, 1)) / 2.0; + b = PyInt_AsLong(PyTuple_GET_ITEM(color, 2)) * 1.0; + } + Py_DECREF(color); }