Guest User

Untitled

a guest
Jan 20th, 2015
196
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/apps/plugins/xracer/graphics.c b/apps/plugins/xracer/graphics.c
  2. index 1753bf5..f5f2718 100644
  3. --- a/apps/plugins/xracer/graphics.c
  4. +++ b/apps/plugins/xracer/graphics.c
  5. @@ -214,9 +214,9 @@ void render(struct camera_t *camera, struct road_segment *road, unsigned int roa
  6.  
  7. struct road_segment *base = FIND_SEGMENT(camera->pos.z, road, road_length);
  8.  
  9. - double base_percent = (double)(camera->pos.z % SEGMENT_LENGTH) / (double)SEGMENT_LENGTH;
  10. - double dx = - ((double)base->curve * base_percent);
  11. - double x = 0;
  12. + long base_percent = fp_div((camera->pos.z % SEGMENT_LENGTH) << FRACBITS, SEGMENT_LENGTH << FRACBITS, FRACBITS);
  13. + long dx = - fp_mul(base->curve << FRACBITS, base_percent, FRACBITS);
  14. + long x = 0;
  15.  
  16. /* clipping height, nothing is drawn below this */
  17. int maxy = LCD_HEIGHT;
  18. @@ -232,7 +232,7 @@ void render(struct camera_t *camera, struct road_segment *road, unsigned int roa
  19. {
  20. struct road_segment *seg = &road[(base->idx + i) % road_length];
  21.  
  22. - if(project_segment(base, seg, (int)x, (int)dx, camera, &p1, &p2, &maxy, road_length))
  23. + if(project_segment(base, seg, x >> FRACBITS, dx >> FRACBITS, camera, &p1, &p2, &maxy, road_length))
  24. render_segment(&p1, &p2, seg->color, seg->border_color, seg->lanes, seg->lane_color, seg->grass_color);
  25. /* curve calculation */
  26. x += dx;
RAW Paste Data