Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/apps/plugins/xracer/graphics.c b/apps/plugins/xracer/graphics.c
- index 1753bf5..f5f2718 100644
- --- a/apps/plugins/xracer/graphics.c
- +++ b/apps/plugins/xracer/graphics.c
- @@ -214,9 +214,9 @@ void render(struct camera_t *camera, struct road_segment *road, unsigned int roa
- struct road_segment *base = FIND_SEGMENT(camera->pos.z, road, road_length);
- - double base_percent = (double)(camera->pos.z % SEGMENT_LENGTH) / (double)SEGMENT_LENGTH;
- - double dx = - ((double)base->curve * base_percent);
- - double x = 0;
- + long base_percent = fp_div((camera->pos.z % SEGMENT_LENGTH) << FRACBITS, SEGMENT_LENGTH << FRACBITS, FRACBITS);
- + long dx = - fp_mul(base->curve << FRACBITS, base_percent, FRACBITS);
- + long x = 0;
- /* clipping height, nothing is drawn below this */
- int maxy = LCD_HEIGHT;
- @@ -232,7 +232,7 @@ void render(struct camera_t *camera, struct road_segment *road, unsigned int roa
- {
- struct road_segment *seg = &road[(base->idx + i) % road_length];
- - if(project_segment(base, seg, (int)x, (int)dx, camera, &p1, &p2, &maxy, road_length))
- + if(project_segment(base, seg, x >> FRACBITS, dx >> FRACBITS, camera, &p1, &p2, &maxy, road_length))
- render_segment(&p1, &p2, seg->color, seg->border_color, seg->lanes, seg->lane_color, seg->grass_color);
- /* curve calculation */
- x += dx;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement