Blob Blame History Raw
Only in src.fixed/ai: .#walker.c
diff -ur src.fixed/ai/baby.c src/ai/baby.c
--- src.fixed/ai/baby.c	2005-11-09 22:12:46.000000000 +0100
+++ src/ai/baby.c	2007-10-24 19:26:26.000000000 +0200
@@ -212,7 +212,7 @@
 #define BABY_SMALLJUMP_MAX_DEC_RATE    20
 void baby_jump(int o, int big)
 {
-    if (rand()&2==0) big = 1-big;
+    if ((rand()&2)==0) big = 1-big;
     if (big==BABY_JUMP_BIG)
     {
       objects[o].ai.baby.inertia_y = -BABY_BIGJUMP;
diff -ur src.fixed/ai/fireball.c src/ai/fireball.c
--- src.fixed/ai/fireball.c	2005-11-09 22:13:08.000000000 +0100
+++ src/ai/fireball.c	2007-10-24 19:26:26.000000000 +0200
@@ -14,8 +14,7 @@
 
 void fireball_ai(int o)
 {
-int i;
-int newobject;
+	int i;
   if (objects[o].needinit)
   {
     objects[o].ai.ray.animframe = 0;
@@ -26,6 +25,26 @@
     objects[o].needinit = 0;
   }
 
+  // test if it hit a baddie
+   for(i=1;i<MAX_OBJECTS;i++)
+   {
+     if (!objects[i].exists || i==o) continue;
+     if (objects[o].ai.ray.dontHitEnable)
+     {
+       if (objects[i].type==objects[o].ai.ray.dontHit) continue;
+     }
+
+     if (objects[i].canbezapped)
+     {
+        if (hitdetect(i, o))
+        {
+	     objects[o].type = OBJ_RAY;
+		 objects[o].ai.ray.state = RAY_STATE_SETZAPZOT;
+          objects[i].zapped++;
+        }
+     }
+   }
+
   // check if it hit keen
   if (objects[o].touchPlayer)
   {
diff -ur src.fixed/ai/meep.c src/ai/meep.c
--- src.fixed/ai/meep.c	2005-11-09 22:13:32.000000000 +0100
+++ src/ai/meep.c	2007-10-24 19:26:26.000000000 +0200
@@ -43,10 +43,25 @@
   }
   if (objects[o].ai.meep.state==MEEP_DEAD) return;
 
-  if (objects[o].touchPlayer && objects[o].ai.meep.state!=MEEP_DYING)
-  {
-     killplayer(objects[o].touchedBy);
-  }
+   if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie)
+   {
+      /* don't push the player as he's walking through the exit door */
+      if (!levelcontrol.level_done || levelcontrol.level_finished_by != objects[o].touchedBy)
+      {
+         if (player[objects[o].touchedBy].x < objects[o].x)
+         {
+            player[objects[o].touchedBy].playpushed_x = -MEEP_WALK_SPD;
+            if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0;
+            player[objects[o].touchedBy].playpushed_decreasetimer = 0;
+         }
+         else
+         {
+            player[objects[o].touchedBy].playpushed_x = MEEP_WALK_SPD;
+            if (player[objects[o].touchedBy].pinertia_x < 0) player[objects[o].touchedBy].pinertia_x = 0;
+            player[objects[o].touchedBy].playpushed_decreasetimer = 0;
+         }
+      }
+   } 
 
   if (objects[o].zapped)
   {
diff -ur src.fixed/ai/mother.c src/ai/mother.c
--- src.fixed/ai/mother.c	2005-11-09 22:13:34.000000000 +0100
+++ src/ai/mother.c	2007-10-24 19:26:26.000000000 +0200
@@ -10,7 +10,7 @@
 #define MOTHER_WALK_ANIM_RATE     70
 #define MOTHER_WALK_SPD           1
 
-#define MOTHER_SPIT_PROB          1000
+#define MOTHER_SPIT_PROB          2000
 #define MOTHER_SPIT_SHOW_TIME     100
 
 #define MOTHER_HP      4
@@ -48,10 +48,26 @@
   }
   if (objects[o].ai.mother.state==MOTHER_DEAD) return;
 
-  if (objects[o].touchPlayer)
-  {
-     killplayer(objects[o].touchedBy);
-  }
+   if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie)
+   {
+      /* don't push the player as he's walking through the exit door */
+      if (!levelcontrol.level_done || levelcontrol.level_finished_by != objects[o].touchedBy)
+      {
+         if (player[objects[o].touchedBy].x < objects[o].x)
+         {
+            player[objects[o].touchedBy].playpushed_x = -MOTHER_WALK_SPD;
+            if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0;
+            player[objects[o].touchedBy].playpushed_decreasetimer = 0;
+         }
+         else
+         {
+            player[objects[o].touchedBy].playpushed_x = MOTHER_WALK_SPD;
+            if (player[objects[o].touchedBy].pinertia_x < 0) player[objects[o].touchedBy].pinertia_x = 0;
+            player[objects[o].touchedBy].playpushed_decreasetimer = 0;
+         }
+      }
+   } 
+
 
   if (objects[o].zapped)
   {
@@ -70,27 +86,20 @@
    case MOTHER_WALK:
      if (rand()%MOTHER_SPIT_PROB==(MOTHER_SPIT_PROB/2))
      {
-       if (objects[o].onscreen)
-       {
-         objects[o].ai.mother.state = MOTHER_SPIT;
-         objects[o].ai.mother.timer = 0;
-       }
-       else
-       {
-          // try to get onscreen by heading towards the player
-          if (player[primaryplayer].x > objects[o].x)
-            objects[o].ai.mother.dir = RIGHT;
-          else
-            objects[o].ai.mother.dir = LEFT;
-       }
+	   if (objects[o].ai.mother.dir == RIGHT) // turn around before spitting
+			objects[o].ai.mother.dir = LEFT;
+	   else
+			objects[o].ai.mother.dir = RIGHT;
+
+	   objects[o].ai.mother.state = MOTHER_SPIT;
+       objects[o].ai.mother.timer = 0;
      }
 
      if (objects[o].ai.mother.dir==RIGHT)
      {
        objects[o].sprite = MOTHER_WALK_RIGHT_FRAME + objects[o].ai.mother.animframe;
-//       not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)+sprites[MOTHER_WALK_RIGHT_FRAME].xsize, (objects[o].y>>CSF)+sprites[MOTHER_WALK_RIGHT_FRAME].ysize)].solidfall;
 
-       if (objects[o].blockedr)// || !not_about_to_fall)
+       if (objects[o].blockedr)
        {
          objects[o].ai.mother.dir = LEFT;
        }
diff -ur src.fixed/ai/ninja.c src/ai/ninja.c
--- src.fixed/ai/ninja.c	2005-11-09 22:13:42.000000000 +0100
+++ src/ai/ninja.c	2007-10-24 19:26:26.000000000 +0200
@@ -156,7 +156,9 @@
      else objects[o].ai.ninja.animtimer++;
      break;
    case NINJA_KICK:
-     if (!objects[o].ai.ninja.isdying)
+       if (objects[o].blockedu && objects[o].ai.ninja.YInertia < 0) objects[o].ai.ninja.YInertia *= 0.5;
+
+	   if (!objects[o].ai.ninja.isdying)
      {
        if (objects[o].ai.ninja.dir==LEFT)
          { objects[o].sprite = NINJA_KICK_LEFT_FRAME; }
diff -ur src.fixed/ai/se.c src/ai/se.c
--- src.fixed/ai/se.c	2005-11-09 22:14:30.000000000 +0100
+++ src/ai/se.c	2007-10-24 19:26:26.000000000 +0200
@@ -946,6 +946,10 @@
 void se_mortimer_leg_right(int o)
 {
 int mx,my;
+  if (objects[o].touchPlayer)
+  {
+     killplayer(objects[o].touchedBy);
+  }
    if (objects[o].needinit)
    {
      objects[o].ai.se.dir = UP;
diff -ur src.fixed/ai/tank.c src/ai/tank.c
--- src.fixed/ai/tank.c	2005-11-09 22:14:22.000000000 +0100
+++ src/ai/tank.c	2007-10-18 22:34:25.000000000 +0200
@@ -57,8 +57,10 @@
    // stop keen from walking through our sprite
      if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie)
      {
-          sound_play(SOUND_YORP_BUMP, PLAY_NORESTART);
+        sound_play(SOUND_YORP_BUMP, PLAY_NORESTART);
 
+        if (!((player[objects[o].touchedBy].y) < (objects[o].y - 300))) // give the player a little jump-over room
+        {
           if (player[objects[o].touchedBy].x < objects[o].x)
           {
              player[objects[o].touchedBy].playpushed_x = -TANKPUSHAMOUNT;
@@ -71,6 +73,7 @@
              player[objects[o].touchedBy].playpushed_decreasetimer = 0;
              player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = RIGHT;
           }
+        }
      }
 
    switch(objects[o].ai.tank.state)
@@ -95,7 +98,7 @@
                { objects[o].ai.tank.movedir = LEFT; }
              else if (!tank_CanMoveLeft(o))
                { objects[o].ai.tank.movedir = RIGHT; }
-             else if (rand()&1)
+             else if (player[objects[o].ai.tank.detectedPlayerIndex].x < objects[o].x) // turn towards player
                { objects[o].ai.tank.movedir = LEFT; }
              else
                { objects[o].ai.tank.movedir = RIGHT; }
@@ -143,9 +146,8 @@
          if (objects[o].ai.tank.detectedPlayer)
          {
            objects[o].ai.tank.ponsameleveltime++;
-           if ((objects[o].ai.tank.ponsameleveltime > TANK_SAME_LEVEL_TIME) || \
-               (objects[o].ai.tank.ponsameleveltime > TANK_SAME_LEVEL_TIME_FAST && options[OPT_MEAN].value))
-           {   // keen would be a good target now.
+           if (objects[o].ai.tank.ponsameleveltime > TANK_SAME_LEVEL_TIME_FAST && options[OPT_MEAN].value)
+           {   // keen would be a good target now. (hard mode)
               if (!objects[o].ai.tank.alreadyfiredcauseonsamelevel ||\
                   objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME || \
                   (objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME_FAST && options[OPT_MEAN].value))
@@ -178,20 +180,10 @@
        if (objects[o].ai.tank.dist_traveled > TANK_MINTRAVELDIST && objects[o].onscreen)
        {
           if (rand()%TANK_LOOKFIRE_PROB==(TANK_LOOKFIRE_PROB/2))
-          {  // we're either going to look or fire
-              if (rand()&1)
-              { // look
-                 objects[o].ai.tank.timer = 0;
-                 objects[o].ai.tank.frame = 0;
-                 objects[o].ai.tank.state = TANK_LOOK;
-              }
-              else
-              { // FIRE!
-                 objects[o].ai.tank.timer = 0;
-                 objects[o].ai.tank.state = TANK_FIRE;
-              }
-              break;
-          }
+	  {
+		  objects[o].ai.tank.timer = 0;
+		  objects[o].ai.tank.state = TANK_FIRE;
+	  }
        }
 
        if (objects[o].ai.tank.movedir==LEFT)
@@ -252,7 +244,10 @@
          objects[newobject].sprite = ENEMYRAY;
          objects[newobject].ai.ray.dontHitEnable = 0;
 
-         objects[o].ai.tank.state = TANK_WALK;
+	 objects[o].ai.tank.timer = 0;
+         objects[o].ai.tank.frame = 0;
+         objects[o].ai.tank.animtimer = 0;
+         objects[o].ai.tank.state = TANK_LOOK; // must look after fire
       } else objects[o].ai.tank.timer++;
      break;
 
diff -ur src.fixed/ai/tankep2.c src/ai/tankep2.c
--- src.fixed/ai/tankep2.c	2005-11-09 22:14:06.000000000 +0100
+++ src/ai/tankep2.c	2007-10-24 19:26:26.000000000 +0200
@@ -15,8 +15,8 @@
 
 #define TANK_WALK_SPEED         4
 #define TANK_WALK_ANIM_TIME     60
-#define TANK_LOOK_ANIM_TIME     70
-#define TANK_LOOK_TOTALTIME     180
+#define TANK_LOOK_ANIM_TIME     110
+#define TANK_LOOK_TOTALTIME     250
 #define TANK2_PREPAREFIRE_TIME  80
 
 // frames
@@ -30,6 +30,7 @@
 #define TANK2_SHOTS_PER_VOLLEY    4
 #define TANK2_MIN_TIME_TILL_CAN_FIRE  600
 #define TANK2_MAX_TIME_TILL_CAN_FIRE  1000
+#define TANK2_PAUSE_BEFORE_FIRST_SHOT 150
 #define TANK2_TIME_BETWEEN_SHOTS  50
 #define TANK2_TIME_BEFORE_FIRE_WHEN_SEE      100
 #define TANK2_TIME_BETWEEN_FIRE_CAUSE_LEVEL  400
@@ -126,7 +127,7 @@
                    if (!objects[o].ai.tank.timetillcanfirecauseonsamelevel)
                    {
                      objects[o].ai.tank.firetimes = TANK2_SHOTS_PER_VOLLEY;
-                     objects[o].ai.tank.timetillnextshot = 0;
+                     objects[o].ai.tank.timetillnextshot = TANK2_PAUSE_BEFORE_FIRST_SHOT;
                      objects[o].ai.tank.timetillcanfire = (rand()%(TANK2_MAX_TIME_TILL_CAN_FIRE-TANK2_MIN_TIME_TILL_CAN_FIRE))+TANK2_MIN_TIME_TILL_CAN_FIRE;
                      objects[o].ai.tank.timetillcanfirecauseonsamelevel = TANK2_TIME_BETWEEN_FIRE_CAUSE_LEVEL;
                    }
@@ -183,7 +184,7 @@
           if (!objects[o].ai.tank.timetillcanfire)
           {
             objects[o].ai.tank.firetimes = TANK2_SHOTS_PER_VOLLEY;
-            objects[o].ai.tank.timetillnextshot = 0;
+            objects[o].ai.tank.timetillnextshot = TANK2_PAUSE_BEFORE_FIRST_SHOT;
             objects[o].ai.tank.timetillcanfire = (rand()%(TANK2_MAX_TIME_TILL_CAN_FIRE-TANK2_MIN_TIME_TILL_CAN_FIRE))+TANK2_MIN_TIME_TILL_CAN_FIRE;
           }
           else
@@ -192,47 +193,49 @@
           }
        }
 
-       if (objects[o].ai.tank.movedir==LEFT)
-       {  // move left
-//         not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+sprites[TANK2_WALK_LEFT_FRAME].ysize+16)].solidfall;
-         objects[o].sprite = TANK2_WALK_LEFT_FRAME + objects[o].ai.tank.frame;
-         if (!objects[o].blockedl)
-         {
-           objects[o].x -= TANK_WALK_SPEED;
-           objects[o].ai.tank.dist_traveled++;
-         }
-         else
-         {
-           objects[o].ai.tank.frame = 0;
-           objects[o].ai.tank.timer = 0;
-           objects[o].ai.tank.animtimer = 0;
-           objects[o].ai.tank.state = TANK_LOOK;
-         }
-       }
-       else
-       {  // move right
-//         not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)+sprites[TANK2_WALK_RIGHT_FRAME].xsize+1, (objects[o].y>>CSF)+sprites[TANK2_WALK_RIGHT_FRAME].ysize+16)].solidfall;
-         objects[o].sprite = TANK2_WALK_RIGHT_FRAME + objects[o].ai.tank.frame;
-         if (!objects[o].blockedr)
-         {
-           objects[o].x += TANK_WALK_SPEED;
-           objects[o].ai.tank.dist_traveled++;
-         }
-         else
-         {
-           objects[o].ai.tank.frame = 0;
-           objects[o].ai.tank.timer = 0;
-           objects[o].ai.tank.animtimer = 0;
-           objects[o].ai.tank.state = TANK_LOOK;
-         }
-       }
-       // hover animation
-       if (objects[o].ai.tank.animtimer > TANK_WALK_ANIM_TIME)
-       {
-         if (objects[o].ai.tank.frame>=3) objects[o].ai.tank.frame=0;
-                                     else objects[o].ai.tank.frame++;
-         objects[o].ai.tank.animtimer = 0;
-       } else objects[o].ai.tank.animtimer++;
+	  if (!objects[o].ai.tank.firetimes) // can't walk while firing
+	  {
+		  if (objects[o].ai.tank.movedir==LEFT)
+		  {  // move left
+			  objects[o].sprite = TANK2_WALK_LEFT_FRAME + objects[o].ai.tank.frame;
+			  if (!objects[o].blockedl)
+			  {
+				  objects[o].x -= TANK_WALK_SPEED;
+				  objects[o].ai.tank.dist_traveled++;
+			  }
+			  else
+			  {
+				  objects[o].ai.tank.frame = 0;
+				  objects[o].ai.tank.timer = 0;
+				  objects[o].ai.tank.animtimer = 0;
+				  objects[o].ai.tank.state = TANK_LOOK;
+			  }
+		  }
+		  else
+		  {  // move right
+			  objects[o].sprite = TANK2_WALK_RIGHT_FRAME + objects[o].ai.tank.frame;
+			  if (!objects[o].blockedr)
+			  {
+				  objects[o].x += TANK_WALK_SPEED;
+				  objects[o].ai.tank.dist_traveled++;
+			  }
+			  else
+			  {
+				  objects[o].ai.tank.frame = 0;
+				  objects[o].ai.tank.timer = 0;
+				  objects[o].ai.tank.animtimer = 0;
+				  objects[o].ai.tank.state = TANK_LOOK;
+			  }
+		  }
+	  }
+
+      // hover animation
+      if (objects[o].ai.tank.animtimer > TANK_WALK_ANIM_TIME)
+      {
+        if (objects[o].ai.tank.frame>=3) objects[o].ai.tank.frame=0;
+                                    else objects[o].ai.tank.frame++;
+        objects[o].ai.tank.animtimer = 0;
+      } else objects[o].ai.tank.animtimer++;
     break;
 
    }
diff -ur src.fixed/ai/walker.c src/ai/walker.c
--- src.fixed/ai/walker.c	2005-11-09 22:14:18.000000000 +0100
+++ src/ai/walker.c	2007-10-18 22:22:07.000000000 +0200
@@ -107,7 +107,7 @@
          if (player[objects[o].touchedBy].x < objects[o].x)
          {
             player[objects[o].touchedBy].playpushed_x = -WALKERPUSHAMOUNT;
-//            if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0;
+            if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0;
             player[objects[o].touchedBy].playpushed_decreasetimer = 0;
          }
          else
Only in src: fileio.c