fixed handling of androids in EM engine for old tapes
[rocksndiamonds.git] / src / game_em / logic.c
index 001e47b0bb4516e591d572d8f7aac307f8536fcc..3c68bfb9f73ea6250de9abf3ef47b29ec65ad8a1 100644 (file)
 
 #define SPRING_ROLL    /* spring rolling off round things continues to roll */
 #define ACID_ROLL      /* rolling objects go into acid rather than remove it */
+#define ACID_PLAYER    /* player gets killed by acid, but without explosion */
 
-#define USE_CHANGED_ACID_STUFF
-
-#define RANDOM_RAW     (seed = seed << 31 | seed >> 1)
-#define RANDOM(x)      (RANDOM_RAW & (x - 1))
+#define RANDOM(x)      ((seed = seed << 31 | seed >> 1) % x)
 
 static short **cave, **next, **boom;
 static unsigned int seed;
@@ -84,6 +82,21 @@ static const byte is_amoeba[GAME_TILE_MAX] =
   [Xamoeba_8]          = 1
 };
 
+static byte is_android_blank[GAME_TILE_MAX] =
+{
+  [Xblank]             = 1,
+  [Xsplash_e]          = 1,
+  [Xsplash_w]          = 1,
+  [Xfake_acid_1]       = 1,
+  [Xfake_acid_2]       = 1,
+  [Xfake_acid_3]       = 1,
+  [Xfake_acid_4]       = 1,
+  [Xfake_acid_5]       = 1,
+  [Xfake_acid_6]       = 1,
+  [Xfake_acid_7]       = 1,
+  [Xfake_acid_8]       = 1
+};
+
 static const byte is_android_walkable[GAME_TILE_MAX] =
 {
   [Xblank]             = 1,
@@ -152,7 +165,7 @@ static void Lboom_eater(int x, int y)
   boom[x][y+1]   = lev.eater_array[lev.eater_pos][7];
   boom[x+1][y+1] = lev.eater_array[lev.eater_pos][8];
 
-  lev.eater_pos = (lev.eater_pos + 1) & 7;
+  lev.eater_pos = (lev.eater_pos + 1) % 8;
 
 #if PLAY_ELEMENT_SOUND
   play_element_sound(x, y, SOUND_boom, Xeater_n);
@@ -216,6 +229,22 @@ static void Lboom_eater_new(int x, int y, boolean chain_explosion)
   Lboom_eater(x, y);
 }
 
