Diff from to

# spacerocks.c

` typedef struct`
` {`
` 	point_t p;`
`+	uint8_t type;`
` 	uint16_t size;`
` } rock_t;`
` `
` `
`+/** There are various types of rocks */`
`+static const int8_t rock_paths[][8*2] = {`
`+	{`
`+		-4, -2,`
`+		-4, +2,`
`+		-2, +4,`
`+		 0, +2,`
`+		+2, +4,`
`+		+4, -2,`
`+		 0, -4,`
`+		-4, -2,`
`+	},`
`+	{`
`+		-4, -2,`
`+		-3,  0,`
`+		-4, +2,`
`+		-2, +4,`
`+		+4, +2,`
`+		+2, +1,`
`+		+4, -3,`
`+		-4, -2,`
`+	},`
`+	{`
`+		-2, -4,`
`+		-4, -1,`
`+		-3, +4,`
`+		+2, +4,`
`+		+4, +1,`
`+		+3, -4,`
`+		 0, -1,`
`+		-2, -4,`
`+	},`
`+	{`
`+		-4, -2,`
`+		-4, +2,`
`+		-2, +4,`
`+		+2, +4,`
`+		+4, +2,`
`+		+4, -2,`
`+		+2, -4,`
`+		-2, -4,`
`+	},`
`+};`
`+`
`+`
`+#define NUM_ROCK_TYPES (sizeof(rock_paths) / sizeof(*rock_paths))`
`+`
`+`
` typedef struct`
` {`
` 	ship_t s;`
` 			continue;`
` 		}`
` `
`-		r->size = (rand() % 32) * 256 + 512;`
`-`
` #define MIN_RADIUS 1024`
` `
` 		// Make sure that there is space around the center`
` 		r->p.y = y;`
` 		r->p.vx = rand() % 64;`
` 		r->p.vy = rand() % 64;`
`+		r->type = rand() % NUM_ROCK_TYPES;`
`+		r->size = (rand() % 32) * 256 + 512;`
`+`
` 	}`
` }`
` `
` }`
` `
` `
`+`
` static void`
` draw_rock(`
` 	const rock_t * const r`
` 	//printf("rock %d,%d size %d\n", r->p.x/256+128, r->p.y/256+128, r->size/256);`
` `
` 	const int8_t s = r->size / 256;`
`-	int8_t path[] = {`
`-		-s, -s,`
`-		-s, +s,`
`-		+s, +s,`
`-		+s, -s,`
`-		-s, -s,`
`-	};`
`+	const int8_t * const rp = rock_paths[r->type];`
`+	int8_t path[8*2];`
`+	for (uint8_t i = 0 ; i < 16 ; i++)`
`+		path[i] = (rp[i] * s) / 4;`
` `
`-	draw_path(r->p.x / 256 + 128, r->p.y / 256 + 128, path, 5);`
`+	draw_path(r->p.x / 256 + 128, r->p.y / 256 + 128, path, 8);`
` }`
` `
` `
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.