Index: Games/Pingus/src/actions/basher.hxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.hxx,v retrieving revision 1.10 diff -u -r1.10 basher.hxx --- Games/Pingus/src/actions/basher.hxx 10 Sep 2002 19:24:19 -0000 1.10 +++ Games/Pingus/src/actions/basher.hxx 30 Sep 2002 23:56:07 -0000 @@ -31,11 +31,22 @@ Sprite sprite; CL_Surface bash_radius; CL_Surface bash_radius_gfx; + + /// Width of the bash_radius surface. Initialised on calling Basher::init() + unsigned int bash_radius_width; + + /// Width of the bash_radius_gfx surface. Initialised on calling + /// Basher::init() + unsigned int bash_radius_gfx_width; + int basher_c; + + /// Distance a basher can reach to bash out stuff + unsigned int bash_reach; bool first_bash; /// Defines "wall" height needed so as to determine whether it should be bashed. - enum { bash_height = 4 }; + enum { bash_height = 5 }; public: Basher (); Index: Games/Pingus/src/actions/basher.cxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.cxx,v retrieving revision 1.16 diff -u -r1.16 basher.cxx --- Games/Pingus/src/actions/basher.cxx 16 Sep 2002 20:31:09 -0000 1.16 +++ Games/Pingus/src/actions/basher.cxx 30 Sep 2002 23:56:08 -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 = (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 @@ -114,12 +121,14 @@ return true; } - for(int i = 0; i < 16; ++i) + // Check that there is something within the Basher's reach + for (unsigned int i = 0; i <= bash_reach; ++i) { // 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 j = bash_height + 1; j <= 26; ++j) + // up to head collision height. Include the bash height that a Pingu + // might step on to. + for (int j = bash_height; j <= pingu_height + bash_height; ++j) { if (rel_getpixel(i,j) == Groundtype::GP_GROUND) {