+static void Lboom_cave_new(int x, int y, int element)
+{
+  if (game_em.use_old_explosions)
+    return;
+
+  cave[x][y] = element;
+}
+
+static void Lboom_next_new(int x, int y, int element)
+{
+  if (game_em.use_old_explosions)
+    return;
+
+  next[x][y] = element;
+}
+
 static boolean player_killed(struct PLAYER *ply)
 {
   int x = ply->x;
@@ -340,7 +369,7 @@ static void kill_player(struct PLAYER *ply)
   int x = ply->x;
   int y = ply->y;
 
-  ply->alive = 0;
+  ply->alive = FALSE;
 
   switch (cave[x][y-1])
   {
@@ -467,7 +496,7 @@ static void kill_player(struct PLAYER *ply)
 
   switch (cave[x][y])
   {
-#ifdef USE_CHANGED_ACID_STUFF
+#ifdef ACID_PLAYER
     case Xacid_1:
     case Xacid_2:
     case Xacid_3:
@@ -501,7 +530,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
   if (dx && dy && ply->joy_snap)       /* more than one direction specified */
     return FALSE;
 
-  if (ply->joy_snap == 0)              /* player wants to move */
+  if (!ply->joy_snap)                  /* player wants to move */
   {
     int element = cave[x][y];
 
@@ -513,6 +542,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
       case Xsplash_w:
        cave[x][y] = Zplayer;
        next[x][y] = Zplayer;
+       // FALL THROUGH
+
       case Xfake_acid_1:
       case Xfake_acid_2:
       case Xfake_acid_3:
@@ -527,7 +558,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        ply->y = y;
        break;
 
-#ifdef USE_CHANGED_ACID_STUFF
       case Xacid_1:
       case Xacid_2:
       case Xacid_3:
@@ -536,13 +566,14 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
       case Xacid_6:
       case Xacid_7:
       case Xacid_8:
+#ifdef ACID_PLAYER
        if (cave[x+1][y-1] == Xblank)
          cave[x+1][y-1] = Xsplash_e;
        if (cave[x-1][y-1] == Xblank)
          cave[x-1][y-1] = Xsplash_w;
        play_element_sound(x, y, SOUND_acid, Xacid_1);
+       // FALL THROUGH
 #endif
-
       case Xboom_android:
       case Xboom_1:
       case Xbug_1_n:
@@ -561,17 +592,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
       case Xtank_2_e:
       case Xtank_2_s:
       case Xtank_2_w:
-
-#ifndef USE_CHANGED_ACID_STUFF
-      case Xacid_1:
-      case Xacid_2:
-      case Xacid_3:
-      case Xacid_4:
-      case Xacid_5:
-      case Xacid_6:
-      case Xacid_7:
-      case Xacid_8:
-#endif
        ply->anim = PLY_walk_n + anim;
        ply->x = x;
        ply->y = y;
@@ -1136,7 +1156,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
       case Xswitch:
        play_element_sound(x, y, SOUND_press, element);
        lev.ball_cnt = lev.ball_time;
-       lev.ball_state = !lev.ball_state;
+       lev.ball_active = !lev.ball_active;
        break;
 
       case Xplant:
@@ -1290,6 +1310,11 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
     }
   }
 
+  /* check for wrap-around movement */
+  if (ply->x < lev.left ||
+      ply->x > lev.right - 1)
+    play_element_sound(oldx, oldy, SOUND_door, Xdoor_1);
+
   return result;
 }
 
@@ -1357,7 +1382,10 @@ static void check_player(struct PLAYER *ply)
 
     if (!can_move)
     {
-      ply->joy_n = ply->joy_e = ply->joy_s = ply->joy_w = 0;
+      ply->joy_n = FALSE;
+      ply->joy_e = FALSE;
+      ply->joy_s = FALSE;
+      ply->joy_w = FALSE;
 
       return;
     }
@@ -1365,7 +1393,7 @@ static void check_player(struct PLAYER *ply)
 
   if (dx == 0 && dy == 0)
   {
-    ply->joy_stick = 0;
+    ply->joy_stick = FALSE;
 
     if (ply->joy_drop)
     {
@@ -1387,12 +1415,15 @@ static void check_player(struct PLAYER *ply)
     return;
   }
 
-  ply->joy_stick = 1;
-  ply->joy_n = ply->joy_e = ply->joy_s = ply->joy_w = 0;
+  ply->joy_stick = TRUE;
+  ply->joy_n = FALSE;
+  ply->joy_e = FALSE;
+  ply->joy_s = FALSE;
+  ply->joy_w = FALSE;
+
   ply->dynamite_cnt = 0;       /* reset dynamite timer if we move */
-  ply->joy_spin = !ply->joy_spin;
 
-  if (ply->joy_snap == 0)              /* player wants to move */
+  if (!ply->joy_snap)          /* player wants to move */
   {
     boolean moved = FALSE;
 
@@ -1537,14 +1568,14 @@ static void Landroid(int x, int y)
 
   if (lev.android_clone_cnt == 0)
   {
-    if (!is_blank[cave[x-1][y-1]] &&
-       !is_blank[cave[x][y-1]]   &&
-       !is_blank[cave[x+1][y-1]] &&
-       !is_blank[cave[x-1][y]]   &&
-       !is_blank[cave[x+1][y]]   &&
-       !is_blank[cave[x-1][y+1]] &&
-       !is_blank[cave[x][y+1]]   &&
-       !is_blank[cave[x+1][y+1]])
+    if (!is_android_blank[cave[x-1][y-1]] &&
+       !is_android_blank[cave[x][y-1]]   &&
+       !is_android_blank[cave[x+1][y-1]] &&
+       !is_android_blank[cave[x-1][y]]   &&
+       !is_android_blank[cave[x+1][y]]   &&
+       !is_android_blank[cave[x-1][y+1]] &&
+       !is_android_blank[cave[x][y+1]]   &&
+       !is_android_blank[cave[x+1][y+1]])
       goto android_move;
 
     switch (RANDOM(8))
@@ -1648,91 +1679,91 @@ static void Landroid(int x, int y)
       /* randomly find a direction to move */
 
       case 0: /* S,NE,W,NW,SE,E,SW,N */
-       if (is_blank[cave[x][y+1]])   goto android_s;
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
-       if (is_blank[cave[x-1][y]])   goto android_w;
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
-       if (is_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
        goto android_move;
 
       case 1: /* NW,SE,N,S,NE,SW,E,W */
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x][y-1]])   goto android_n;
-       if (is_blank[cave[x][y+1]])   goto android_s;
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
        goto android_move;
 
       case 2: /* SW,E,S,W,N,NW,SE,NE */
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x][y+1]])   goto android_s;
-       if (is_blank[cave[x-1][y]])   goto android_w;
-       if (is_blank[cave[x][y-1]])   goto android_n;
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
        goto android_move;
 
       case 3: /* N,SE,NE,E,W,S,NW,SW */
