[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/actions basher.cxx,1.23,1.24
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/actions basher.cxx,1.23,1.24 |
Date: |
2 Nov 2002 17:43:12 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv28495/actions
Modified Files:
basher.cxx
Log Message:
gervases basher patch and some sorting for the buttonpanel
Index: basher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- basher.cxx 14 Oct 2002 11:15:15 -0000 1.23
+++ basher.cxx 2 Nov 2002 17:43:10 -0000 1.24
@@ -60,7 +60,7 @@
else
sprite.set_direction (Sprite::RIGHT);
- gc.draw (sprite, pingu->get_pos());
+ gc.draw (sprite, pingu->get_pos() + Vector (0, +1));
}
void
@@ -73,16 +73,35 @@
{
walk_forward();
- if (have_something_to_dig())
+ // If on walking forward the Basher has now walked on to water or lava
+ if (rel_getpixel(0, -1) == Groundtype::GP_WATER
+ || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
{
- // We only bash every second step, cause the Pingus would
- // get trapped otherwise in the bashing area.
- if (basher_c % 2 == 0)
- bash();
+ pingu->set_action(Actions::Drown);
}
- else if (sprite.get_progress () > 0.6f) // FIXME: EVIL!
+ // If walking on to something (i.e. hasn't fallen)
+ else if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
{
- pingu->set_action(Actions::Walker);
+ // If the Basher has walked into something that it won't be able to
+ // bash
+ if (rel_getpixel(0, 0) == Groundtype::GP_SOLID
+ || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
+ {
+ // Change direction and let walk code walk forward/up to get out.
+ pingu->direction.change();
+ pingu->set_action(Actions::Walker);
+ }
+ else if (have_something_to_dig())
+ {
+ // We only bash every second step, cause the Pingus would
+ // get trapped otherwise in the bashing area.
+ if (basher_c % 2 == 0)
+ bash();
+ }
+ else if (sprite.get_progress () > 0.6f) // FIXME: EVIL!
+ {
+ pingu->set_action(Actions::Walker);
+ }
}
}
}
@@ -92,10 +111,10 @@
{
WorldObj::get_world()->get_colmap()->remove(bash_radius,
static_cast<int>(pingu->get_x ()
- (bash_radius_width / 2)),
- static_cast<int>(pingu->get_y ()
- bash_radius_width - 1));
+ static_cast<int>(pingu->get_y ()
- bash_radius_width + 1));
WorldObj::get_world()->get_gfx_map()->remove(bash_radius_gfx,
static_cast<int>(pingu->get_x ()
- (bash_radius_gfx_width / 2)),
- static_cast<int>(pingu->get_y ()
- bash_radius_gfx_width - 1));
+ static_cast<int>(pingu->get_y ()
- bash_radius_gfx_width + 1));
}
void
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/actions basher.cxx,1.23,1.24,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.18,1.19 pingu_enums.hxx,1.8,1.9
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.19,1.20
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.18,1.19 pingu_enums.hxx,1.8,1.9
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.19,1.20
- Index(es):