1 /* 2 biome.h 3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net> 4 */ 5 6 /* 7 This file is part of Freeminer. 8 9 Freeminer is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Freeminer is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Freeminer. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef MG_BIOME_HEADER 24 #define MG_BIOME_HEADER 25 26 #include "mapgen.h" 27 #include "noise.h" 28 29 enum BiomeType 30 { 31 BIOME_TYPE_NORMAL, 32 BIOME_TYPE_LIQUID, 33 BIOME_TYPE_NETHER, 34 BIOME_TYPE_AETHER, 35 BIOME_TYPE_FLAT 36 }; 37 38 extern NoiseParams nparams_biome_def_heat; 39 extern NoiseParams nparams_biome_def_humidity; 40 41 42 class Biome : public GenElement { 43 public: 44 u32 flags; 45 46 content_t c_top; 47 content_t c_filler; 48 content_t c_water; 49 content_t c_ice; 50 content_t c_dust; 51 content_t c_dust_water; 52 53 s16 depth_top; 54 s16 depth_filler; 55 56 s16 height_min; 57 s16 height_max; 58 float heat_point; 59 float humidity_point; 60 61 content_t c_top_cold; 62 }; 63 64 class BiomeManager : public GenElementManager { 65 public: 66 static const char *ELEMENT_TITLE; 67 static const size_t ELEMENT_LIMIT = 0x100; 68 69 NoiseParams *np_heat; 70 NoiseParams *np_humidity; 71 72 BiomeManager(IGameDef *gamedef); 73 ~BiomeManager(); 74 create(int btt)75 Biome *create(int btt) 76 { 77 return new Biome; 78 } 79 80 u32 year_days; 81 s32 weather_heat_season; 82 s32 weather_heat_width; 83 s32 weather_heat_daily; 84 s32 weather_heat_height; 85 s32 weather_humidity_season; 86 s32 weather_humidity_width; 87 s32 weather_humidity_daily; 88 s32 weather_humidity_days; 89 s32 weather_hot_core; 90 91 s16 calcBlockHeat(v3s16 p, uint64_t seed, float timeofday, float totaltime, bool use_weather = 1); 92 s16 calcBlockHumidity(v3s16 p, uint64_t seed, float timeofday, float totaltime, bool use_weather = 1); 93 94 void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map, 95 s16 *height_map, u8 *biomeid_map); 96 Biome *getBiome(float heat, float humidity, s16 y); 97 }; 98 99 #endif 100