-       if (is_blank[cave[x][y-1]])   goto android_n;
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x-1][y]])   goto android_w;
-       if (is_blank[cave[x][y+1]])   goto android_s;
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
        goto android_move;
 
       case 4: /* SE,NW,E,NE,SW,W,N,S */
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
-       if (is_blank[cave[x-1][y]])   goto android_w;
-       if (is_blank[cave[x][y-1]])   goto android_n;
-       if (is_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
        goto android_move;
 
       case 5: /* NE,W,SE,SW,S,N,E,NW */
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
-       if (is_blank[cave[x-1][y]])   goto android_w;
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
-       if (is_blank[cave[x][y+1]])   goto android_s;
-       if (is_blank[cave[x][y-1]])   goto android_n;
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
        goto android_move;
 
       case 6: /* E,N,SW,S,NW,NE,SE,W */
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x][y-1]])   goto android_n;
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
-       if (is_blank[cave[x][y+1]])   goto android_s;
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
        goto android_move;
 
       case 7: /* W,SW,NW,N,E,SE,NE,S */
-       if (is_blank[cave[x-1][y]])   goto android_w;
-       if (is_blank[cave[x-1][y+1]]) goto android_sw;
-       if (is_blank[cave[x-1][y-1]]) goto android_nw;
-       if (is_blank[cave[x][y-1]])   goto android_n;
-       if (is_blank[cave[x+1][y]])   goto android_e;
-       if (is_blank[cave[x+1][y+1]]) goto android_se;
-       if (is_blank[cave[x+1][y-1]]) goto android_ne;
-       if (is_blank[cave[x][y+1]])   goto android_s;
+       if (is_android_blank[cave[x-1][y]])   goto android_w;
+       if (is_android_blank[cave[x-1][y+1]]) goto android_sw;
+       if (is_android_blank[cave[x-1][y-1]]) goto android_nw;
+       if (is_android_blank[cave[x][y-1]])   goto android_n;
+       if (is_android_blank[cave[x+1][y]])   goto android_e;
+       if (is_android_blank[cave[x+1][y+1]]) goto android_se;
+       if (is_android_blank[cave[x+1][y-1]]) goto android_ne;
+       if (is_android_blank[cave[x][y+1]])   goto android_s;
        goto android_move;
     }
   }
@@ -3962,9 +3993,9 @@ static void Lemerald_fall(int x, int y)
       return;
 
     case Xwonderwall:
-      if (lev.wonderwall_time)
+      if (lev.wonderwall_time > 0)
       {
-       lev.wonderwall_state = 1;
+       lev.wonderwall_active = TRUE;
        cave[x][y] = Yemerald_sB;
        next[x][y] = Xblank;
        if (is_blank[cave[x][y+2]])
@@ -4221,9 +4252,9 @@ static void Ldiamond_fall(int x, int y)
       return;
 
     case Xwonderwall:
-      if (lev.wonderwall_time)
+      if (lev.wonderwall_time > 0)
       {
-       lev.wonderwall_state = 1;
+       lev.wonderwall_active = TRUE;
        cave[x][y] = Ydiamond_sB;
        next[x][y] = Xblank;
        if (is_blank[cave[x][y+2]])
@@ -4477,7 +4508,7 @@ static void Lstone_fall(int x, int y)
     case Xeater_s:
     case Xeater_w:
       cave[x][y] = Ystone_sB;
-      next[x][y] = Xblank;
+      Lboom_next_new(x, y, Xblank);
       cave[x][y+1] = Yeater_stone;
       next[x][y+1] = Zeater;
       Lboom_eater_old(x, y+1);
@@ -4487,7 +4518,7 @@ static void Lstone_fall(int x, int y)
     case Xalien:
     case Xalien_pause:
       cave[x][y] = Ystone_sB;
-      next[x][y] = Xblank;
+      Lboom_next_new(x, y, Xblank);
       cave[x][y+1] = Yalien_stone;
       next[x][y+1] = Ztank;
       Lboom_tank_old(x, y+1);
@@ -4503,7 +4534,7 @@ static void Lstone_fall(int x, int y)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x][y] = Ystone_sB;
-      next[x][y] = Xblank;
+      Lboom_next_new(x, y, Xblank);
       cave[x][y+1] = Ybug_stone;
       next[x][y+1] = Zbug;
       Lboom_bug_old(x, y+1);
@@ -4519,7 +4550,7 @@ static void Lstone_fall(int x, int y)
     case Xtank_2_s:
     case Xtank_2_w:
       cave[x][y] = Ystone_sB;
-      next[x][y] = Xblank;
+      Lboom_next_new(x, y, Xblank);
       cave[x][y+1] = Ytank_stone;
       next[x][y+1] = Ztank;
       Lboom_tank_old(x, y+1);
@@ -4598,8 +4629,8 @@ static void Lstone_fall(int x, int y)
 
     case Xbomb:
     case Xbomb_pause:
-      cave[x][y] = Xstone;
-      next[x][y] = Xstone;
+      Lboom_cave_new(x, y, Xstone);
+      Lboom_next_new(x, y, Xstone);
       cave[x][y+1] = Ybomb_blank;
       next[x][y+1] = Ztank;
       Lboom_tank_old(x, y+1);
@@ -4669,9 +4700,9 @@ static void Lstone_fall(int x, int y)
       return;
 
     case Xwonderwall:
-      if (lev.wonderwall_time)
+      if (lev.wonderwall_time > 0)
       {
-       lev.wonderwall_state = 1;
+       lev.wonderwall_active = TRUE;
        cave[x][y] = Ystone_sB;
        next[x][y] = Xblank;
        if (is_blank[cave[x][y+2]])
@@ -6559,7 +6590,7 @@ static void Lball_common(int x, int y)
 
 static void Lball_1(int x, int y)
 {
-  if (lev.ball_state == 0)
+  if (!lev.ball_active)
     return;
 
   cave[x][y] = Yball_1;
@@ -6572,7 +6603,7 @@ static void Lball_1(int x, int y)
 
 static void Lball_2(int x, int y)
 {
-  if (lev.ball_state == 0)
+  if (!lev.ball_active)
     return;
 
   cave[x][y] = Yball_2;
@@ -6665,7 +6696,7 @@ static void Ldrip_stretchB(int x, int y)
 
 static void Lwonderwall(int x, int y)
 {
-  if (lev.wonderwall_time && lev.wonderwall_state)
+  if (lev.wonderwall_time > 0 && lev.wonderwall_active)
   {
     cave[x][y] = Ywonderwall;
     play_element_sound(x, y, SOUND_wonder, Xwonderwall);
@@ -6680,7 +6711,7 @@ static void Lwheel(int x, int y)
 
 static void Lswitch(int x, int y)
 {
-  if (lev.ball_state)
+  if (lev.ball_active)
     cave[x][y] = Yswitch;
 }
 
@@ -7304,8 +7335,8 @@ static void logic_players(void)
       game.set_centered_player_wrap = TRUE;
     }
 
-    ply[i].oldx = ply[i].x;
-    ply[i].oldy = ply[i].y;
+    ply[i].prev_x = ply[i].x;
+    ply[i].prev_y = ply[i].y;
     ply[i].anim = PLY_still;
   }
 
@@ -7325,10 +7356,10 @@ static void logic_players(void)
     if (!ply[i].alive)
       continue;
 
-    if (cave[ply[i].oldx][ply[i].oldy] == Zplayer)
+    if (cave[ply[i].prev_x][ply[i].prev_y] == Zplayer)
     {
-      cave[ply[i].oldx][ply[i].oldy] = Xblank;
-      next[ply[i].oldx][ply[i].oldy] = Xblank;
+      cave[ply[i].prev_x][ply[i].prev_y] = Xblank;
+      next[ply[i].prev_x][ply[i].prev_y] = Xblank;
     }
 
     if (cave[ply[i].x][ply[i].y] == Xblank)
@@ -7388,7 +7419,7 @@ static void logic_globals(void)
     lev.android_move_cnt = lev.android_move_time;
   if (lev.android_clone_cnt-- == 0)
     lev.android_clone_cnt = lev.android_clone_time;
-  if (lev.ball_state)
+  if (lev.ball_active)
     if (lev.ball_cnt-- == 0)
       lev.ball_cnt = lev.ball_time;
   if (lev.lenses_cnt)
@@ -7399,7 +7430,7 @@ static void logic_globals(void)
     lev.wheel_cnt--;
   if (lev.wind_cnt)
     lev.wind_cnt--;
-  if (lev.wonderwall_time && lev.wonderwall_state)
+  if (lev.wonderwall_time > 0 && lev.wonderwall_active)
     lev.wonderwall_time--;
 
   if (lev.wheel_cnt)
@@ -7436,6 +7467,14 @@ static void logic_globals(void)
       next[x][y] = cave[x][y];
 }
 
+void logic_init(void)
+{
+  int splash_is_blank = !game_em.use_old_android;
+
+  is_android_blank[Xsplash_e] = splash_is_blank;
+  is_android_blank[Xsplash_w] = splash_is_blank;
+}
+
 void logic(void)
 {
   if (frame == 0)