#ifndef BD_GAMEPLAY_H
#define BD_GAMEPLAY_H
-#include <glib.h>
-
#include "bd_cave.h"
#define GAME_INT_INVALID -100
-/* prepare cave, gfx buffer */
+// prepare cave, gfx buffer
#define GAME_INT_LOAD_CAVE -73
-/* show description/note of cave. */
+// show description/note of cave.
#define GAME_INT_SHOW_STORY -72
-/* waiting fire button after showing the story. */
+// waiting fire button after showing the story.
#define GAME_INT_SHOW_STORY_WAIT -71
-/* start uncovering */
+// start uncovering
#define GAME_INT_START_UNCOVER -70
-/* ...70 frames until full uncover... */
+// ...70 frames until full uncover...
#define GAME_INT_UNCOVER_ALL -1
-/* normal running state. */
+// normal running state.
#define GAME_INT_CAVE_RUNNING 0
-/* add points for remaining time */
+// add points for remaining time
#define GAME_INT_CHECK_BONUS_TIME 1
-/* ...2..99 = wait and do nothing, after adding time */
+// ...2..99 = wait and do nothing, after adding time
#define GAME_INT_WAIT_BEFORE_COVER 2
-/* start covering */
+// start covering
#define GAME_INT_COVER_START 100
-/* ... 8 frames of cover animation */
+// ... 8 frames of cover animation
#define GAME_INT_COVER_ALL 108
-typedef enum _gd_gametype
-{
- GD_GAMETYPE_NORMAL,
- GD_GAMETYPE_SNAPSHOT,
- GD_GAMETYPE_TEST,
- GD_GAMETYPE_REPLAY,
- GD_GAMETYPE_CONTINUE_REPLAY,
-} GdGameType;
typedef struct _gd_game
{
- GdString player_name; /* Name of player */
- int player_score; /* Score of player */
- int player_lives; /* Remaining lives of player */
+ GdString player_name; // Name of player
+ int player_score; // Score of player
+ int player_lives; // Remaining lives of player
GdDirection player_move;
boolean player_move_stick;
boolean player_fire;
- GdGameType type;
-
- GdCave *cave; /* Copy of the cave. This is the iterated, changed (ruined...) one */
- GdCave *original_cave; /* original cave from caveset. used to record highscore */
-
- GdReplay *replay_record;
- GdReplay *replay_from;
-
- GList *replays_recorded;
+ GdCave *cave; // Copy of the cave. This is the iterated, changed (ruined...) one
+ GdCave *original_cave; // original cave from caveset. used to record highscore
- boolean out_of_window; /* will be set to true, if player is not visible in the window, and we have to wait for scrolling */
+ boolean out_of_window; // will be set to true, if player is not visible in the window,
+ // and we have to wait for scrolling
- int cave_num; /* actual playing cave number */
- int cave_score; /* score collected in this cave */
- int level_num; /* actual playing level */
- int bonus_life_flash; /* different kind of flashing, for bonus life */
+ int cave_num; // actual playing cave number
+ int cave_score; // score collected in this cave
+ int level_num; // actual playing level
+ int bonus_life_flash; // different kind of flashing, for bonus life
- int state_counter; /* counter used to control the game flow, rendering of caves */
+ int state_counter; // counter used to control the game flow, rendering of caves
int **element_buffer;
- int **gfx_buffer; /* contains the indexes to the cells; created by *start_level, deleted by *stop_game */
+ int **last_element_buffer;
+ int **dir_buffer;
+ int **gfx_buffer; // contains the indexes to the cells;
+ // created by *start_level, deleted by *stop_game
+ int itercycle;
+ int itermax;
+ int itermax_last;
int animcycle;
int milliseconds_game;
int milliseconds_anim;
int replay_no_more_movements;
- boolean show_story; /* variable to remember that the story for a particular cave was already shown. */
+ boolean show_story; // to remember that story for a particular cave was already shown.
} GdGame;
typedef enum _gd_game_state
GD_GAME_CAVE_LOADED,
GD_GAME_NOTHING,
GD_GAME_LABELS_CHANGED,
- GD_GAME_TIMEOUT_NOW, /* this signals the moment of time out */
+ GD_GAME_TIMEOUT_NOW, // this signals the moment of time out
GD_GAME_NO_MORE_LIVES,
GD_GAME_STOP,
GD_GAME_GAME_OVER,
GdGame *gd_game_new(const int cave, const int level);
GdGame *gd_game_new_snapshot(GdCave *snapshot);
GdGame *gd_game_new_test(GdCave *cave, int level);
-GdGame *gd_game_new_replay(GdCave *cave, GdReplay *replay);
void play_game_func(GdGame *game, int action);