Still won't work

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Files at this revision

API Documentation at this revision

Comitter:
jtrux
Date:
Fri Apr 12 18:42:43 2019 +0000
Parent:
4:237c791cc5c0
Commit message:
Still won't work;

Changed in this revision

hardware.cpp Show annotated file Show diff for this revision Revisions of this file
map.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/hardware.cpp	Thu Apr 11 23:55:36 2019 +0000
+++ b/hardware.cpp	Fri Apr 12 18:42:43 2019 +0000
@@ -39,9 +39,9 @@
 GameInputs read_inputs() 
 {
     GameInputs in;
-    in.b1 = button1;
-    in.b2 = button2;
-    in.b3 = button3;
+    in.b1 = !button1;
+    in.b2 = !button2;
+    in.b3 = !button3;
     acc.readXYZGravity(&in.ax,&in.ay,&in.az);
     return in;
 }
--- a/map.cpp	Thu Apr 11 23:55:36 2019 +0000
+++ b/map.cpp	Fri Apr 12 18:42:43 2019 +0000
@@ -25,7 +25,8 @@
  * key information (x, y) into a one-dimensional unsigned integer.
  * This function should uniquely map (x,y) onto the space of unsigned integers.
  */
-static unsigned XY_KEY(int X, int Y) {
+static unsigned XY_KEY(int X, int Y)
+{
     // TODO: Fix me!
     return X + (Y*map_height());
 }
@@ -43,10 +44,10 @@
 
 void maps_init()
 {
-    // TODO: Implement!    
+    // TODO: Implement!
     // Initialize hash table
     // Set width & height
-    HashTable* ht = createHashTable(&map_hash, 50);
+    HashTable* ht = createHashTable(map_hash, 50);
     map.items = ht;
     map.w = map_width();
     map.h = map_height();
@@ -68,10 +69,8 @@
 {
     // As you add more types, you'll need to add more items to this array.
     char lookup[] = {'W', 'P'};
-    for(int y = 0; y < map_height(); y++)
-    {
-        for (int x = 0; x < map_width(); x++)
-        {
+    for(int y = 0; y < map_height(); y++) {
+        for (int x = 0; x < map_width(); x++) {
             MapItem* item = get_here(x,y);
             if (item) pc.printf("%c", lookup[item->type]);
             else pc.printf(" ");
@@ -97,25 +96,25 @@
 
 MapItem* get_north(int x, int y)
 {
-    unsigned ynew = y-1;
+    unsigned int ynew = y-1;
     return (MapItem*)getItem(map.items,XY_KEY(x,ynew));
 }
 
 MapItem* get_south(int x, int y)
 {
-    unsigned ynew = y+1;
+    unsigned int ynew = y+1;
     return (MapItem*)getItem(map.items,XY_KEY(x,ynew));
 }
 
 MapItem* get_east(int x, int y)
 {
-    unsigned xnew = x+1;
+    unsigned int xnew = x+1;
     return (MapItem*)getItem(map.items,XY_KEY(xnew,y));
 }
 
 MapItem* get_west(int x, int y)
 {
-    unsigned xnew = x-1;
+    unsigned int xnew = x-1;
     return (MapItem*)getItem(map.items,XY_KEY(xnew,y));
 }
 
@@ -127,12 +126,12 @@
 
 void map_erase(int x, int y)
 {
+    
 }
 
 void add_wall(int x, int y, int dir, int len)
 {
-    for(int i = 0; i < len; i++)
-    {
+    for(int i = 0; i < len; i++) {
         MapItem* w1 = (MapItem*) malloc(sizeof(MapItem));
         w1->type = WALL;
         w1->draw = draw_wall;