Przeglądaj źródła

Started implementing the Level support
Forgot to create a new branch, next changes will be on the Level branch.

Adrien Boucaud 12 lat temu
rodzic
commit
264426019e
2 zmienionych plików z 34 dodań i 7 usunięć
  1. 19 0
      init_states.c
  2. 15 7
      struct.h

+ 19 - 0
init_states.c

@@ -3,6 +3,25 @@
 void init_game(Game_Data *data)
 {
 	data->level = NULL;
+	data->level = malloc(sizeof(Level));
+	if(data->level == NULL)
+		return;
+
+	data->level->id = 1;
+	data->level->nb_patterns = 0;
+
+	data->level->cam_change_interval = 5;
+	data->level->cam_change_precision = 1;
+	data->level->cam_change_probability = 0.75;
+	data->level->cam_max_speed = 5;
+	data->level->cam_min_speed = 1;
+	data->level->fast_spin_probability = 0.1;
+
+	data->level->lc_min_score = 20;
+	data->level->lc_probability = 0.05;
+	data->level->lc_duration = 15;
+
+
 	data->list = NULL;
 	data->start_time = RTC_GetTicks(); //1 tick == 1/128 second
 	data->last_time = 0;

+ 15 - 7
struct.h

@@ -26,20 +26,28 @@ typedef struct Game_Data Game_Data;
 typedef enum {GAME, MENU, TITLE, GAME_OVER} State;
 
 struct Level{
+
+	int id; //1 to 6
+
 	//for the level generation
-	Pattern_Enum available_patterns[32][32];
+	Pattern_Enum available_patterns[32];
 
 	int nb_patterns;
 
 	//for the camera rotation
-	int change_interval; //5 seconds most of the time, but who knows...
-	int change_precision; //to add a bit of randomness to the intervals
-	float change_probability; //sometimes, there can be no change at all
-
-	float max_speed;
-	float min_speed;
+	int cam_change_interval; //5 seconds most of the time, but who knows...
+	int cam_change_precision; //to add a bit of randomness to the intervals
+	float cam_change_probability; //sometimes, there can be no change at all
+	//camera speed
+	float cam_max_speed;
+	float cam_min_speed;
 
 	float fast_spin_probability; //very low, there sometimes is a slightly faster spin for one second, then a normal spin. This is the number that allow us to generate it
+	
+	//for the line number changes (lc prefix):
+	int lc_min_score; //minimum score in seconds to reach before any line number change occurs
+	float lc_probability;
+	int lc_duration;
 };
 
 //the camera is defined by its center