Add new Biomes, guessing on correct color schemes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Minecraft Overviewer.
|
* This file is part of the Minecraft Overviewer.
|
||||||
*
|
*
|
||||||
* Minecraft Overviewer is free software: you can redistribute it and/or
|
* Minecraft Overviewer is free software: you can redistribute it and/or
|
||||||
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char* name;
|
const char* name;
|
||||||
|
|
||||||
float temperature;
|
float temperature;
|
||||||
float rainfall;
|
float rainfall;
|
||||||
|
|
||||||
unsigned int r, g, b;
|
unsigned int r, g, b;
|
||||||
} Biome;
|
} Biome;
|
||||||
|
|
||||||
@@ -65,8 +65,29 @@ static Biome biome_table[] = {
|
|||||||
{"TaigaHills", 0.05, 0.8, 255, 255, 255},
|
{"TaigaHills", 0.05, 0.8, 255, 255, 255},
|
||||||
/* 20 */
|
/* 20 */
|
||||||
{"Extreme Hills Edge", 0.2, 0.3, 255, 255, 255},
|
{"Extreme Hills Edge", 0.2, 0.3, 255, 255, 255},
|
||||||
{"Jungle", 2.0, 0.45, 255, 255, 255}, /* <-- GUESS, but a good one */
|
/* Values below are guesses */
|
||||||
{"Jungle Mountains", 2.0, 0.45, 255, 255, 255}, /* <-- also a guess */
|
{"Jungle", 2.0, 0.45, 255, 255, 255},
|
||||||
|
{"Jungle Hills", 2.0, 0.45, 255, 255, 255},
|
||||||
|
{"Jungle Edge", 2.0, 0.45, 255, 255, 255},
|
||||||
|
{"Deep Ocean", 0.0, 1, 255, 255, 255},
|
||||||
|
/* 25 */
|
||||||
|
{"Stone Beach", 0.2, 1, 255, 255, 255},
|
||||||
|
{"Cold Beach", 0.2, 1, 255, 255, 255},
|
||||||
|
{"Birch Forest", 0.7, 0.8, 255, 255, 255},
|
||||||
|
{"Birch Forest Hills", 0.7, 0.8, 255, 255, 255},
|
||||||
|
{"Roofed Forest", 2.0, 0.45, 255, 255, 255},
|
||||||
|
/* 30 */
|
||||||
|
{"Cold Taiga", 0.05, 0.8, 255, 255, 255},
|
||||||
|
{"Cold Taiga Hills", 0.05, 0.8, 255, 255, 255},
|
||||||
|
{"Mega Taiga", 0.05, 0.8, 255, 255, 255},
|
||||||
|
{"Mega Taiga Hills", 0.05, 0.8, 255, 255, 255},
|
||||||
|
{"Extreme Hills+", 0.2, 0.3, 255, 255, 255},
|
||||||
|
/* 35 */
|
||||||
|
{"Savanna", 1.0, 0.1, 255, 255, 255},
|
||||||
|
{"Savanna Plateau", 1.0, 0.1, 255, 255, 255},
|
||||||
|
{"Mesa", 1.8, 0.0, 255, 255, 255},
|
||||||
|
{"Mesa Plateau F", 1.8, 0.0, 255, 255, 255},
|
||||||
|
{"Mesa Plateau", 1.8, 0.0, 255, 255, 255}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_BIOMES (sizeof(biome_table) / sizeof(Biome))
|
#define NUM_BIOMES (sizeof(biome_table) / sizeof(Biome))
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
/* inherits from overlay */
|
/* inherits from overlay */
|
||||||
RenderPrimitiveOverlay parent;
|
RenderPrimitiveOverlay parent;
|
||||||
|
|
||||||
void *biomes;
|
void *biomes;
|
||||||
} RenderPrimitiveBiomes;
|
} RenderPrimitiveBiomes;
|
||||||
|
|
||||||
@@ -53,21 +53,39 @@ static struct BiomeColor default_biomes[] = {
|
|||||||
{19, 100, 100, 240}, /* TaigaHills */
|
{19, 100, 100, 240}, /* TaigaHills */
|
||||||
{20, 255, 25, 15}, /* Extreme Hills Edge */
|
{20, 255, 25, 15}, /* Extreme Hills Edge */
|
||||||
{21, 155, 155, 55}, /* Jungle */
|
{21, 155, 155, 55}, /* Jungle */
|
||||||
{22, 175, 255, 55}, /* Jungle Mountains */
|
{22, 175, 255, 55}, /* Jungle Hills */
|
||||||
|
{23, 135, 255, 55}, /* Jungle Edge */
|
||||||
|
{24, 135, 106, 150}, /* Deep Ocean */
|
||||||
|
{25, 255, 25, 15}, /* Stone Beach */
|
||||||
|
{26, 155, 255, 255}, /* Cold Beach */
|
||||||
|
{27, 10, 200, 200}, /* Birch Forest */
|
||||||
|
{28, 10, 200, 200}, /* Birch Forest Edge */
|
||||||
|
{29, 10, 200, 200}, /* Roofed Forest */
|
||||||
|
{30, 155, 255, 255}, /* Cold Taiga */
|
||||||
|
{31, 155, 200, 255}, /* Cold Taiga Hills */
|
||||||
|
{32, 10, 100, 240}, /* Mega Taiga */
|
||||||
|
{33, 10, 100, 240}, /* Mega Taiga Hills*/
|
||||||
|
{34, 255, 55, 55}, /* Extreme Hills+ */
|
||||||
|
{35, 227, 107, 0}, /* Savanna */
|
||||||
|
{36, 227, 107, 0}, /* Savanna Plateau */
|
||||||
|
{37, 255, 100, 100}, /* Mesa */
|
||||||
|
{38, 255, 100, 100}, /* Mesa Plateau F */
|
||||||
|
{39, 255, 100, 100}, /* Mesa Plateau */
|
||||||
|
|
||||||
/* end of list marker */
|
/* end of list marker */
|
||||||
{255, 0, 0, 0}
|
{255, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void get_color(void *data, RenderState *state,
|
static void get_color(void *data, RenderState *state,
|
||||||
unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) {
|
unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) {
|
||||||
|
|
||||||
unsigned char biome;
|
unsigned char biome;
|
||||||
int x = state->x, z = state->z, y_max, y;
|
int x = state->x, z = state->z, y_max, y;
|
||||||
int max_i = -1;
|
int max_i = -1;
|
||||||
RenderPrimitiveBiomes* self = (RenderPrimitiveBiomes *)data;
|
RenderPrimitiveBiomes* self = (RenderPrimitiveBiomes *)data;
|
||||||
struct BiomeColor *biomes = (struct BiomeColor *)(self->biomes);
|
struct BiomeColor *biomes = (struct BiomeColor *)(self->biomes);
|
||||||
*a = 0;
|
*a = 0;
|
||||||
|
|
||||||
y_max = state->y + 1;
|
y_max = state->y + 1;
|
||||||
for (y = state->chunky * -16; y <= y_max; y++) {
|
for (y = state->chunky * -16; y <= y_max; y++) {
|
||||||
int i, tmp;
|
int i, tmp;
|
||||||
@@ -83,7 +101,7 @@ static void get_color(void *data, RenderState *state,
|
|||||||
*r = biomes[i].r;
|
*r = biomes[i].r;
|
||||||
*g = biomes[i].g;
|
*g = biomes[i].g;
|
||||||
*b = biomes[i].b;
|
*b = biomes[i].b;
|
||||||
|
|
||||||
*a = self->parent.color->a;
|
*a = self->parent.color->a;
|
||||||
|
|
||||||
max_i = i;
|
max_i = i;
|
||||||
@@ -103,29 +121,29 @@ overlay_biomes_start(void *data, RenderState *state, PyObject *support) {
|
|||||||
int ret = primitive_overlay.start(data, state, support);
|
int ret = primitive_overlay.start(data, state, support);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* now do custom initializations */
|
/* now do custom initializations */
|
||||||
self = (RenderPrimitiveBiomes *)data;
|
self = (RenderPrimitiveBiomes *)data;
|
||||||
|
|
||||||
// opt is a borrowed reference. do not deref
|
// opt is a borrowed reference. do not deref
|
||||||
if (!render_mode_parse_option(support, "biomes", "O", &(opt)))
|
if (!render_mode_parse_option(support, "biomes", "O", &(opt)))
|
||||||
return 1;
|
return 1;
|
||||||
if (opt && opt != Py_None) {
|
if (opt && opt != Py_None) {
|
||||||
struct BiomeColor *biomes = NULL;
|
struct BiomeColor *biomes = NULL;
|
||||||
Py_ssize_t biomes_size = 0, i;
|
Py_ssize_t biomes_size = 0, i;
|
||||||
/* create custom biomes */
|
/* create custom biomes */
|
||||||
|
|
||||||
if (!PyList_Check(opt)) {
|
if (!PyList_Check(opt)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "'biomes' must be a list");
|
PyErr_SetString(PyExc_TypeError, "'biomes' must be a list");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
biomes_size = PyList_GET_SIZE(opt);
|
biomes_size = PyList_GET_SIZE(opt);
|
||||||
biomes = self->biomes = calloc(biomes_size + 1, sizeof(struct BiomeColor));
|
biomes = self->biomes = calloc(biomes_size + 1, sizeof(struct BiomeColor));
|
||||||
if (biomes == NULL) {
|
if (biomes == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < biomes_size; i++) {
|
for (i = 0; i < biomes_size; i++) {
|
||||||
PyObject *biome = PyList_GET_ITEM(opt, i);
|
PyObject *biome = PyList_GET_ITEM(opt, i);
|
||||||
char *tmpname = NULL;
|
char *tmpname = NULL;
|
||||||
@@ -152,7 +170,7 @@ overlay_biomes_start(void *data, RenderState *state, PyObject *support) {
|
|||||||
} else {
|
} else {
|
||||||
self->biomes = default_biomes;
|
self->biomes = default_biomes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!render_mode_parse_option(support, "alpha", "b", &(alpha_tmp))) {
|
if (!render_mode_parse_option(support, "alpha", "b", &(alpha_tmp))) {
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
@@ -163,7 +181,7 @@ overlay_biomes_start(void *data, RenderState *state, PyObject *support) {
|
|||||||
}
|
}
|
||||||
/* setup custom color */
|
/* setup custom color */
|
||||||
self->parent.get_color = get_color;
|
self->parent.get_color = get_color;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,11 +189,11 @@ static void
|
|||||||
overlay_biomes_finish(void *data, RenderState *state) {
|
overlay_biomes_finish(void *data, RenderState *state) {
|
||||||
/* first free all *our* stuff */
|
/* first free all *our* stuff */
|
||||||
RenderPrimitiveBiomes* self = (RenderPrimitiveBiomes *)data;
|
RenderPrimitiveBiomes* self = (RenderPrimitiveBiomes *)data;
|
||||||
|
|
||||||
if (self->biomes && self->biomes != default_biomes) {
|
if (self->biomes && self->biomes != default_biomes) {
|
||||||
free(self->biomes);
|
free(self->biomes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now, chain up */
|
/* now, chain up */
|
||||||
primitive_overlay.finish(data, state);
|
primitive_overlay.finish(data, state);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user