static void movePos(int x1, int y1, int x2,int y2, int richting) { int ret,wall,i,bo=1; ret=1; wall=Maze[x1][y1]; if (wall&richting) { gc_sound_play_ogg ("sounds/brick.wav", NULL); ret=0; } if (ret) { gc_sound_play_ogg ("sounds/prompt.wav", NULL); if (Maze[x2][y2]&SET) { for (i=(ind); i>=0 && bo; i--) { if(position[i][0]==x2 && position[i][1]==y2) { bo=0; move_image(mazegroup,x2,y2,tuxgroup); // draw_rect(mazegroup,x2,y2,"blue"); } else { Maze[position[i][0]][position[i][1]]&=~SET; draw_rect(mazegroup, position[i][0], position[i][1], "red"); draw_combined_rect(mazegroup, position[i-1][0],position[i-1][1], position[i][0],position[i][1], "red"); ind--; } } } else { ind++; position[ind][0]=x2; position[ind][1]=y2; Maze[x2][y2]|=SET; if (position[ind][0]==(breedte-1) && position[ind][1]==(end)) { gamewon = TRUE; twoDdisplay(); gc_bonus_display(gamewon, GC_BONUS_LION); } else { draw_combined_rect(mazegroup, x1, y1, x2, y2, "green"); draw_rect(mazegroup,x1,y1,"green"); move_image(mazegroup,x2,y2,tuxgroup); } } } }
/* Get a frame from the camera. Serial protocol char: I */ void get_frame () { unsigned char ch; move_image((unsigned char *)DMA_BUF1, (unsigned char *)DMA_BUF2, (unsigned char *)FRAME_BUF, imgWidth, imgHeight); if (overlay_flag) { frame[9] = (framecount % 10) + 0x30; frame[8] = ((framecount/10)% 10) + 0x30; frame[7] = ((framecount/100)% 10) + 0x30; set_caption(frame, imgWidth); } output_start = (unsigned char *)JPEG_BUF; output_end = encode_image((unsigned char *)FRAME_BUF, output_start, quality, FOUR_TWO_TWO, imgWidth, imgHeight); image_size = (unsigned int)(output_end - output_start); led1_on(); framecount++; uart0SendString(imgHead); uart0SendChar((unsigned char)(image_size & 0x000000FF)); uart0SendChar((unsigned char)((image_size & 0x0000FF00) >> 8)); uart0SendChar((unsigned char)((image_size & 0x00FF0000) >> 16)); uart0SendChar(0x00); cp = (unsigned char *)JPEG_BUF; for (i=0; i<image_size; i++) { while (*pPORTHIO & 0x0001) { continue; } uart0SendChar(*cp++); } while (uart0GetChar(&ch)) { // flush input continue; } }