added new halo effect to Delfador's attack.

Improved village naming in random maps
This commit is contained in:
Dave White 2004-05-28 20:38:37 +00:00
parent 8b155aa667
commit 56af8182f5
18 changed files with 326 additions and 158 deletions

View file

@ -20,11 +20,6 @@ male_names="Erang,Bugdish,Eradash,Vrigor,Gruol,Gugdush,Gort,Grunk,Rurag,Poshnak,
male_names="Althaas,Burin,Glomin,Glamcatus,Trithaithis,Gomdrol,Andurus,Pelaithol,Trithaithus,Andris,Trithatsol,Gomcatis,Pelcatol,Augcatil,Alating,Augaithing,Anthaas,Gomaithsol,Trithaithas,Aigdris,Althalos,Analil,Trithdurol,Glamcatil,Augthail,Trithduril,Dulthalos,Glamthasol,Aldrsol,Glamaithol,Glamalil,Analus,Nardril,Augating,Dulaithsol,Aldrlos,Alalus,Aigcatsol,Ancatas,Trithdris,Pelatol,Aigthasil,Anthais,Narcatis,Trithatil,Aigaithing,Althail,Trithaithil,Naraithol,Duldrlos,Gomatas,Alcatis,Naraithsil,Althalos,Aigdursol,Glamalsil,Nardrus,Aigalis,Aldurlos,Augcatsil,Aigthaing,Augduril,Aigaithas,Anthais,Glamthaas,Dulcatsol,Gomatil,Gomcatlos,Augdrsil,Trithdril,Duldrsil,Duldrol,Peldrsol,Pelalsol,Gomthaas,Dulcatsil,Aigcating,Aldril,Glamcating,Anatsol,Augdris,Anthasol,Glamcatsil,Aldras,Aigatsol,Naraithol,Anthaus,Gomdrsil,Pelalis,Gomatlos,Narcating,Trithdrlos,Aigdrlos,Narcatsil,Glamdras,Aigthaing,Gomcatil,Andurus,Pelthail,Triththaus,Augalas,Alalol,Aigalas,Pelatis,Anating,Alaithsol,Andrus,Aigalsil,Dulatil,Aigdris,Augatsil,Glamduring,Trithduril,Trithdrsol,Alalus,Glamatus,Aldrol,Glamdril,Pelcatsil,Glamaithis,Trithdring,Peldril,Trithdurus,Gomaithil,Trithcatsol,Glamdrsol,Augthais,Dulaithlos,Althasil,Aigaithil,Andrlos,Dulatil,Dulalas,Dulatsol,Analol,Trithcatlos,Althasol,Alcatis,Glamduril,Peldursol,Pelalus,Glamthaas,Aldurol,Aigatsil,Aigatus,Trithduril,Pelaithsol,Aigcatis,Andursol,Naralsil,Althaol,Aldrsol,Dulalas,Triththaas,Augatol,Pelaling,Dulcatlos,Augduril,Glamthaol,Ancatus,Augcatol,Peldrus,Pelatil,Gomcatil,Anallos,Anaithing,Naraithsil,Aldris,Gomdris,Andril,Naratsil,Aigcating,Triththaas,Narduril,Aigdurlos,Aigaithol,Glamaithol,Pelatil,Nardris,Augthaol,Augatol,Glamallos,Anthaing,Aigcatis,Pelthasil,Dulcatil,Dulatol,Dulduring,Alalil,Peldrus,Gomdursil,Nardras,Peldril,Gomcatlos,Gomalis,Glamthaus,Duldurus,Dulcating,Anatol,Augdrsil,Analsil,Trithdrus,Augaithus,Trithaithsol,Aigcatus,Augaling,Alating,Glamatil,Anaithus,Gomatis,Augdris,Pelaithing,Augaithing,Gomdursol,Naraithus,Trithatsol,Ancatil,Glamaithil,Augdurus,Gomalus,Aigduras,Nardrol,Nardurol,Pelalil,Gomalil,Aigatis,Analil,Dulthaus,Gomaithil,Alduras,Trithduril,Ancatol,Alduras,Pelduril,Narcatsol,Pelating,Dulcatsil,Augatol,Glamthasil,Gomthasol,Naraithsil,Alatsil,Dulcatol,Gomthalos,Aigaling,Aigcatas,Pelalus,Augcatsil,Trithatas,Aigthais,Gomaithas,Alcatsil,Ancatus,Pelatis,Ancatas,Dulating,Gomdras,Naraithsol,Augcatis,Alaithis,Pelalsol,Duldursil,Pelcating,Dulaling,Gomating,Aigaithol,Alaithas,Peldras,Triththaing,Augdurol,Augaithas,Augcatsil,Glamdrlos,Peldurol,Aigdris,Pelaithas,Augcatas,Alalas,Anthaing,Naratlos,Augdursol,Gomdril,Dulcatlos,Anthasil,Triththasol,Naralus,Pelthaas,Augcatsil,Anaithis,Andurus,Gomdring,Glamduras,Pelalsil,Augthalos,Augduras,Pelaling,Gomalis,Augalol,Gomdris,Glamalis,Augdrus,Alatlos,Trithdril,Augthalos,Glamdril,Aigatlos,Alatas,Pelaithsol,Anthaus,Trithdril,Aldrsol,Triththail,Glamaithsol,Augduring,Aigthaus,Anaithsil,Pelatus,Naratol,Glamalsil,Trithcatus,Trithatil,Anallos,Augdras,Trithaithsil,Narduril,Dulatsol,Naralus,Narcatol,Alcatlos,Trithalol,Dulthasil,Andrus,Pelduring,Naraithil,Aigatsil,Trithdurlos,Augdursol,Trithaithol,Gomatol,Aigcatas,Pelcatlos,Glamduris,Anaithas,Peldurus,Glamduris,Naralil,Trithdursil,Pelthasil,Gomatis,Aldril,Augatol,Anaithus,Anatsol,Trithaithlos,Duldrus,Narduras,Dulaithlos,Duldris,Dulaithsil,Anthais,Gomduris,Narthalos,Ancatus,Anduril,Alaithol,Aigalis,Trithaithas,Aigcatil,Trithaithil,Naraithing,Augatsol,Trithaithol,Dulalsil,Dulthasol,Glamcatas,Glamthaol,Gomaithsol,Dulaithing,Naratlos,Naraithol,Gomthasol,Ancatas,Aigcatsil,Pelduris,Trithdrus,Andurus,Trithdring,Glamthaas,Aigcating,Nardrsol,Glamaithol,Dulaithsol,Althaus,Augduras,Aigaithas,Gomdurlos,Glamalus,Gomdrsil,Trithdrol,Pelating,Pelatus,Aigdrsol,Trithdurol,Glamaling,Dulduras,Dulating,Naraithing,Dulalis,Alaithus,Gomdurus,Glamcatus,Trithduring,Anatis,Anaithsil,Glamduril,Gomdursol,Narcatol,Trithaithis,Naratlos,Nardring,Aigalol,Althail,Anatas,Anthasol,Aigatus,Dulaithil,Althalos,Aldring,Glamalil,Anating,Aigdring,Duldril,Andurol,Pelaithsil,Gomdurus,Gomcatil,Glamthaas,Alalsol,Augdurus,Trithduril,Anthaol,Augalas,Pelcatol,Nardrsil,Alatil,Glamdrsol,Alaithlos,Pelatsil,Gomdurus,Dulatus,Alalsol,Glamaling,Dulatus,Alcatil,Aigthaus,Duldril,Pelaithlos,Pelaithis,Dulatil,Trithalis,Naraithol,Pelating,Augcatol,Gomatis,Andrus,Pelduris,Aigdrsil,Alatlos,Augdrsil,Anduril,Gomaithol,Glamdursol,Trithaithil,Gomdril,Glamcatil,Trithdrus,Naralas,Dulatol,Anaithil,Anatol,Augating,Peldursol,Narcatis,Glamatus,Aigaithas,Aigatas,Trithatlos,Gomatil,Gomthalos,Dulaling,Aigatsil,Augcatus,Trithaithus,Gomcatlos,Aigaithol,Naratsil,Narthaol,Narcatol,Augatlos,Pelaithil,Gomaithsol,Augaithsil"
#enddef
#define ORCISH_NAMES
male_names="Snamuuga,Knafakhan,Urgtelfar,Maganafa,Gagabreuk,Gruumogth,Muknafa,Snagakhan"
#enddef
#define VILLAGE_NAMES
male_names="
Th'Lath,Tu'Kach,Tu'Kath,Th'Skalich,Ta'Tel,T'Oos,Thu'Teer,Na'Tal,Ch'Las,Gre'Bach,Thu'Ror,Ta'Mach,Do'Ooch,Gre'Vykk,Th'Lel,G'Ten,So'Bath,Re'Goch,Th'Vyk,Ch'Teek,Th'Goch,Na'Bach,So'Ster,So'Nor,Ch'Teech,Thu'Thol,Sh'Rok,Sh'Voth,T'Quok,Na'Tath,Do'Thon,Ch'Man,Re'Lal,So'Lech,T'Makk,Sh'Both,Tu'Ralal,Do'Bon,Sh'Tees,Th'Goch,Ch'Ralak,Na'Stek,Mak'Vakk,Ch'Gan,Ch'Len,Ch'Mos,Ch'Koch,Mak'Noch,Mak'Lok,Thu'Kol,Do'Stoth,T'Mach,Na'Dor,Ch'Loth,Th'Qual,Mak'Stor,Sh'Quas,Mak'Skakk,Mak'Kar,Mak'Ror,Gre'Bakk,So'Shath,So'Bon,Re'Sten,Ta'Gak,Sh'Kan,Th'Tan,Sh'Nal,Ta'Gol,Ch'Goch,Do'Mas,Th'Ralas,Tu'Vakk,Th'Kal,Tu'Mol,Th'Bon,Re'Thos,Tu'Shalich,So'Kach,G'Dal,G'Boch,Na'Path,Sh'Man,So'Pak,Do'Doth,Re'Teeth,Thu'Mol,G'Skak,Ta'Ooch,Sh'Toth,G'Gok,Do'Tor,Thu'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="Ox,Hol,Il,Del,El,York,Corn,Hel,Sel,Sil,Sal,Bal,Water,Sen,Sed,Hex,Hox,Fox,Bal,Wet,Earl,Fren,Kin,Tal,Gel,Nam,Sam,Jam,Olf,Old,New,Ol,Nes,Jim,Cam"
#enddef

