switch (get(cave, x, y))
{
- // ============================================================================
+ // ======================================================================================
// P L A Y E R S
- // ============================================================================
+ // ======================================================================================
case O_PLAYER:
if (cave->kill_player)
if (cave->pneumatic_hammer_active_delay == 0)
{
- GdElement new_elem;
-
// pneumatic hammer element disappears
store(cave, x, y, O_SPACE);
// which is the new element which appears after that one is hammered?
- new_elem = gd_element_get_hammered(get_dir(cave, x, y, GD_MV_DOWN));
+ GdElement new_elem = gd_element_get_hammered(get_dir(cave, x, y, GD_MV_DOWN));
// if there is a new element, display it
// O_NONE might be returned, for example if the element being
store_dir(cave, x, y, GD_MV_DOWN, new_elem);
// and if walls reappear, remember it in array
+ // y + 1 is down
if (cave->hammered_walls_reappear)
{
- int wall_y;
+ int wall_y = (y + 1) % cave->h;
- wall_y = (y + 1) % cave->h;
cave->hammered_reappear[wall_y][x] = cave->hammered_wall_reappear_frame;
}
}
}
break;
- // ============================================================================
+
+ // ======================================================================================
// S T O N E S, D I A M O N D S
- // ============================================================================
+ // ======================================================================================
case O_STONE: // standing stone
do_start_fall(cave, x, y, cave->gravity, cave->stone_falling_effect);
do_start_fall(cave, x, y, opposite[cave->gravity], O_FLYING_DIAMOND_F);
break;
- // ============================================================================
+
+ // ======================================================================================
// F A L L I N G E L E M E N T S, F L Y I N G S T O N E S, D I A M O N D S
- // ============================================================================
+ // ======================================================================================
case O_DIRT_BALL_F: // falling dirt ball
if (!cave->gravity_disabled)
}
break;
- // ============================================================================
+
+ // ======================================================================================
// N I T R O P A C K
- // ============================================================================
+ // ======================================================================================
case O_NITRO_PACK: // standing nitro pack
do_start_fall(cave, x, y, cave->gravity, O_NITRO_PACK_F);
case O_NITRO_PACK_F: // falling nitro pack
if (!cave->gravity_disabled)
{
- if (is_like_space(cave, x, y, cave->gravity)) // if space, falling further
- move(cave, x, y, cave->gravity, get(cave, x, y));
+ if (is_like_space(cave, x, y, cave->gravity))
+ {
+ // if space, falling further
+ move(cave, x, y, cave->gravity, O_NITRO_PACK_F);
+ }
else if (do_fall_try_magic(cave, x, y, cave->gravity, cave->magic_nitro_pack_to))
{
// try magic wall; if true, function did the work
else if (is_like_dirt(cave, x, y, cave->gravity))
{
// falling on a dirt, it does NOT explode - just stops at its place.
- play_sound_of_element(cave, O_NITRO_PACK, x, y);
store(cave, x, y, O_NITRO_PACK);
+ play_sound_of_element(cave, O_NITRO_PACK, x, y);
}
else
+ {
// falling on any other element it explodes
explode(cave, x, y);
+ }
}
break;
explode(cave, x, y);
break;
- // ============================================================================
+
+ // ======================================================================================
// C R E A T U R E S
- // ============================================================================
+ // ======================================================================================
case O_COW_1:
case O_COW_2:
base = O_COW_1;
- dir = get(cave, x, y)-base; // facing where
- creature_move = cave->creatures_backwards ? creature_chdir : creature_dir;
+ dir = get(cave, x, y) - base; // facing where
+ creature_move = (cave->creatures_backwards ? creature_chdir : creature_dir);
// now change direction if backwards
if (cave->creatures_backwards)
}
if (is_like_space(cave, x, y, creature_move[dirn]))
- move(cave, x, y, creature_move[dirn], base + dirn); // turn and move to preferred dir
+ {
+ // turn and move to preferred dir
+ move(cave, x, y, creature_move[dirn], base + dirn);
+ }
else if (is_like_space(cave, x, y, creature_move[dir]))
- move(cave, x, y, creature_move[dir], base + dir); // go on
+ {
+ // go on
+ move(cave, x, y, creature_move[dir], base + dir);
+ }
else
- store(cave, x, y, base + dirp); // turn in place if nothing else possible
+ {
+ // turn in place if nothing else possible
+ store(cave, x, y, base + dirp);
+ }
}
break;
blows_up_flies(cave, x, y, GD_MV_UP) ||
blows_up_flies(cave, x, y, GD_MV_LEFT) ||
blows_up_flies(cave, x, y, GD_MV_RIGHT))
- explode (cave, x, y);
+ {
+ explode(cave, x, y);
+ }
// otherwise move
else
{
base = O_ALT_BUTTER_1;
dir = get(cave, x, y) - base; // facing where
- creature_move = cave->creatures_backwards ? creature_chdir : creature_dir;
+ creature_move = (cave->creatures_backwards ? creature_chdir : creature_dir);
// now change direction if backwards
if (cave->creatures_backwards)
}
if (is_like_space(cave, x, y, creature_move[dirn]))
- move(cave, x, y, creature_move[dirn], base + dirn); // turn and move to preferred dir
+ {
+ // turn and move to preferred dir
+ move(cave, x, y, creature_move[dirn], base + dirn);
+ }
else if (is_like_space(cave, x, y, creature_move[dir]))
- move(cave, x, y, creature_move[dir], base + dir); // go on
+ {
+ // go on
+ move(cave, x, y, creature_move[dir], base + dir);
+ }
else
- store(cave, x, y, base + dirp); // turn in place if nothing else possible
+ {
+ // turn in place if nothing else possible
+ store(cave, x, y, base + dirp);
+ }
}
break;
}
break;
- // ============================================================================
+
+ // ======================================================================================
// A C T I V E E L E M E N T S
- // ============================================================================
+ // ======================================================================================
case O_AMOEBA:
// emulating BD1 amoeba+magic wall bug
}
break;
- // ============================================================================
+
+ // ======================================================================================
// C O N V E Y O R B E L T S
- // ============================================================================
+ // ======================================================================================
case O_CONVEYOR_RIGHT:
case O_CONVEYOR_LEFT:
}
break;
- // ============================================================================
+
+ // ======================================================================================
// R O C K E T S
- // ============================================================================
+ // ======================================================================================
case O_ROCKET_1:
if (is_like_space(cave, x, y, GD_MV_RIGHT))
explode(cave, x, y);
break;
- // ============================================================================
+
+ // ======================================================================================
// S I M P L E C H A N G I N G; E X P L O S I O N S
- // ============================================================================
+ // ======================================================================================
case O_EXPLODE_5:
store(cave, x, y, cave->explosion_effect);