have the halo and ellipsis stay in the hex during fight... this is a try
This commit is contained in:
parent
e2ee831731
commit
81108055a4
4 changed files with 25 additions and 38 deletions
|
@ -40,6 +40,8 @@ Version 1.3.2+svn:
|
|||
* fixed incorrect active flag in the satus bar when using custom flag
|
||||
* restore a lost feature : if acceleration is on, pressing shift uses normal speed
|
||||
* fixed bug #9071 (incorrect behavior of the "delete" key at end of line)
|
||||
* fixed various acceleration bugs (things not being properly accelerated)
|
||||
* restored status bars during fights
|
||||
* WML tools and scripts:
|
||||
* New tool, wescamp_import, automates the shuffling of translation
|
||||
files and textdomain strings need to import a campaign from WesCamp
|
||||
|
|
|
@ -2072,16 +2072,9 @@ void display::clear_hex_overlay(const gamemap::location& loc)
|
|||
}
|
||||
|
||||
void display::draw_unit(int x, int y, surface image,
|
||||
bool upside_down, fixed_t alpha, Uint32 blendto, double blend_ratio, double submerged,
|
||||
surface ellipse_back, surface ellipse_front)
|
||||
bool upside_down, fixed_t alpha, Uint32 blendto,
|
||||
double blend_ratio, double submerged)
|
||||
{
|
||||
//calculate the y position of the ellipse. It should be the same as the
|
||||
//y position of the image, unless the image is partially submerged, in
|
||||
//which case the ellipse should appear to float 'on top of' the water
|
||||
const int ellipse_ypos = y - (ellipse_back != NULL && submerged > 0.0 ? int(double(ellipse_back->h)*submerged) : 0)/2;
|
||||
if(ellipse_back != NULL) {
|
||||
draw_unit(x,ellipse_ypos,ellipse_back,false,blendto == 0 ? alpha : ftofxp(1.0),0,0.0);
|
||||
}
|
||||
|
||||
surface surf(image);
|
||||
|
||||
|
@ -2121,9 +2114,6 @@ void display::draw_unit(int x, int y, surface image,
|
|||
video().blit_surface(x,y,surf,&srcrect,&clip_rect);
|
||||
}
|
||||
|
||||
if(ellipse_front != NULL) {
|
||||
draw_unit(x,ellipse_ypos,ellipse_front,false,blendto == 0 ? alpha : ftofxp(1.0),0,0.0);
|
||||
}
|
||||
}
|
||||
|
||||
struct is_energy_colour {
|
||||
|
|
|
@ -291,16 +291,6 @@ public:
|
|||
//function to serialize overlay data
|
||||
void write_overlays(config& cfg) const;
|
||||
|
||||
#if 0
|
||||
//function which draws the details of the unit at the given location, at
|
||||
//(x,y) on-screen. xprofile and yprofile are the size of the unit's image.
|
||||
//this function is suitable for drawing a unit's details on the sidebar,
|
||||
//but can also be used to draw the unit details on a dialog elsewhere on
|
||||
//the screen.
|
||||
void draw_unit_details(int x, int y, const gamemap::location& loc,
|
||||
const unit& u, SDL_Rect& description_rect,
|
||||
int xprofile,int yprofile,SDL_Rect* clip_rect=NULL);
|
||||
#endif
|
||||
|
||||
//function which copies the backbuffer to the framebuffer.
|
||||
void update_display();
|
||||
|
@ -389,9 +379,7 @@ public:
|
|||
void draw_unit(int x, int y, surface image,
|
||||
bool upside_down=false,fixed_t alpha=ftofxp(1.0),
|
||||
Uint32 blendto=0, double blend_ratio=0,
|
||||
double submerged=0.0,
|
||||
surface ellipse_back=surface(NULL),
|
||||
surface ellipse_front=surface(NULL));
|
||||
double submerged=0.0);
|
||||
|
||||
//rebuild the dynamic terrain at the given location.
|
||||
void rebuild_terrain(const gamemap::location &loc)
|
||||
|
|
33
src/unit.cpp
33
src/unit.cpp
|
@ -1750,10 +1750,10 @@ void unit::redraw_unit(display& disp,gamemap::location hex)
|
|||
if(refreshing_) return;
|
||||
refreshing_ = true;
|
||||
const gamemap::location dst= hex.get_direction(facing());
|
||||
const double xsrc = disp.get_location_x(hex);
|
||||
const double ysrc = disp.get_location_y(hex);
|
||||
const double xdst = disp.get_location_x(dst);
|
||||
const double ydst = disp.get_location_y(dst);
|
||||
const int xsrc = disp.get_location_x(hex);
|
||||
const int ysrc = disp.get_location_y(hex);
|
||||
const int xdst = disp.get_location_x(dst);
|
||||
const int ydst = disp.get_location_y(dst);
|
||||
|
||||
|
||||
if(!anim_) set_standing(disp,hex);
|
||||
|
@ -1771,8 +1771,8 @@ void unit::redraw_unit(display& disp,gamemap::location hex)
|
|||
|
||||
double tmp_offset = current_frame.offset(anim_->get_current_frame_time());
|
||||
if(tmp_offset == -20.0) tmp_offset = offset_;
|
||||
const int x = int(tmp_offset*xdst + (1.0-tmp_offset)*xsrc);
|
||||
const int y = int(tmp_offset*ydst + (1.0-tmp_offset)*ysrc);
|
||||
const int x = int(tmp_offset*((double)xdst) + (1.0-tmp_offset)*((double)xsrc));
|
||||
const int y = int(tmp_offset*((double)ydst) + (1.0-tmp_offset)*((double)ysrc));
|
||||
if(frame_begin_time_ != anim_->get_current_frame_begin_time()) {
|
||||
frame_begin_time_ = anim_->get_current_frame_begin_time();
|
||||
if(!current_frame.sound().empty()) {
|
||||
|
@ -1883,14 +1883,21 @@ void unit::redraw_unit(display& disp,gamemap::location hex)
|
|||
tmp_y += (disp.hex_size() - image.get()->h)/2;
|
||||
}
|
||||
|
||||
const int ellipse_ypos = ysrc - (ellipse_back != NULL && submerge > 0.0 ? int(double(ellipse_back->h)*submerge) : 0)/2- height_adjust;
|
||||
disp.video().blit_surface(xsrc,ellipse_ypos,ellipse_back);
|
||||
|
||||
|
||||
disp.draw_unit(tmp_x, tmp_y -height_adjust, image, false, highlight_ratio,
|
||||
blend_with, blend_ratio, submerge,ellipse_back,ellipse_front);
|
||||
blend_with, blend_ratio, submerge);
|
||||
|
||||
|
||||
disp.video().blit_surface(xsrc,ellipse_ypos,ellipse_front);
|
||||
if(unit_halo_ == halo::NO_HALO && !image_halo().empty()) {
|
||||
unit_halo_ = halo::add(0, 0, image_halo(), gamemap::location(-1, -1));
|
||||
}
|
||||
if(unit_halo_ != halo::NO_HALO) {
|
||||
const int d = disp.hex_size() / 2;
|
||||
halo::set_location(unit_halo_, x+ d, y -height_adjust+ d);
|
||||
halo::set_location(unit_halo_, xsrc+ d, ysrc -height_adjust+ d);
|
||||
}
|
||||
|
||||
if(draw_bars_) {
|
||||
|
@ -1918,21 +1925,21 @@ void unit::redraw_unit(display& disp,gamemap::location hex)
|
|||
|
||||
surface orb(image::get_image(*movement_file,image::SCALED_TO_ZOOM,image::NO_ADJUST_COLOUR));
|
||||
if (orb != NULL) {
|
||||
disp.video().blit_surface(x,y-height_adjust,orb);
|
||||
disp.video().blit_surface(xsrc,ysrc-height_adjust,orb);
|
||||
}
|
||||
|
||||
double unit_energy = 0.0;
|
||||
if(max_hitpoints() > 0) {
|
||||
unit_energy = double(hitpoints())/double(max_hitpoints());
|
||||
}
|
||||
disp.draw_bar(*energy_file,x-static_cast<int>(5*disp.zoom()),y-height_adjust,(max_hitpoints()*2)/3,unit_energy,hp_color(),bar_alpha);
|
||||
disp.draw_bar(*energy_file,xsrc-static_cast<int>(5*disp.zoom()),ysrc-height_adjust,(max_hitpoints()*2)/3,unit_energy,hp_color(),bar_alpha);
|
||||
|
||||
if(experience() > 0 && can_advance()) {
|
||||
const double filled = double(experience())/double(max_experience());
|
||||
const int level = maximum<int>(level_,1);
|
||||
|
||||
SDL_Color colour=xp_color();
|
||||
disp.draw_bar(*energy_file,x,y-height_adjust,max_experience()/(level*2),filled,colour,bar_alpha);
|
||||
disp.draw_bar(*energy_file,xsrc,ysrc-height_adjust,max_experience()/(level*2),filled,colour,bar_alpha);
|
||||
}
|
||||
|
||||
if (can_recruit()) {
|
||||
|
@ -1941,7 +1948,7 @@ void unit::redraw_unit(display& disp,gamemap::location hex)
|
|||
//if(bar_alpha != ftofxp(1.0)) {
|
||||
// crown = adjust_surface_alpha(crown, bar_alpha);
|
||||
//}
|
||||
disp.video().blit_surface(x,y-height_adjust,crown);
|
||||
disp.video().blit_surface(xsrc,ysrc-height_adjust,crown);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1949,7 +1956,7 @@ void unit::redraw_unit(display& disp,gamemap::location hex)
|
|||
for(std::vector<std::string>::const_iterator ov = overlays().begin(); ov != overlays().end(); ++ov) {
|
||||
const surface img(image::get_image(*ov));
|
||||
if(img != NULL) {
|
||||
disp.draw_unit(x,y-height_adjust,img);
|
||||
disp.draw_unit(xsrc,ysrc-height_adjust,img);
|
||||
}
|
||||
}
|
||||
refreshing_ = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue