src/mess/video/intv.c
| r12042 | r12043 | |
| 67 | 67 | |
| 68 | 68 | static int sprites_collide(intv_state *state, int spriteNum0, int spriteNum1) { |
| 69 | 69 | INT16 x1, x2, y1, y2, w1, w2, h1, h2, x0, y0, r0y, r1y, |
| 70 | | width, height, x, y; |
| 70 | width, height, x, y, x_offset,y_offset; |
| 71 | 71 | |
| 72 | 72 | intv_sprite_type* s1 = &state->m_sprite[spriteNum0]; |
| 73 | 73 | intv_sprite_type* s2 = &state->m_sprite[spriteNum1]; |
| 74 | 74 | |
| 75 | | x1 = s1->xpos-8; x2 = s2->xpos-8; |
| 76 | | y1 = (s1->ypos-8)<<1; y2 = (s2->ypos-8)<<1; |
| 75 | x_offset = state->m_col_delay - 8; |
| 76 | y_offset = state->m_row_delay - 8; |
| 77 | x1 = s1->xpos+x_offset; x2 = s2->xpos+x_offset; |
| 78 | y1 = (s1->ypos+y_offset)<<1; y2 = (s2->ypos+y_offset)<<1; |
| 77 | 79 | w1 = (s1->doublex ? 2 : 1)<<3; |
| 78 | 80 | w2 = (s2->doublex ? 2 : 1)<<3; |
| 79 | 81 | h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1)<<3; |
| r12042 | r12043 | |
| 133 | 135 | INT32 nextX; |
| 134 | 136 | INT32 nextY; |
| 135 | 137 | INT32 xInc; |
| 136 | | INT32 i, j; |
| 138 | INT32 i, j, k; |
| 137 | 139 | |
| 138 | 140 | UINT8* memory = machine.region("maincpu")->base(); |
| 139 | 141 | |
| r12042 | r12043 | |
| 159 | 161 | nextX = (s->xflip ? (s->doublex ? 15 : 7) : 0); |
| 160 | 162 | nextY = (s->yflip ? (spritePixelHeight - j - 1) : j); |
| 161 | 163 | xInc = (s->xflip ? -1: 1); |
| 162 | | state->m_sprite_buffers[i][nextX][nextY] = ((nextData & 0x0080) != 0); |
| 163 | | state->m_sprite_buffers[i][nextX + xInc][nextY] = (s->doublex |
| 164 | | ? ((nextData & 0x0080) != 0) |
| 165 | | : ((nextData & 0x0040) != 0)); |
| 166 | | state->m_sprite_buffers[i][nextX + (2*xInc)][nextY] = (s->doublex |
| 167 | | ? ((nextData & 0x0040) != 0) |
| 168 | | : ((nextData & 0x0020) != 0)); |
| 169 | | state->m_sprite_buffers[i][nextX + (3*xInc)][nextY] = (s->doublex |
| 170 | | ? ((nextData & 0x0040) != 0) |
| 171 | | : ((nextData & 0x0010) != 0)); |
| 172 | | state->m_sprite_buffers[i][nextX + (4*xInc)][nextY] = (s->doublex |
| 173 | | ? ((nextData & 0x0020) != 0) |
| 174 | | : ((nextData & 0x0008) != 0)); |
| 175 | | state->m_sprite_buffers[i][nextX + (5*xInc)][nextY] = (s->doublex |
| 176 | | ? ((nextData & 0x0020) != 0) |
| 177 | | : ((nextData & 0x0004) != 0)); |
| 178 | | state->m_sprite_buffers[i][nextX + (6*xInc)][nextY] = (s->doublex |
| 179 | | ? ((nextData & 0x0010) != 0) |
| 180 | | : ((nextData & 0x0002) != 0)); |
| 181 | | state->m_sprite_buffers[i][nextX + (7*xInc)][nextY] = (s->doublex |
| 182 | | ? ((nextData & 0x0010) != 0) |
| 183 | | : ((nextData & 0x0001) != 0)); |
| 184 | | if (!s->doublex) |
| 185 | | continue; |
| 186 | | |
| 187 | | state->m_sprite_buffers[i][nextX + (8*xInc)][nextY] = |
| 188 | | ((nextData & 0x0008) != 0); |
| 189 | | state->m_sprite_buffers[i][nextX + (9*xInc)][nextY] = |
| 190 | | ((nextData & 0x0008) != 0); |
| 191 | | state->m_sprite_buffers[i][nextX + (10*xInc)][nextY] = |
| 192 | | ((nextData & 0x0004) != 0); |
| 193 | | state->m_sprite_buffers[i][nextX + (11*xInc)][nextY] = |
| 194 | | ((nextData & 0x0004) != 0); |
| 195 | | state->m_sprite_buffers[i][nextX + (12*xInc)][nextY] = |
| 196 | | ((nextData & 0x0002) != 0); |
| 197 | | state->m_sprite_buffers[i][nextX + (13*xInc)][nextY] = |
| 198 | | ((nextData & 0x0002) != 0); |
| 199 | | state->m_sprite_buffers[i][nextX + (14*xInc)][nextY] = |
| 200 | | ((nextData & 0x0001) != 0); |
| 201 | | state->m_sprite_buffers[i][nextX + (15*xInc)][nextY] = |
| 202 | | ((nextData & 0x0001) != 0); |
| 164 | |
| 165 | for (k=0;k < 8*(1+s->doublex);k++) |
| 166 | { |
| 167 | state->m_sprite_buffers[i][nextX + k*xInc][nextY] = (nextData & (1<<(7 - k/(1 + s->doublex)))) != 0; |
| 168 | } |
| 203 | 169 | } |
| 204 | 170 | |
| 205 | 171 | } |
| r12042 | r12043 | |
| 208 | 174 | static void render_line(running_machine &machine, bitmap_t *bitmap, |
| 209 | 175 | UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) |
| 210 | 176 | { |
| 211 | | UINT32 color = (nextByte & 0x80 ? fgcolor : bgcolor); |
| 212 | | intv_plot_pixel(bitmap, x, y, color); |
| 213 | | intv_plot_pixel(bitmap, x+1, y, color); |
| 214 | | intv_plot_pixel(bitmap, x, y+1, color); |
| 215 | | intv_plot_pixel(bitmap, x+1, y+1, color); |
| 216 | | |
| 217 | | color = (nextByte & 0x40 ? fgcolor : bgcolor); |
| 218 | | intv_plot_pixel(bitmap, x+2, y, color); |
| 219 | | intv_plot_pixel(bitmap, x+3, y, color); |
| 220 | | intv_plot_pixel(bitmap, x+2, y+1, color); |
| 221 | | intv_plot_pixel(bitmap, x+3, y+1, color); |
| 222 | | |
| 223 | | color = (nextByte & 0x20 ? fgcolor : bgcolor); |
| 224 | | intv_plot_pixel(bitmap, x+4, y, color); |
| 225 | | intv_plot_pixel(bitmap, x+5, y, color); |
| 226 | | intv_plot_pixel(bitmap, x+4, y+1, color); |
| 227 | | intv_plot_pixel(bitmap, x+5, y+1, color); |
| 228 | | |
| 229 | | color = (nextByte & 0x10 ? fgcolor : bgcolor); |
| 230 | | intv_plot_pixel(bitmap, x+6, y, color); |
| 231 | | intv_plot_pixel(bitmap, x+7, y, color); |
| 232 | | intv_plot_pixel(bitmap, x+6, y+1, color); |
| 233 | | intv_plot_pixel(bitmap, x+7, y+1, color); |
| 234 | | |
| 235 | | color = (nextByte & 0x08 ? fgcolor : bgcolor); |
| 236 | | intv_plot_pixel(bitmap, x+8, y, color); |
| 237 | | intv_plot_pixel(bitmap, x+9, y, color); |
| 238 | | intv_plot_pixel(bitmap, x+8, y+1, color); |
| 239 | | intv_plot_pixel(bitmap, x+9, y+1, color); |
| 240 | | |
| 241 | | color = (nextByte & 0x04 ? fgcolor : bgcolor); |
| 242 | | intv_plot_pixel(bitmap, x+10, y, color); |
| 243 | | intv_plot_pixel(bitmap, x+11, y, color); |
| 244 | | intv_plot_pixel(bitmap, x+10, y+1, color); |
| 245 | | intv_plot_pixel(bitmap, x+11, y+1, color); |
| 246 | | |
| 247 | | color = (nextByte & 0x02 ? fgcolor : bgcolor); |
| 248 | | intv_plot_pixel(bitmap, x+12, y, color); |
| 249 | | intv_plot_pixel(bitmap, x+13, y, color); |
| 250 | | intv_plot_pixel(bitmap, x+12, y+1, color); |
| 251 | | intv_plot_pixel(bitmap, x+13, y+1, color); |
| 252 | | |
| 253 | | color = (nextByte & 0x01 ? fgcolor : bgcolor); |
| 254 | | intv_plot_pixel(bitmap, x+14, y, color); |
| 255 | | intv_plot_pixel(bitmap, x+15, y, color); |
| 256 | | intv_plot_pixel(bitmap, x+14, y+1, color); |
| 257 | | intv_plot_pixel(bitmap, x+15, y+1, color); |
| 177 | UINT32 color; |
| 178 | UINT8 i; |
| 179 | for (i=0; i<8; i++) |
| 180 | { |
| 181 | color = (nextByte & (1<<(7-i)) ? fgcolor : bgcolor); |
| 182 | intv_plot_pixel(bitmap, x+2*i, y, color); |
| 183 | intv_plot_pixel(bitmap, x+2*i+1, y, color); |
| 184 | intv_plot_pixel(bitmap, x+2*i, y+1, color); |
| 185 | intv_plot_pixel(bitmap, x+2*i+1, y+1, color); |
| 186 | } |
| 258 | 187 | } |
| 259 | 188 | |
| 260 | 189 | static void render_colored_squares(running_machine &machine, bitmap_t *bitmap, |
| r12042 | r12043 | |
| 269 | 198 | static void render_color_stack_mode(running_machine &machine, bitmap_t *bitmap) |
| 270 | 199 | { |
| 271 | 200 | intv_state *state = machine.driver_data<intv_state>(); |
| 272 | | UINT8 h, csPtr = 0, nexty = 0; |
| 273 | | UINT16 nextCard, nextx = 0; |
| 201 | UINT8 h, csPtr = 0, nexty = 2*state->m_row_delay; |
| 202 | UINT16 nextCard, nextx = 2*state->m_col_delay; |
| 274 | 203 | UINT8 *ram = machine.region("maincpu")->base(); |
| 275 | 204 | |
| 276 | 205 | for (h = 0; h < 240; h++) { |
| r12042 | r12043 | |
| 321 | 250 | } |
| 322 | 251 | } |
| 323 | 252 | nextx += 16; |
| 324 | | if (nextx == 320) { |
| 325 | | nextx = 0; |
| 253 | if (nextx >= 320) { |
| 254 | nextx = 2*state->m_col_delay; |
| 326 | 255 | nexty += 16; |
| 327 | 256 | } |
| 328 | 257 | } |
| r12042 | r12043 | |
| 331 | 260 | static void render_fg_bg_mode(running_machine &machine, bitmap_t *bitmap) |
| 332 | 261 | { |
| 333 | 262 | intv_state *state = machine.driver_data<intv_state>(); |
| 334 | | UINT8 i, j, isGrom, fgcolor, bgcolor, nexty = 0; |
| 335 | | UINT16 nextCard, memoryLocation, nextx = 0; |
| 263 | UINT8 i, j, isGrom, fgcolor, bgcolor, nexty = 2*state->m_row_delay; |
| 264 | UINT16 nextCard, memoryLocation, nextx = 2*state->m_col_delay; |
| 336 | 265 | UINT8* memory; |
| 337 | 266 | UINT8* ram = machine.region("maincpu")->base(); |
| 338 | 267 | |
| r12042 | r12043 | |
| 359 | 288 | } |
| 360 | 289 | |
| 361 | 290 | nextx += 16; |
| 362 | | if (nextx == 320) { |
| 363 | | nextx = 0; |
| 291 | if (nextx >= 320) { |
| 292 | nextx = 2*state->m_col_delay; |
| 364 | 293 | nexty += 16; |
| 365 | 294 | } |
| 366 | 295 | } |
| r12042 | r12043 | |
| 388 | 317 | (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1)<<3; |
| 389 | 318 | width = (s->doublex ? 2 : 1)<<3; |
| 390 | 319 | |
| 391 | | leftX = (s->xpos-8)<<1; |
| 392 | | nextY = (s->ypos-8)<<1; |
| 320 | leftX = (s->xpos-8+state->m_col_delay)<<1; |
| 321 | nextY = (s->ypos-8+state->m_row_delay)<<1; |
| 393 | 322 | |
| 394 | 323 | for (y = 0; y < spritePixelHeight; y++) { |
| 395 | 324 | for (x = 0; x < width; x++) { |
| r12042 | r12043 | |
| 400 | 329 | nextX = leftX + (x<<1); |
| 401 | 330 | //if the next pixel location is on the border, then we |
| 402 | 331 | //have a border collision and we can ignore painting it |
| 403 | | if (nextX < (state->m_row_delay ? 8 : 0) || nextX > 317 || |
| 404 | | nextY < (state->m_col_delay ? 16 : 0) || nextY > 191) |
| 332 | if (nextX < (state->m_left_edge_inhibit ? 16 : 0) || nextX > 317 || |
| 333 | nextY < (state->m_top_edge_inhibit ? 16: 0) || nextY > 191) |
| 405 | 334 | { |
| 406 | 335 | borderCollision = TRUE; |
| 407 | 336 | continue; |
| r12042 | r12043 | |
| 697 | 626 | { |
| 698 | 627 | intv_state *state = machine.driver_data<intv_state>(); |
| 699 | 628 | if (state->m_left_edge_inhibit) |
| 700 | | plot_box(bm, 0, 0, 16-state->m_col_delay*2, 16*12, (state->m_border_color<<1)+1); |
| 629 | plot_box(bm, 0, 0, 16, 16*12, (state->m_border_color<<1)+1); |
| 630 | else if (state->m_col_delay) |
| 631 | plot_box(bm, 0, 0, state->m_col_delay*2, 16*12, (state->m_border_color<<1)+1); |
| 701 | 632 | |
| 702 | 633 | if (state->m_top_edge_inhibit) |
| 703 | | plot_box(bm, 0, 0, 16*20, 16-state->m_row_delay*2, (state->m_border_color<<1)+1); |
| 634 | plot_box(bm, 0, 0, 16*20, 16, (state->m_border_color<<1)+1); |
| 635 | else if (state->m_row_delay) |
| 636 | plot_box(bm, 0, 0, 16*20, state->m_row_delay*2, (state->m_border_color<<1)+1); |
| 704 | 637 | } |
| 705 | 638 | |
| 706 | 639 | void intv_stic_screenrefresh(running_machine &machine) |