added image flip function, as requested by Eleazar ;)

This commit is contained in:
Patrick Parker 2007-02-15 03:44:36 +00:00
parent 62ae38c38b
commit 4df11b9720
2 changed files with 18 additions and 1 deletions

View file

@ -181,6 +181,7 @@ Version 1.3-svn:
image.
* added fourth color in team_rgb definitions for representative color in
minimap
* added a horizontal/vertical flip function to ImagePathWML
* added a 'hide_help' key that prevents a unit type from being listed in the
in-game help (bug #5701)
* added an 'allow_new_game' key (default=yes) to prevent [multiplayer]

View file

@ -313,6 +313,8 @@ surface locator::load_image_sub_file() const
}
if(val_.modifications_.size()){
bool xflip = false;
bool yflip = false;
std::map<Uint32, Uint32> recolor_map;
std::vector<std::string> modlist = utils::paranthetical_split(val_.modifications_,'~');
for(std::vector<std::string>::const_iterator i=modlist.begin();
@ -346,7 +348,7 @@ surface locator::load_image_sub_file() const
field= f2 + ">" + f1;
}
}
if("RC" == function){
if("RC" == function){ //re-color function
std::vector<std::string> recolor=utils::split(field,'>');
if(recolor.size()>1){
std::map<std::string, color_range>::const_iterator nc = game_config::team_rgb_range.find(recolor[1]);
@ -360,9 +362,23 @@ surface locator::load_image_sub_file() const
}
}
}
if("FL" == function){ //flip layer
if(field.empty() || field.find("horiz") != std::string::npos) {
xflip = !xflip;
}
if(field.find("vert") != std::string::npos) {
yflip = !yflip;
}
}
}
}
surf = recolor_image(surf,recolor_map);
if(xflip) {
surf = flip_surface(surf);
}
if(yflip) {
surf = flop_surface(surf);
}
}
return surf;
}