[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/actions walker.cxx,1.3,1.4
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/actions walker.cxx,1.3,1.4 |
Date: |
24 Jun 2002 12:30:04 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv29887/actions
Modified Files:
walker.cxx
Log Message:
added fix for digger-walker interaction
Index: walker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/walker.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- walker.cxx 24 Jun 2002 09:40:59 -0000 1.3
+++ walker.cxx 24 Jun 2002 12:30:02 -0000 1.4
@@ -62,17 +62,36 @@
// FIXME: pingu environment needs to get reviewed
pingu->environment = ENV_LAND;
+ // The Pingu stands no longer on ground, the cause for this could be
+ // a digger, miner or a bomber
if (rel_getpixel(0, -1) == ColMap::NOTHING)
{
- // The Pingu stands no longer on ground, so its time to fall
- pingu->set_action ("faller");
- return;
+ // We search for the nearest ground below the pingu, if we can't
+ // find anything within a few pixels, we will turn into a faller
+ bool found_ground = false;
+ int i;
+ for (i = -2; i > -5; --i)
+ {
+ if (!(rel_getpixel(0, i) == ColMap::NOTHING))
+ {
+ found_ground = true;
+ break;
+ }
+ }
+
+ if (found_ground)
+ {
+ pingu->pos.y -= i;
+ }
+ else
+ {
+ pingu->set_action ("faller");
+ return;
+ }
}
- /* else if (rel_getpixel(1, 0) == ColMap::NOTHING)
- { // if infront is free
- pingu->pos.x += pingu->direction;
- }*/
- else if (rel_getpixel(1, 0) & ColMap::BRIDGE
+
+
+ if (rel_getpixel(1, 0) & ColMap::BRIDGE
&& !head_collision_on_walk(1, 1)) // bridge
{
// simple, stupid, but working bridge code
@@ -95,7 +114,7 @@
// we can continue walking up. search for the correct y_pos
int y_inc = 0;
bool found_next_step = false;
- for(y_inc=-max_steps; y_inc <= max_steps; y_inc++) // up-hill
+ for(y_inc=-max_steps; y_inc <= max_steps; y_inc++) // up-hill
if (rel_getpixel(1, y_inc) == ColMap::NOTHING
&& rel_getpixel(1, y_inc - 1) != ColMap::NOTHING)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/actions walker.cxx,1.3,1.4,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src globals.hxx,1.1,1.2 pingus_main.cxx,1.3,1.4 pingus_resource.cxx,1.8,1.9
- Next by Date:
[Pingus-CVS] [Bug #740] Jumper has no own animation
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src globals.hxx,1.1,1.2 pingus_main.cxx,1.3,1.4 pingus_resource.cxx,1.8,1.9
- Next by thread:
[Pingus-CVS] [Bug #740] Jumper has no own animation
- Index(es):