Ver código fonte

Added color reversing effect at 60 seconds.

Eiyeron Fulmincendii 11 anos atrás
pai
commit
1632189b1b
8 arquivos alterados com 63 adições e 40 exclusões
  1. 2 2
      MonochromeLib.h
  2. 33 26
      Sources.def
  3. 10 7
      draw_states.c
  4. 9 0
      init_states.c
  5. 1 0
      struct.h
  6. 3 1
      update_states.c
  7. 4 3
      wall.c
  8. 1 1
      wall.h

+ 2 - 2
MonochromeLib.h

@@ -52,14 +52,14 @@
 //#define ML_VERTICAL_SCROLL
 
 #define ML_BMP_OR
-//#define ML_BMP_AND
+// #define ML_BMP_AND
 //#define ML_BMP_XOR
 #define ML_BMP_OR_CL
 //#define ML_BMP_AND_CL
 //#define ML_BMP_XOR_CL
 
 #define ML_BMP_8_OR
-//#define ML_BMP_8_AND
+#define ML_BMP_8_AND
 //#define ML_BMP_8_XOR
 #define ML_BMP_8_OR_CL
 //#define ML_BMP_8_AND_CL

+ 33 - 26
Sources.def

@@ -1,26 +1,33 @@
-##########################################################################
-#	 Application Independent Definitions
-#	 This file is auto-generated by the SimSH simulator.
-#	 Do not change this file manually;
-#	 make the changes in the project file instead.
-##########################################################################
-
-##########################################################################
-#  Application
-
-#  File name of *.pva, *.abs, *.dbg files
-TARGET=hexagon
-
-#  PV Application Title (displayed in PV menu)
-TITLE="hexagon"
-
-#  Program version (ex 0100 -> 1.00)
-VERSION=0100
-
-#  Application sources
-FILE0=hexagon
-FILE1=ECode
-FILE2=MonochromeLib
-FILE3=syscall
-
-##########################################################################
+##########################################################################
+#	 Application Independent Definitions
+#	 This file is auto-generated by the SimSH simulator.
+#	 Do not change this file manually;
+#	 make the changes in the project file instead.
+##########################################################################
+
+##########################################################################
+#  Application
+
+#  File name of *.pva, *.abs, *.dbg files
+TARGET=hexagon
+
+#  PV Application Title (displayed in PV menu)
+TITLE="hexagon"
+
+#  Program version (ex 0100 -> 1.00)
+VERSION=0100
+
+#  Application sources
+FILE0=draw_states
+FILE1=init_states
+FILE2=MonochromeLib
+FILE3=states
+FILE4=syscall
+FILE5=update_states
+FILE6=ECode
+FILE7=hexagon
+FILE8=wall
+FILE9=fixed
+FILE10=pattern
+
+##########################################################################

Diferenças do arquivo suprimidas por serem muito extensas
+ 10 - 7
draw_states.c


+ 9 - 0
init_states.c

@@ -155,6 +155,8 @@ void init_game(Game_Data *data)
 	data->level->lc_probability = 0.05;
 	data->level->lc_duration = 15;
 
+	data->are_colors_reversed = 0;
+
 
 	data->list = NULL;
 	data->start_time = RTC_GetTicks(); //1 tick == 1/128 second
@@ -170,6 +172,7 @@ void init_game(Game_Data *data)
 	data->cam.speed = 1.5;
 	data->cam.zoom = 0.0;
 
+
 	data->nb_lines = 6;
 	data->line_transition.counter = 0;
 	data->line_transition.counter_start = 0;
@@ -183,6 +186,9 @@ void init_title(Game_Data *data)
 	data->current_time = RTC_GetTicks();
 	data->chrono_time = 0;
 
+	data->are_colors_reversed = 0;
+
+
 	data->cam.cX = 96;
 	data->cam.cY = 32;
 	data->cam.angle = 0;
@@ -202,6 +208,9 @@ void init_menu(Game_Data *data)
 	data->current_time = RTC_GetTicks();
 	data->chrono_time = 0;
 
+	data->are_colors_reversed = 0;
+
+
 	data->cam.cX = 64;
 	data->cam.cY = 64;
 	data->cam.angle = 0;

+ 1 - 0
struct.h

@@ -94,6 +94,7 @@ struct Game_Data{
 
 	Wall *list;
 
+	unsigned char are_colors_reversed;
 	Level *level;
 
 	Camera cam;

+ 3 - 1
update_states.c

@@ -23,6 +23,9 @@ void update_game(Game_Data *data)
 	data->last_time = data->current_time;
 	data->current_time = RTC_GetTicks();
 	data->chrono_time += (data->current_time - data->last_time)/ 128.;
+	if(data->chrono_time >= 60) {
+		data->are_colors_reversed = 1;
+	}
 
 	if(data->list != NULL) {
 	//if the linked list is not empty
@@ -32,7 +35,6 @@ void update_game(Game_Data *data)
 		//if the player and a wall collide
 		if(isColliding(data->list, data->player_angle, data->nb_lines) == true) {
 			//death handling
-			PrintMini(50, 0, "TOUCHE", MINI_OVER);
 		}
 	//remove every wall whose distance to the center equals zero
 		data->list = removeWall(data->list, 8);

+ 4 - 3
wall.c

@@ -82,10 +82,11 @@ void updateWalls(Wall *list, unsigned int delta_time)
 	}while(tmp != NULL);
 }
 
-void drawWalls(Wall *list, Camera *cam, int nb_lines, Line_Transition line_transition)
+void drawWalls(Wall *list, Game_Data *data, int nb_lines, Line_Transition line_transition)
 {//NEEDS A COMPLETE REWRITE TO SUPPORT THE LINE TRANSITIONS !
 	Wall *tmp;
-
+	ML_Color drawing_color = data->are_colors_reversed ? WHITE : BLACK;
+	Camera *cam = &data->cam;
 	fix coeff = 0;
 	fix transition_angle = 0;
 	fix delta_angle = fdiv(FIX(360), FIX(nb_lines));
@@ -117,7 +118,7 @@ void drawWalls(Wall *list, Camera *cam, int nb_lines, Line_Transition line_trans
 				fix dist = ftofix(tmp->d + cam->zoom);
 				for(i = 0; i < tmp->h && dist > FIX(8); ++i) {
 					if(dist < FIX(96))
-					ML_line(64 + fixtof(fmul(dist, cos1)), 32 + fixtof(fmul(dist,sin1)), 64 + fixtof(fmul(dist, cos2)), 32 + fixtof(fmul(dist, sin2)), BLACK);
+					ML_line(64 + fixtof(fmul(dist, cos1)), 32 + fixtof(fmul(dist,sin1)), 64 + fixtof(fmul(dist, cos2)), 32 + fixtof(fmul(dist, sin2)), drawing_color);
 					dist -= FIX(1);
 				}
 			}

+ 1 - 1
wall.h

@@ -10,7 +10,7 @@ Wall *addWall(Wall *list, int d, int h, int id, int line);//returns a new pointe
 Wall *removeWall(Wall *list, int d); //returns a new pointer to the first element
 
 //show the ll "list"
-void drawWalls(Wall *list, Camera *cam, int nb_lines, Line_Transition line_transition);
+void drawWalls(Wall *list, Game_Data *data, int nb_lines, Line_Transition line_transition);
 //updates the ll "list"
 void updateWalls(Wall *list, unsigned int delta_time);
 //simple collision test. Returns true if a Wall from the list collides with the player

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff