Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void DrawPlane(PlaneEntry plane[128][128], uint16_t horizontal_scroll_table[SCREEN_HEIGHT], uint16_t vertical_scroll, bool priority)
- {
- for (unsigned int y = 0; y < SCREEN_HEIGHT; ++y)
- {
- PlaneEntry *plane_row = plane[((vertical_scroll + y) / 8) & plane_height_mask];
- const unsigned int start_x = horizontal_scroll_table[y] / 8;
- uint8_t *indexed_framebuffer_pointer = &indexed_framebuffer[y][8 - (horizontal_scroll_table[y] % 8)];
- for (unsigned int x = 0; x < (SCREEN_WIDTH / 8) + 1; ++x)
- {
- if (
- unsigned int tile_index = plane_row[(start_x + x) & plane_width_mask].tile_index;
- unsigned int palette_index_high = plane_row[(start_x + x) & plane_width_mask].palette_line << 4;
- for (unsigned int i = 0; i < 8; ++i)
- {
- unsigned char tile_x = i;
- unsigned char tile_y = (vertical_scroll + y) % 8;
- if (plane_row[(start_x + x) & plane_width_mask].x_flip)
- tile_x = 8 - 1 - tile_x;
- if (plane_row[(start_x + x) & plane_width_mask].y_flip)
- tile_y = 8 - 1 - tile_y;
- unsigned int palette_index_low = tile_buffer[tile_index][tile_y][tile_x];
- if (palette_index_low)
- *indexed_framebuffer_pointer++ = palette_index_high | palette_index_low;
- else
- ++indexed_framebuffer_pointer;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement