summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8fdd23c)
Using the BD game engine with classic scheduling types like "BD1" may
result in alternating numbers of frames per iteration cycle due to
dynamic game speed calculations (like alternating between 7 and 8
frames per iteration), so always using the last maximum number of
cycle frames (to adjust to dynamically changing game speed) results in
always using the wrong number of frames per iteration cycle, causing
less smooth movement animations (due to little stops or jumps for each
iteration cycle movement animation).
Storing the last maximum number of cycle frames for even and odd
cycles separately can improve this by using the "right" number of
cycle frames even if they are alternating between two values.
game->milliseconds_anim = 0;
game->milliseconds_game = 0; // set game timer to zero, too
game->milliseconds_anim = 0;
game->milliseconds_game = 0; // set game timer to zero, too
+ game->cycle_counter = 0;
+
// create new element buffer
game->element_buffer = gd_cave_map_new(game->cave, int);
// create new element buffer
game->element_buffer = gd_cave_map_new(game->cave, int);
- // store last maximum number of cycles (to force redraw if changed)
+ // store last maximum number of cycle frames (to force redraw if changed)
game->itermax_last = game->itermax;
game->itermax_last = game->itermax;
- // update maximum number of cycles (frame) per cave iteration
- game->itermax = game->itercycle;
+ // store maximum number of cycle frames separately for even and odd cycles
+ game->itermax2[game->cycle_counter % 2] = game->itercycle;
+
+ // update maximum number of cycle frames per cave iteration
+ game->itermax = game->itermax2[!(game->cycle_counter % 2)];
- // reset cycle (frame) counter for the next cave iteration
+ // reset cycle frame counter for the next cave iteration
game->itercycle = 0;
iterate_cave(game, game->player_move, game->player_fire);
game->itercycle = 0;
iterate_cave(game, game->player_move, game->player_fire);
+ game->cycle_counter++;
+
if (game->player_move == GD_MV_STILL)
{
game->player_move_stick = FALSE;
if (game->player_move == GD_MV_STILL)
{
game->player_move_stick = FALSE;
int itercycle;
int itermax;
int itermax_last;
int itercycle;
int itermax;
int itermax_last;
int animcycle;
int milliseconds_game;
int milliseconds_anim;
int animcycle;
int milliseconds_game;
int milliseconds_anim;
int replay_no_more_movements;
boolean show_story; // to remember that story for a particular cave was already shown.
int replay_no_more_movements;
boolean show_story; // to remember that story for a particular cave was already shown.
game_bd.game->itercycle = 0;
game_bd.game->itermax = 8; // default; dynamically changed at runtime
game_bd.game->itermax_last = game_bd.game->itermax;
game_bd.game->itercycle = 0;
game_bd.game->itermax = 8; // default; dynamically changed at runtime
game_bd.game->itermax_last = game_bd.game->itermax;
+ game_bd.game->itermax2[0] = game_bd.game->itermax;
+ game_bd.game->itermax2[1] = game_bd.game->itermax;
game_bd.player_moving = FALSE;
game_bd.player_snapping = FALSE;
game_bd.player_moving = FALSE;
game_bd.player_snapping = FALSE;