Mercurial > repos > blastem
comparison vdp.c @ 32:8602ad493794
Fix horizontal sprite mirroring
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 08 Dec 2012 21:39:01 -0800 |
parents | 25016576b5f3 |
children | 0e7df84158b1 |
comparison
equal
deleted
inserted
replaced
31:25016576b5f3 | 32:8602ad493794 |
---|---|
110 uint16_t address = ((tileinfo & 0x7FF) << 5) + row * 4; | 110 uint16_t address = ((tileinfo & 0x7FF) << 5) + row * 4; |
111 int16_t x = ((context->vdpmem[att_addr+ 2] & 0x3) << 8) | context->vdpmem[att_addr + 3]; | 111 int16_t x = ((context->vdpmem[att_addr+ 2] & 0x3) << 8) | context->vdpmem[att_addr + 3]; |
112 if (x) { | 112 if (x) { |
113 x -= 128; | 113 x -= 128; |
114 int16_t base_x = x; | 114 int16_t base_x = x; |
115 int16_t dir; | |
116 if (tileinfo & MAP_BIT_H_FLIP) { | |
117 x += (width-1) * 8; | |
118 dir = -8; | |
119 } else { | |
120 dir = 8; | |
121 } | |
115 //printf("Sprite %d | x: %d, y: %d, width: %d, height: %d, pal_priority: %X, row: %d, tile addr: %X\n", context->sprite_info_list[context->cur_slot].index, x, context->sprite_info_list[context->cur_slot].y, width, height, pal_priority, row, address); | 122 //printf("Sprite %d | x: %d, y: %d, width: %d, height: %d, pal_priority: %X, row: %d, tile addr: %X\n", context->sprite_info_list[context->cur_slot].index, x, context->sprite_info_list[context->cur_slot].y, width, height, pal_priority, row, address); |
116 for (;width && context->sprite_draws; --width, x += 8) { | 123 for (int16_t i=0; i < width && context->sprite_draws; i++, x += dir) { |
117 --context->sprite_draws; | 124 --context->sprite_draws; |
118 context->sprite_draw_list[context->sprite_draws].address = address + ((x-base_x) / 8) * height * 4; | 125 context->sprite_draw_list[context->sprite_draws].address = address + i * height * 4; |
119 context->sprite_draw_list[context->sprite_draws].x_pos = x; | 126 context->sprite_draw_list[context->sprite_draws].x_pos = x; |
120 context->sprite_draw_list[context->sprite_draws].pal_priority = pal_priority; | 127 context->sprite_draw_list[context->sprite_draws].pal_priority = pal_priority; |
121 context->sprite_draw_list[context->sprite_draws].h_flip = (tileinfo & MAP_BIT_H_FLIP) ? 1 : 0; | 128 context->sprite_draw_list[context->sprite_draws].h_flip = (tileinfo & MAP_BIT_H_FLIP) ? 1 : 0; |
122 } | 129 } |
123 context->cur_slot--; | 130 context->cur_slot--; |