Index: Games/Pingus/data/data/pingus.scr =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/data/data/pingus.scr,v retrieving revision 1.35 diff -u -r1.35 pingus.scr --- Games/Pingus/data/data/pingus.scr 24 Sep 2002 17:02:48 -0000 1.35 +++ Games/Pingus/data/data/pingus.scr 13 Oct 2002 01:29:58 -0000 @@ -82,8 +82,8 @@ brick_right = ../images/pingus/brick_right.png (type=surface, x=0, y=0, width=16, height=2); brick_left = ../images/pingus/brick_left.png (type=surface, x=0, y=0, width=16, height=2); - bash_radius = ../images/pingus/bash_radius.png (type=surface, x=0, y=0, width=32, height=32); - bash_radius_gfx = ../images/pingus/bash_radius_gfx.png (type=surface, x=0, y=0, width=32, height=32); + bash_radius = ../images/pingus/bash_radius.png (type=surface, x=0, y=0, width=34, height=34); + bash_radius_gfx = ../images/pingus/bash_radius_gfx.png (type=surface, x=0, y=0, width=34, height=34); digger_radius = ../images/pingus/digger_radius.png (type=surface); digger_radius_gfx = ../images/pingus/digger_radius_gfx.png (type=surface); Index: Games/Pingus/src/actions/basher.cxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.cxx,v retrieving revision 1.20 diff -u -r1.20 basher.cxx --- Games/Pingus/src/actions/basher.cxx 8 Oct 2002 17:53:10 -0000 1.20 +++ Games/Pingus/src/actions/basher.cxx 13 Oct 2002 01:29:59 -0000 @@ -42,6 +42,13 @@ sprite = Sprite (PingusResource::load_surface ("Pingus/basher0", "pingus")); sprite.set_align_center_bottom (); + bash_radius_width = bash_radius.get_width(); + bash_radius_gfx_width = bash_radius_gfx.get_width(); + + // The +1 is just in case bash_radius is an odd no. In which case, want to + // round up the result. + bash_reach = static_cast(bash_radius_width + 1) / 2; + // Start a bash even so the action will stops instantly after the // first bash bash (); @@ -86,11 +93,11 @@ Basher::bash() { WorldObj::get_world()->get_colmap()->remove(bash_radius, - static_cast(pingu->get_x () - (bash_radius.get_width()/2)), - static_cast(pingu->get_y () - 31)); + static_cast(pingu->get_x () - (bash_radius_width / 2)), + static_cast(pingu->get_y () - bash_radius_width - 1)); WorldObj::get_world()->get_gfx_map()->remove(bash_radius_gfx, - static_cast(pingu->get_x () - (bash_radius_gfx.get_width()/2)), - static_cast(pingu->get_y () - 31)); + static_cast(pingu->get_x () - (bash_radius_gfx_width / 2)), + static_cast(pingu->get_y () - bash_radius_gfx_width - 1)); } void @@ -129,12 +136,10 @@ return true; } - for(int x = 0; x <= 16; ++x) + // Check that there is something "within" the Basher's reach + for(int x = 0; x <= bash_reach; ++x) { - // Check that there is a high enough wall (i.e. not 1 pixel) to bash. - // Probably best to check from where Pingu can't automatically walk up - // up to head collision height. - for (int y = bash_height + 1; y <= bash_height + pingu_height + 1; ++y) + for (int y = min_bash_height; y <= max_bash_height; ++y) { if (rel_getpixel(x, y) == Groundtype::GP_GROUND) { Index: Games/Pingus/src/actions/basher.hxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.hxx,v retrieving revision 1.13 diff -u -r1.13 basher.hxx --- Games/Pingus/src/actions/basher.hxx 8 Oct 2002 17:53:10 -0000 1.13 +++ Games/Pingus/src/actions/basher.hxx 13 Oct 2002 01:29:59 -0000 @@ -33,9 +33,24 @@ CL_Surface bash_radius_gfx; int basher_c; bool first_bash; + + /** Width of the bash_radius surface */ + unsigned int bash_radius_width; + + /** Width of the bash_radius_gfx surface */ + unsigned int bash_radius_gfx_width; + + /** The no. of pixels ahead that a Basher checks for something bashable. + This is initialised using the size of the bash_radius surface. */ + int bash_reach; - /// Defines "wall" height needed so as to determine whether it should be bashed. - enum { bash_height = 4 }; + /** Defines the minimum "wall" height needed for a bash to happen. */ + enum { min_bash_height = 5 }; + + /** Defines the maximum height up to which a check is made to see if there + is anything to bash. Best to make this at least (min_bash_height + + pingu_height). */ + enum { max_bash_height = 33 }; /** Defines the maximum no. of steps down a Basher can go down before it stops being a Basher and turns into a Faller. */