View file

@ -250,7 +250,7 @@ road_windiness=3
[/castle]
[naming]
{HUMAN_NAMES}
{VILLAGE_NAMES}
[/naming]
[village_naming]

View file

@ -687,6 +687,13 @@ road_name="$name's Highway,$name's Pass,Path of $name"
river_name="$name River,River $name"
forest_name="$name Forest,$name's Forest"
lake_name="$name Lake"
village_name="$name|bury,$name|ham,$name|ton"
village_name_river="$name|ham,$name|ford,$name|cross,$river|ford,$river|cross"
village_name_river_bridge="$river|bridge,$river|bridge,$river|bridge,$name|ham,$name|bridge"
village_name_grassland="$name|ham,$name|ton,$name|field"
village_name_forest="$name|ham,$name|ton,$name|wood,$name Forest"
village_name_hill="$name|ham,$name|bury,$name|ton,$name|hill,$name|crest"
village_name_mountain="$name|ham,$name|bury,$name|ton,$name|mont,$name|mont,$name|cliff,$name|cliff"
#Li'sar is always meant to be 'Princess' no matter what level she is on
BattlePrincess="Princess"

View file

@ -38,50 +38,24 @@ unit_description="Oncegreat, Elder Mages have seen their power a little diminish
icon=misc/lightingbolt.png
[frame]
begin=-300
end=-250
image=elder-mage-attack.png
halo=halo/elder-mage-halo1.png
halo_x,halo_y=13,-26
[/frame]
[frame]
begin=-250
end=-200
image=elder-mage-attack.png
halo=halo/elder-mage-halo2.png
halo_x,halo_y=13,-26
[/frame]
[frame]
begin=-200
end=-150
image=elder-mage-attack.png
halo=halo/elder-mage-halo3.png
halo_x,halo_y=13,-26
[/frame]
[frame]
begin=-150
end=-100
image=elder-mage-attack.png
halo=halo/elder-mage-halo4.png
halo_x,halo_y=13,-26
[/frame]
[frame]
begin=-100
end=-50
image=elder-mage-attack.png
halo=halo/elder-mage-halo5.png
halo_x,halo_y=13,-26
[/frame]
[frame]
begin=-50
end=0
image=elder-mage-attack.png
halo=halo/elder-mage-halo6.png
halo_x,halo_y=13,-26
halo=halo/elder-mage-halo1.png,halo/elder-mage-halo2.png,halo/elder-mage-halo3.png,halo/elder-mage-halo4.png,halo/elder-mage-halo5.png,halo/elder-mage-halo6.png
halo_x,halo_y=23,-376
[/frame]
[frame]
begin=0
end=50
image=elder-mage-attack.png
halo=halo/elder-mage-halo5.png
halo_x,halo_y=23,-376
[/frame]
[frame]
begin=50
end=100
image=elder-mage.png
halo=halo/elder-mage-halo3.png
halo_x,halo_y=23,-376
[/frame]
[sound]
time=-200
@ -92,7 +66,7 @@ unit_description="Oncegreat, Elder Mages have seen their power a little diminish
end=0
image=lightning-n.png
image_diagonal=lightning-ne.png
halo=halo/elder-mage-halo6.png
halo=halo/elder-mage-halo7.png
halo_x,halo_y=13,-26
[/missile_frame]
[/attack]

View file

@ -43,74 +43,15 @@ get_hit_sound=groan.wav
[/sound]
[frame]
begin=-450
end=-400
image=mage-attack1.png
halo=halo/mage-halo1.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-400
end=-350
image=mage-attack1.png
halo=halo/mage-halo2.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-350
end=-300
image=mage-attack1.png
halo=halo/mage-halo3.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-300
end=-250
image=mage-attack2.png
halo=halo/mage-halo4.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-250
end=-200
image=mage-attack2.png
halo=halo/mage-halo5.png
halo_x,halo_y=10,-10
[/frame]
#exactly the same as the last frame, but now the missile
#has been launched, and so we don't have a halo
[frame]
begin=-200
end=-150
image=mage-attack2.png
halo=halo/mage-halo6.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=-150
end=-100
image=mage-attack3.png
halo=halo/mage-halo7.png
halo_x,halo_y=10,-14
[/frame]
[frame]
begin=-100
end=-50
image=mage-attack3.png
halo=halo/mage-halo8.png
halo_x,halo_y=10,-14
[/frame]
[frame]
begin=-50
end=0
image=mage-attack3.png
halo=halo/mage-halo9.png
halo_x,halo_y=10,-14
image=mage-attack1.png
halo=halo/mage-halo1.png,halo/mage-halo2.png,halo/mage-halo3.png,halo/mage-halo4.png,halo/mage-halo5.png,halo/mage-halo6.png,halo/mage-halo7.png,halo/mage-halo8.png,halo/mage-halo9.png
halo_x,halo_y=10,-10
[/frame]
[frame]
begin=0
end=50
image=mage-attack3.png
image=mage-attack1.png
[/frame]
[missile_frame]
begin=-200

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -1353,6 +1353,10 @@ std::string config::interpolate_variables_into_string(const std::string& str, co
{
std::string res = str;
do_interpolation(res,0,symbols);
//remove any pipes in the string, as they are used simply to seperate variables
res.erase(std::remove(res.begin(),res.end(),'|'),res.end());
return res;
}

View file

@ -1031,7 +1031,7 @@ void display::draw_halo_on_tile(int x, int y)
const halo_map::iterator halo_it = haloes_.find(loc);
//see if there is a unit on this tile
const unit_map::const_iterator it = units_.find(gamemap::location(x,y));
const unit_map::const_iterator it = fogged(x,y) ? units_.end() : units_.find(gamemap::location(x,y));
if(halo_it != haloes_.end() && it == units_.end()) {
halo::remove(halo_it->second);

View file

@ -1,7 +1,9 @@
#include "halo.hpp"
#include "image.hpp"
#include "sdl_utils.hpp"
#include "util.hpp"
#include <algorithm>
#include <cassert>
#include <map>
@ -16,13 +18,40 @@ class effect
public:
effect(int xpos, int ypos, const std::string& img);
void set_location(int x, int y);
void render();
void unrender();
private:
const std::string& current_image();
void rezoom();
std::string image_;
struct frame {
frame() : time(50) {}
frame(const std::string& str) : time(50) {
if(std::find(str.begin(),str.end(),':') != str.end()) {
const std::vector<std::string>& items = config::split(str,':');
if(items.size() > 1) {
file = items.front();
time = lexical_cast<int>(items.back());
return;
}
}
file = str;
}
int time;
std::string file;
};
std::vector<frame> images_;
std::string current_image_;
int start_cycle_, cycle_time_;
int x_, y_;
double zoom_;
shared_sdl_surface surf_, buffer_;
@ -37,17 +66,56 @@ bool hide_halo = false;
static const SDL_Rect empty_rect = {0,0,0,0};
effect::effect(int xpos, int ypos, const std::string& img)
: image_(img), x_(xpos), y_(ypos), zoom_(disp->zoom()), surf_(NULL), buffer_(NULL), rect_(empty_rect)
: start_cycle_(-1), cycle_time_(50), x_(xpos), y_(ypos), zoom_(disp->zoom()), surf_(NULL), buffer_(NULL), rect_(empty_rect)
{
if(std::find(img.begin(),img.end(),',') != img.end()) {
const std::vector<std::string>& imgs = config::split(img,',');
images_.resize(imgs.size());
std::copy(imgs.begin(),imgs.end(),images_.begin());
cycle_time_ = 0;
for(std::vector<frame>::const_iterator i = images_.begin(); i != images_.end(); ++i) {
cycle_time_ += i->time;
}
}
if(images_.empty()) {
images_.push_back(img);
}
assert(disp != NULL);
const gamemap::location zero_loc(0,0);
x_ -= disp->get_location_x(zero_loc);
y_ -= disp->get_location_y(zero_loc);
set_location(xpos,ypos);
current_image_ = images_.front().file;
rezoom();
}
void effect::set_location(int x, int y)
{
const gamemap::location zero_loc(0,0);
x_ = x - disp->get_location_x(zero_loc);
y_ = y - disp->get_location_y(zero_loc);
}
const std::string& effect::current_image()
{
assert(!images_.empty());
if(images_.size() == 1 || cycle_time_ <= 0) {
return images_.front().file;
} else {
int current_time = (SDL_GetTicks() - start_cycle_)%cycle_time_;
for(std::vector<frame>::const_iterator i = images_.begin(); i != images_.end(); ++i) {
current_time -= i->time;
if(current_time < 0) {
return i->file;
}
}
}
return images_.front().file;
}
void effect::rezoom()
{
const double new_zoom = disp->zoom();
@ -56,7 +124,7 @@ void effect::rezoom()
zoom_ = new_zoom;
surf_.assign(image::get_image(image_,image::UNSCALED));
surf_.assign(image::get_image(current_image_,image::UNSCALED));
if(surf_ != NULL && zoom_ != 1.0) {
surf_.assign(scale_surface(surf_,surf_->w*zoom_,surf_->h*zoom_));
}
@ -64,11 +132,17 @@ void effect::rezoom()
void effect::render()
{
if(disp == NULL || surf_ == NULL) {
if(disp == NULL) {
return;
}
if(zoom_ != disp->zoom()) {
if(start_cycle_ == -1) {
start_cycle_ = SDL_GetTicks();
}
const std::string& img = current_image();
if(surf_ == NULL || zoom_ != disp->zoom() || current_image_ != img) {
current_image_ = img;
rezoom();
}
@ -152,6 +226,14 @@ int add(int x, int y, const std::string& image)
return id;
}
void set_location(int handle, int x, int y)
{
const std::map<int,effect>::iterator itor = haloes.find(handle);
if(itor != haloes.end()) {
itor->second.set_location(x,y);
}
}
void remove(int handle)
{
haloes.erase(handle);

View file

@ -30,6 +30,10 @@ private:
///returns the handle to the halo object
int add(int x, int y, const std::string& image);
///function to set the position of an existing haloing
///effect, according to its handle
void set_location(int handle, int x, int y);
///function to remove the halo with the given handle
void remove(int handle);

View file

@ -527,15 +527,23 @@ gamemap::location place_village(const std::vector<std::vector<gamemap::TERRAIN>
return best_loc;
}
std::string generate_name(const unit_race& name_generator, const std::string& id)
std::string generate_name(const unit_race& name_generator, const std::string& id, std::string* base_name=NULL,
std::map<std::string,std::string>* additional_symbols=NULL)
{
const std::vector<std::string>& options = config::split(string_table[id]);
if(options.empty() == false) {
const size_t choice = rand()%options.size();
const std::string& name = name_generator.generate_name(unit_race::MALE);
if(base_name != NULL) {
*base_name = name;
}
std::map<std::string,std::string> table;
table["name"] = name;
return config::interpolate_variables_into_string(options[choice],&table);
if(additional_symbols == NULL) {
additional_symbols = &table;
}
(*additional_symbols)["name"] = name;
return config::interpolate_variables_into_string(options[choice],additional_symbols);
}
return "";
@ -700,6 +708,8 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
//We will also attempt to source a river from each lake.
std::set<location> lake_locs;
std::map<location,std::string> river_names, lake_names;
const int nlakes = max_lakes > 0 ? (rand()%max_lakes) : 0;
for(size_t lake = 0; lake != nlakes; ++lake) {
for(int tries = 0; tries != 100; ++tries) {
@ -709,12 +719,18 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
const std::vector<location> river = generate_river(heights,terrain,x,y,atoi(cfg["river_frequency"].c_str()));
if(river.empty() == false && labels != NULL) {
const std::string& name = generate_name(name_generator,"river_name");
std::string base_name;
const std::string& name = generate_name(name_generator,"river_name",&base_name);
size_t name_frequency = 20;
for(std::vector<location>::const_iterator r = river.begin(); r != river.end(); ++r) {
const gamemap::location loc(r->x-width/3,r->y-height/3);
if(((r - river.begin())%name_frequency) == name_frequency/2) {
labels->insert(std::pair<gamemap::location,std::string>(gamemap::location(r->x-width/3,r->y-height/3),name));
labels->insert(std::pair<gamemap::location,std::string>(loc,name));
}
river_names.insert(std::pair<location,std::string>(loc,base_name));
}
}
@ -723,22 +739,38 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
if(res && labels != NULL) {
bool touches_other_lake = false;
std::string base_name;
const std::string& name = generate_name(name_generator,"lake_name",&base_name);
std::set<location>::const_iterator i;
//only generate a name if the lake hasn't touched any other lakes, so that we
//don't end up with one big lake with multiple names
for(std::set<location>::const_iterator i = locs.begin(); i != locs.end(); ++i) {
for(i = locs.begin(); i != locs.end(); ++i) {
if(lake_locs.count(*i) != 0) {
touches_other_lake = true;
//reassign the name of this lake to be the same as the other lake
const location loc(i->x-width/3,i->y-height/3);
const std::map<location,std::string>::const_iterator other_name = lake_names.find(loc);
if(other_name != lake_names.end()) {
base_name = other_name->second;
}
}
lake_locs.insert(*i);
}
if(!touches_other_lake) {
const std::string& name = generate_name(name_generator,"lake_name");
const gamemap::location loc(x-width/3,y-height/3);
labels->erase(loc);
labels->insert(std::pair<gamemap::location,std::string>(loc,name));
}
for(i = locs.begin(); i != locs.end(); ++i) {
const location loc(i->x-width/3,i->y-height/3);
lake_names.insert(std::pair<location,std::string>(*i,base_name));
}
}
break;
@ -861,6 +893,8 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
nroads += castles.size()*castles.size();
}
std::set<location> bridges;
road_path_calculator calc(terrain,cfg);
const road_path_calculator_wrapper calc_wrapper(calc);
for(size_t road = 0; road != nroads; ++road) {
@ -961,7 +995,9 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
if(labels != NULL && on_bridge == false) {
on_bridge = true;
const std::string& name = generate_name(name_generator,"bridge_name");
labels->insert(std::pair<gamemap::location,std::string>(gamemap::location(x-width/3,y-height/3),name));
const location loc(x-width/3,y-height/3);
labels->insert(std::pair<gamemap::location,std::string>(loc,name));
bridges.insert(loc);
}
if(direction != -1) {
@ -1039,6 +1075,8 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
(*village_ptr)++;
village_ptr = (village_ptr == &village_x ? &village_y : &village_x);
}
std::set<std::string> used_names;
for(size_t vx = 0; vx < width; vx += village_x) {
for(size_t vy = rand()%village_y; vy < height; vy += village_y) {
@ -1060,7 +1098,71 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
if(labels != NULL && naming_cfg.empty() == false) {
const gamemap::location loc(res.x-width/3,res.y-height/3);
labels->insert(std::pair<gamemap::location,std::string>(loc,village_names_generator.generate_name(unit_race::MALE)));
gamemap::location adj[6];
get_adjacent_tiles(loc,adj);
std::string name_type = "village_name";
const std::string field = "g", forest = "f", mountain = "m", hill = "h";
size_t field_count = 0, forest_count = 0, mountain_count = 0, hill_count = 0;
std::map<std::string,std::string> symbols;
size_t n;
for(n = 0; n != 6; ++n) {
const std::map<location,std::string>::const_iterator river_name = river_names.find(adj[n]);
if(river_name != river_names.end()) {
symbols["river"] = river_name->second;
name_type = "village_name_river";
if(bridges.count(loc)) {
name_type = "village_name_river_bridge";
}
break;
}
const std::map<location,std::string>::const_iterator lake_name = lake_names.find(adj[n]);
if(lake_name != lake_names.end()) {
symbols["lake"] = lake_name->second;
name_type = "village_name_lake";
break;
}
const gamemap::TERRAIN terr = terrain[adj[n].x+width/3][adj[n].y+height/3];
if(std::count(field.begin(),field.end(),terr) > 0) {
++field_count;
} else if(std::count(forest.begin(),forest.end(),terr) > 0) {
++forest_count;
} else if(std::count(hill.begin(),hill.end(),terr) > 0) {
++hill_count;
} else if(std::count(mountain.begin(),mountain.end(),terr) > 0) {
++mountain_count;
}
}
if(n == 6) {
if(field_count == 6) {
name_type = "village_name_grassland";
} else if(forest_count >= 2) {
name_type = "village_name_forest";
} else if(mountain_count >= 1) {
name_type = "village_name_mountain";
} else if(hill_count >= 2) {
name_type = "village_name_hill";
}
}
std::string name;
for(size_t ntry = 0; ntry != 30 && (ntry == 0 || used_names.count(name) > 0); ++ntry) {
name = generate_name(village_names_generator,name_type,NULL,&symbols);
}
used_names.insert(name);
labels->insert(std::pair<gamemap::location,std::string>(loc,name));
}
}
}

View file

@ -117,7 +117,7 @@ void move_unit_between(display& disp, const gamemap& map, const gamemap::locatio
disp.draw_unit(xpos,ypos,image,false,1.0,0,submerge);
util::scoped_resource<int,halo::remover> halo_effect(0);
if(halo.empty() == false) {
if(halo.empty() == false && !disp.fogged(b.x,b.y)) {
halo_effect.assign(halo::add(xpos+disp.hex_width()/2,ypos+disp.hex_size()/2,halo));
}
@ -259,6 +259,11 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
int ticks = SDL_GetTicks();
bool shown_label = false;
util::scoped_resource<int,halo::remover> missile_halo_effect(0), unit_halo_effect(0);
const std::string* missile_halo_image = NULL;
const std::string* unit_halo_image = NULL;
int missile_halo_x = -1, missile_halo_y = -1, unit_halo_x = -1, unit_halo_y = -1;
for(int i = begin_at; i < end_at; i += time_resolution*acceleration) {
events::pump();
@ -279,19 +284,25 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
played_hit_sound = true;
}
util::scoped_resource<int,halo::remover> unit_halo_effect(0);
const std::string* unit_halo = NULL;
int halo_x = 0, halo_y = 0;
const std::string* unit_image = attack.get_frame(i,NULL,attack_type::UNIT_FRAME,attack_type::VERTICAL,&unit_halo,&halo_x,&halo_y);
if(unit_halo != NULL) {
if(att->second.facing_left() == false) {
halo_x *= -1;
}
unit_halo_effect.assign(halo::add(disp.get_location_x(a)+disp.hex_width()/2 + halo_x*disp.zoom(),disp.get_location_y(a)+disp.hex_size()/2 + halo_y*disp.zoom(),*unit_halo));
const std::string* new_halo = NULL;
int new_halo_x = 0, new_halo_y = 0;
const std::string* unit_image = attack.get_frame(i,NULL,attack_type::UNIT_FRAME,attack_type::VERTICAL,&new_halo,&new_halo_x,&new_halo_y);
if(att->second.facing_left() == false) {
new_halo_x *= -1;
}
if(unit_halo_image != new_halo || unit_halo_x != new_halo_x || unit_halo_y != new_halo_y) {
unit_halo_image = new_halo;
unit_halo_x = new_halo_x;
unit_halo_y = new_halo_y;
if(unit_halo_image != NULL && !disp.fogged(a.x,a.y)) {
unit_halo_effect.assign(halo::add(disp.get_location_x(a)+disp.hex_width()/2 + unit_halo_x*disp.zoom(),disp.get_location_y(a)+disp.hex_size()/2 + unit_halo_y*disp.zoom(),*unit_halo_image));
} else {
unit_halo_effect.assign(0);
}
}
if(unit_image == NULL) {
unit_image = &att->second.type().image_fighting(attack_type::LONG_RANGE);
@ -337,22 +348,20 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
disp.draw_tile(leader_loc.x,leader_loc.y);
}
util::scoped_resource<int,halo::remover> halo_effect(0);
if(i >= 0 && i < real_last_missile && !hide) {
const int missile_frame = i + first_missile;
const std::string* halo_image = NULL;
int halo_x = 0, halo_y = 0;
const std::string* new_halo = NULL;
int new_halo_x = 0, new_halo_y = 0;
const std::string* missile_image = attack.get_frame(missile_frame,NULL,
attack_type::MISSILE_FRAME,dir,&halo_image,&halo_x,&halo_y);
attack_type::MISSILE_FRAME,dir,&new_halo,&new_halo_x,&new_halo_y);
if(att->second.facing_left() == false) {
halo_x *= -1;
new_halo_x *= -1;
}
halo_x *= disp.zoom();
halo_y *= disp.zoom();
new_halo_x *= disp.zoom();
new_halo_y *= disp.zoom();
static const std::string default_missile(game_config::missile_n_image);
static const std::string default_diag_missile(game_config::missile_ne_image);
@ -374,15 +383,30 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
pos = 0.0;
}
const int xpos = int((xsrc+halo_x)*pos + xdst*(1.0-pos));
const int ypos = int((ysrc+halo_y)*pos + ydst*(1.0-pos));
const int xpos = int((xsrc+new_halo_x)*pos + xdst*(1.0-pos));
const int ypos = int((ysrc+new_halo_y)*pos + ydst*(1.0-pos));
if(img != NULL) {
disp.draw_unit(xpos,ypos,img,vflip);
}
if(halo_image != NULL) {
halo_effect.assign(halo::add(xpos+disp.hex_width()/2,ypos+disp.hex_size()/2,*halo_image));
const int halo_xpos = xpos+disp.hex_width()/2;
const int halo_ypos = ypos+disp.hex_size()/2;
if(missile_halo_image != new_halo || missile_halo_x != new_halo_x || missile_halo_y != new_halo_y) {
missile_halo_image = new_halo;
missile_halo_x = new_halo_x;
missile_halo_y = new_halo_y;
if(missile_halo_image != NULL && !disp.fogged(b.x,b.y)) {
missile_halo_effect.assign(halo::add(halo_xpos,halo_ypos,*missile_halo_image));
} else {
missile_halo_effect.assign(0);
}
}
else if(missile_halo_effect != 0) {
halo::set_location(missile_halo_effect,halo_xpos,halo_ypos);
}
}
@ -399,6 +423,9 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
disp.update_display();
}
unit_halo_effect.assign(0);
missile_halo_effect.assign(0);
if(damage > 0 && def->second.gets_hit(damage)) {
dead = true;
damage = 0;
@ -543,6 +570,10 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
bool shown_label = false;
util::scoped_resource<int,halo::remover> halo_effect(0);
const std::string* halo_image = NULL;
int halo_x = -1, halo_y = -1;
for(int i = begin_at; i < end_at; i += time_resolution*acceleration) {
events::pump();
@ -596,18 +627,19 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
disp.draw_tile(leader_loc.x,leader_loc.y);
}
const std::string* halo_image = NULL;
int halo_x = 0, halo_y = 0;
const std::string* new_halo_image = NULL;
int new_halo_x = 0, new_halo_y = 0;
int xoffset = 0;
const std::string* unit_image = attack.get_frame(i,&xoffset,attack_type::UNIT_FRAME,attack_type::VERTICAL,
&halo_image,&halo_x,&halo_y);
&new_halo_image,&new_halo_x,&new_halo_y);
if(!attacker.facing_left()) {
xoffset *= -1;
halo_x *= -1;
new_halo_x *= -1;
}
halo_x *= disp.zoom();
new_halo_x *= disp.zoom();
xoffset = int(double(xoffset)*disp.zoom());
@ -624,9 +656,22 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
const int posx = int(pos*xsrc + (1.0-pos)*xdst) + xoffset;
const int posy = int(pos*ysrc + (1.0-pos)*ydst);
util::scoped_resource<int,halo::remover> halo_effect(0);
if(halo_image != NULL) {
halo_effect.assign(halo::add(posx+disp.hex_width()/2,posy+disp.hex_size()/2,*halo_image));
const int halo_xpos = posx+disp.hex_width()/2;
const int halo_ypos = posy+disp.hex_size()/2;
if(new_halo_image != halo_image || new_halo_x != halo_x || new_halo_y != halo_y) {
halo_image = new_halo_image;
halo_x = new_halo_x;
halo_y = new_halo_y;
if(halo_image != NULL && (!disp.fogged(b.x,b.y) || !disp.fogged(a.x,a.y))) {
halo_effect.assign(halo::add(halo_xpos,halo_ypos,*halo_image));
} else {
halo_effect.assign(0);
}
}
else if(halo_effect != 0) {
halo::set_location(halo_effect,halo_xpos,halo_ypos);
}
const int height_adjust = int(src_height_adjust*pos + dst_height_adjust*(1.0-pos));
@ -646,6 +691,8 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
disp.update_display();
}
halo_effect.assign(0);
disp.hide_unit(gamemap::location());
if(damage > 0 && def->second.gets_hit(damage)) {

View file

@ -148,6 +148,10 @@ SOURCE=.\src\events.cpp
# End Source File
# Begin Source File
SOURCE=.\src\widgets\file_chooser.cpp
# End Source File
# Begin Source File
SOURCE=.\src\filesystem.cpp
# End Source File
# Begin Source File
@ -172,6 +176,10 @@ SOURCE=.\src\gamestatus.cpp
# End Source File
# Begin Source File
SOURCE=.\src\halo.cpp
# End Source File
# Begin Source File
SOURCE=.\src\hotkeys.cpp
# End Source File
# Begin Source File
@ -420,6 +428,10 @@ SOURCE=.\src\gamestatus.hpp
# End Source File
# Begin Source File
SOURCE=.\src\halo.hpp
# End Source File
# Begin Source File
SOURCE=.\src\hotkeys.hpp
# End Source File
# Begin Source File