Made the hex field size and the default terrain wml configurable.
This commit is contained in:
parent
1f68e0bb48
commit
c975dd6d1a
9 changed files with 35 additions and 16 deletions
|
@ -25,6 +25,7 @@ Version 1.11.0+svn:
|
|||
* Fix invalid memory access crash resulting from deleting all saved games
|
||||
in the Load Game dialog
|
||||
* Removed two Khalifate leftovers (Hakim portrait and KHALIFATE_NAMES macro)
|
||||
* Hex field size and default terrain are wml configurable
|
||||
|
||||
Version 1.11.0:
|
||||
* Add-ons client:
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
recall_cost=20
|
||||
kill_experience=8
|
||||
|
||||
default_terrain="Gg"
|
||||
|
||||
title_music="main_menu.ogg"
|
||||
lobby_music="silence.ogg"
|
||||
default_victory_music="victory.ogg,victory2.ogg"
|
||||
|
|
|
@ -164,6 +164,7 @@ const terrain_builder::tile& terrain_builder::tilemap::operator[] (const map_loc
|
|||
|
||||
terrain_builder::terrain_builder(const config& level,
|
||||
const gamemap* m, const std::string& offmap_image) :
|
||||
tilewidth_(game_config::tile_size),
|
||||
map_(m),
|
||||
tile_map_(m ? map().w() : 0, m ? map().h() :0),
|
||||
terrain_by_type_()
|
||||
|
@ -469,14 +470,14 @@ void terrain_builder::rotate(terrain_constraint &ret, int angle)
|
|||
|
||||
double vx, vy, rx, ry;
|
||||
|
||||
vx = double(itor->basex) - double(TILEWIDTH)/2;
|
||||
vy = double(itor->basey) - double(TILEWIDTH)/2;
|
||||
vx = double(itor->basex) - double(tilewidth_)/2;
|
||||
vy = double(itor->basey) - double(tilewidth_)/2;
|
||||
|
||||
rx = xyrotations[angle].xx * vx + xyrotations[angle].xy * vy;
|
||||
ry = xyrotations[angle].yx * vx + xyrotations[angle].yy * vy;
|
||||
|
||||
itor->basex = int(rx + TILEWIDTH/2);
|
||||
itor->basey = int(ry + TILEWIDTH/2);
|
||||
itor->basex = int(rx + tilewidth_/2);
|
||||
itor->basey = int(ry + tilewidth_/2);
|
||||
|
||||
//std::cerr << "Rotation: from " << vx << ", " << vy << " to " << itor->basex <<
|
||||
// ", " << itor->basey << "\n";
|
||||
|
@ -587,7 +588,7 @@ void terrain_builder::add_images_from_config(rule_imagelist& images, const confi
|
|||
{
|
||||
int layer = img["layer"];
|
||||
|
||||
int basex = TILEWIDTH / 2 + dx, basey = TILEWIDTH / 2 + dy;
|
||||
int basex = tilewidth_ / 2 + dx, basey = tilewidth_ / 2 + dy;
|
||||
if (const config::attribute_value *base_ = img.get("base")) {
|
||||
std::vector<std::string> base = utils::split(*base_);
|
||||
if(base.size() >= 2) {
|
||||
|
@ -650,8 +651,8 @@ terrain_builder::terrain_constraint &terrain_builder::add_constraints(
|
|||
cons->terrain_types_match = type;
|
||||
}
|
||||
|
||||
int x = loc.x * TILEWIDTH * 3 / 4;
|
||||
int y = loc.y * TILEWIDTH + (loc.x % 2) * TILEWIDTH / 2;
|
||||
int x = loc.x * tilewidth_ * 3 / 4;
|
||||
int y = loc.y * tilewidth_ + (loc.x % 2) * tilewidth_ / 2;
|
||||
add_images_from_config(cons->images, global_images, true, x, y);
|
||||
|
||||
return *cons;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "animated.hpp"
|
||||
#include "map_location.hpp"
|
||||
#include "terrain_translation.hpp"
|
||||
#include "game_config.hpp"
|
||||
|
||||
class config;
|
||||
class gamemap;
|
||||
|
@ -55,12 +56,6 @@ public:
|
|||
*/
|
||||
};
|
||||
|
||||
/** The tile width used when using basex and basey. This is not,
|
||||
* necessarily, the tile width in pixels, this is totally
|
||||
* arbitrary. However, it will be set to 72 for convenience.
|
||||
*/
|
||||
static const int TILEWIDTH = 72;
|
||||
|
||||
/** The position of unit graphics in a tile. Graphics whose y
|
||||
* position is below this value are considered background for
|
||||
* this tile; graphics whose y position is above this value are
|
||||
|
@ -343,6 +338,13 @@ public:
|
|||
tile* get_tile(const map_location &loc);
|
||||
|
||||
private:
|
||||
|
||||
/** The tile width used when using basex and basey. This is not,
|
||||
* necessarily, the tile width in pixels, this is totally
|
||||
* arbitrary. However, it will be set to 72 for convenience.
|
||||
*/
|
||||
const int tilewidth_; // = game_config::tile_size;
|
||||
|
||||
/**
|
||||
* The list of constraints attached to a terrain_graphics WML rule.
|
||||
*/
|
||||
|
|
|
@ -61,7 +61,7 @@ static lg::log_domain log_display("display");
|
|||
#define DBG_DP LOG_STREAM(debug, log_display)
|
||||
|
||||
namespace {
|
||||
const int DefaultZoom = 72;
|
||||
const int DefaultZoom = game_config::tile_size;
|
||||
const int SmallZoom = DefaultZoom / 2;
|
||||
|
||||
const int MinZoom = 4;
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "terrain_translation.hpp"
|
||||
|
||||
namespace {
|
||||
static std::vector<std::string> saved_windows_;
|
||||
}
|
||||
|
@ -469,7 +471,11 @@ int context_manager::add_map_context(map_context* mc)
|
|||
void context_manager::create_default_context()
|
||||
{
|
||||
if(saved_windows_.empty()) {
|
||||
map_context* mc = new map_context(editor_map(game_config_, 44, 33, t_translation::GRASS_LAND), gui_);
|
||||
|
||||
t_translation::t_terrain default_terrain =
|
||||
t_translation::read_terrain_code(game_config::default_terrain);
|
||||
|
||||
map_context* mc = new map_context(editor_map(game_config_, 44, 33, default_terrain), gui_);
|
||||
add_map_context(mc);
|
||||
} else {
|
||||
BOOST_FOREACH(const std::string& filename, saved_windows_) {
|
||||
|
|
|
@ -43,10 +43,12 @@ namespace game_config
|
|||
int rest_heal_amount= 2;
|
||||
int recall_cost = 20;
|
||||
int kill_experience = 8;
|
||||
int tile_size = 72;
|
||||
unsigned lobby_network_timer = 100;
|
||||
unsigned lobby_refresh = 4000;
|
||||
const int gold_carryover_percentage = 80;
|
||||
const std::string version = VERSION;
|
||||
std::string default_terrain;
|
||||
#ifdef REVISION
|
||||
const std::string revision = VERSION " (" REVISION ")";
|
||||
#else
|
||||
|
@ -182,6 +184,8 @@ namespace game_config
|
|||
recall_cost = v["recall_cost"].to_int(20);
|
||||
kill_experience = v["kill_experience"].to_int(8);
|
||||
lobby_refresh = v["lobby_refresh"].to_int(2000);
|
||||
default_terrain = v["default_terrain"].str();
|
||||
tile_size = v["tile_size"].to_int(72);
|
||||
|
||||
title_music = v["title_music"].str();
|
||||
lobby_music = v["lobby_music"].str();
|
||||
|
|
|
@ -36,10 +36,12 @@ namespace game_config
|
|||
extern int rest_heal_amount;
|
||||
extern int recall_cost;
|
||||
extern int kill_experience;
|
||||
extern int tile_size;
|
||||
extern unsigned lobby_network_timer;
|
||||
extern unsigned lobby_refresh;
|
||||
extern const std::string version;
|
||||
extern const std::string revision;
|
||||
extern std::string default_terrain;
|
||||
|
||||
inline int kill_xp(int level)
|
||||
{
|
||||
|
|
|
@ -19,12 +19,13 @@
|
|||
#include "map_location.hpp"
|
||||
#include "sdl_utils.hpp"
|
||||
#include "terrain_translation.hpp"
|
||||
#include "game_config.hpp"
|
||||
|
||||
///this module manages the cache of images. With an image name, you can get
|
||||
///the surface corresponding to that image.
|
||||
//
|
||||
namespace image {
|
||||
const int tile_size = 72;
|
||||
const int tile_size = game_config::tile_size;
|
||||
|
||||
template<typename T>
|
||||
class cache_type;
|
||||
|
|
Loading…
Add table
Reference in a new issue