Henry Triff / Mbed 2 deprecated ELEC2645_Project_el18ht

Dependencies:   mbed

Revision:
7:2ce6e90f6d47
Parent:
6:5f76dd718dc3
Child:
9:7b1093d3f03a
diff -r 5f76dd718dc3 -r 2ce6e90f6d47 Graphics/Graphics.cpp
--- a/Graphics/Graphics.cpp	Wed Feb 19 21:40:21 2020 +0000
+++ b/Graphics/Graphics.cpp	Sat Feb 22 23:13:25 2020 +0000
@@ -15,7 +15,56 @@
     {4,4,4,4,4,4,1,1},
 };
 
-int car[8][8] = {
+//CARS
+
+int basic_car[8][8] = {
+    {4,4,4,4,4,4,4,4},
+    {4,4,4,4,4,4,4,4},
+    {4,4,1,1,1,1,4,4},
+    {4,1,0,0,0,0,1,4},
+    {4,1,0,0,0,0,1,4},
+    {1,0,0,0,0,0,0,1},
+    {1,1,1,1,1,1,1,1},
+    {1,1,4,4,4,4,1,1},
+
+};
+
+int offroad_car[8][8] = {
+    {4,4,4,4,4,4,4,4},
+    {4,1,1,1,1,1,1,4},
+    {4,1,0,1,1,0,1,4},
+    {4,1,1,0,0,1,1,4},
+    {4,1,1,0,0,1,1,4},
+    {1,1,0,1,1,0,1,1},
+    {1,1,1,1,1,1,1,1},
+    {1,1,4,4,4,4,1,1}
+};
+
+int drifter_car[8][8] = {
+    {4,4,4,4,4,4,4,4},
+    {1,1,4,4,4,4,1,1},
+    {4,4,1,1,1,1,4,4},
+    {4,1,0,0,0,0,1,4},
+    {4,1,0,0,0,0,1,4},
+    {1,4,1,1,1,1,4,1},
+    {1,1,1,1,1,1,1,1},
+    {1,4,4,4,4,4,4,1},
+
+};
+
+int sports_car[8][8] = {
+    {4,4,4,4,4,4,4,4},
+    {4,4,4,4,4,4,4,4},
+    {4,4,4,4,4,4,4,4},
+    {1,1,4,4,4,4,1,1},
+    {4,4,1,1,1,1,4,4},
+    {4,1,0,0,0,0,1,4},
+    {1,1,1,1,1,1,1,1},
+    {1,1,4,4,4,4,1,1},
+
+};
+
+int race_car[8][8] = {
     {4,4,4,4,4,4,4,4},
     {4,4,4,4,4,4,4,4},
     {4,1,1,1,1,1,1,4},
@@ -26,6 +75,17 @@
     {1,4,1,1,1,1,4,1},
 };
 
+int stupid_car[8][8] = {
+    {4,4,4,4,4,4,4,4},
+    {4,4,4,1,1,4,4,4},
+    {4,4,1,0,0,1,4,4},
+    {4,1,1,0,0,1,1,4},
+    {1,0,1,1,1,1,0,1},
+    {1,0,0,0,0,0,0,1},
+    {4,1,1,1,1,1,1,4},
+    {4,4,4,4,4,4,4,4}
+};
+
 int ghost[8][8] = {
     {0,0,4,4,4,4,0,0},
     {0,1,0,4,4,0,1,0},
@@ -141,9 +201,9 @@
 //  MAIN GRAPHICS FUNCTION
 //**************************
 
-void Graphics::Draw_Map(Point_2D translation, int angle, float squish, Line_2D *Track_Lines, Line_2D *Track_Dotted_Lines, Line_2D *Track_Walls, Point_2D *Track_Flags, Triangle_2D *Track_Boost_Plates, Map_Data map_info, Point_2D ghost_position, N5110 &LCD)
+void Graphics::Draw_Map(Point_2D translation, int angle, float squish, Line_2D *Track_Lines, Line_2D *Track_Dotted_Lines, Line_2D *Track_Walls, Point_2D *Track_Flags, Triangle_2D *Track_Boost_Plates, Map_Data map_info, int car_type, Point_2D ghost_position, N5110 &LCD)
 {
-
+    enum cars {Basic, Offroad, Drifter, Sportscar, Racecar, Stupid};
     Line_2D Track_Lines_Transformed[map_info.number_of_track_lines];
     Line_2D Track_Dotted_Lines_Transformed[map_info.number_of_dotted_lines];
     Point_2D Transformed_Flags[map_info.number_of_flags];
@@ -230,7 +290,20 @@
     }
 
     Point_2D car_position = {4,0};
-    Graphics_Draw_Sprite(car_position,8,8,(int *)car, LCD);
+    
+    if(car_type == Stupid) {
+        Graphics_Draw_Sprite(car_position,8,8,(int *)stupid_car, LCD);
+    } else if(car_type == Racecar) {
+        Graphics_Draw_Sprite(car_position,8,8,(int *)race_car, LCD);
+    } else if(car_type == Sportscar) {
+        Graphics_Draw_Sprite(car_position,8,8,(int *)sports_car, LCD);
+    } else if(car_type == Drifter) {
+        Graphics_Draw_Sprite(car_position,8,8,(int *)drifter_car, LCD);
+    } else if(car_type == Offroad) {
+        Graphics_Draw_Sprite(car_position,8,8,(int *)offroad_car, LCD);
+    } else {
+        Graphics_Draw_Sprite(car_position,8,8,(int *)basic_car, LCD);
+    }
 }
 
 //*******************
@@ -642,7 +715,7 @@
     Graphics_Draw_Line(boost_plate_TR, boost_plate_BR, true, LCD);
     Graphics_Draw_Line(boost_plate_BR, boost_plate_BL, true, LCD);
     Graphics_Draw_Line(boost_plate_BL, boost_plate_TL, true, LCD);
-    
+
     if(boost_plate.Type == 1) {
         Graphics_Draw_Line(boost_plate_TL, boost_plate_mid, true, LCD);
         Graphics_Draw_Line(boost_plate_BL, boost_plate_mid, true, LCD);