trunk/src/mame/drivers/raiden2.c
| r31969 | r31970 | |
| 526 | 526 | |
| 527 | 527 | void raiden2_state::cop_collision_read_xy(address_space &space, int slot, UINT32 spradr) |
| 528 | 528 | { |
| 529 | | cop_collision_info[slot].y = space.read_dword(spradr+4); |
| 530 | | cop_collision_info[slot].x = space.read_dword(spradr+8); |
| 529 | cop_collision_info[slot].x = space.read_dword(spradr+4); |
| 530 | cop_collision_info[slot].y = space.read_dword(spradr+8); |
| 531 | cop_collision_info[slot].z = space.read_dword(spradr+12); |
| 531 | 532 | } |
| 532 | 533 | |
| 533 | 534 | void raiden2_state::cop_collision_update_hitbox(address_space &space, int slot, UINT32 hitadr) |
| 534 | 535 | { |
| 535 | | UINT32 hitadr2 = space.read_dword(hitadr) + (cop_hit_baseadr << 16); |
| 536 | | UINT32 hitbox_raw = space.read_dword(hitadr2); |
| 536 | UINT32 hitadr2 = space.read_word(hitadr) | (cop_hit_baseadr << 16); |
| 537 | 537 | |
| 538 | | INT8 hx = hitbox_raw; |
| 539 | | UINT8 hw = hitbox_raw >> 8; |
| 540 | | INT8 hy = hitbox_raw >> 16; |
| 541 | | UINT8 hh = hitbox_raw >> 24; |
| 538 | INT8 hx = space.read_byte(hitadr2++); |
| 539 | UINT8 hw = space.read_byte(hitadr2++); |
| 540 | INT8 hy = space.read_byte(hitadr2++); |
| 541 | UINT8 hh = space.read_byte(hitadr2++); |
| 542 | INT8 hz = space.read_byte(hitadr2++); |
| 543 | UINT8 hd = space.read_byte(hitadr2++); |
| 542 | 544 | |
| 543 | 545 | cop_collision_info[slot].min_x = (cop_collision_info[slot].x >> 16) + hx; |
| 544 | 546 | cop_collision_info[slot].min_y = (cop_collision_info[slot].y >> 16) + hy; |
| 547 | cop_collision_info[slot].min_z = (cop_collision_info[slot].z >> 16) + hz; |
| 545 | 548 | cop_collision_info[slot].max_x = cop_collision_info[slot].min_x + hw; |
| 546 | 549 | cop_collision_info[slot].max_y = cop_collision_info[slot].min_y + hh; |
| 550 | cop_collision_info[slot].max_z = cop_collision_info[slot].min_z + hd; |
| 547 | 551 | |
| 548 | | cop_hit_status = 3; |
| 552 | cop_hit_status = 7; |
| 549 | 553 | |
| 550 | 554 | /* outbound X check */ |
| 551 | 555 | if(cop_collision_info[0].max_x >= cop_collision_info[1].min_x && cop_collision_info[0].min_x <= cop_collision_info[1].max_x) |
| 552 | | cop_hit_status &= ~2; |
| 556 | cop_hit_status &= ~1; |
| 553 | 557 | |
| 554 | 558 | /* outbound Y check */ |
| 555 | 559 | if(cop_collision_info[0].max_y >= cop_collision_info[1].min_y && cop_collision_info[0].min_y <= cop_collision_info[1].max_y) |
| 556 | | cop_hit_status &= ~1; |
| 560 | cop_hit_status &= ~2; |
| 557 | 561 | |
| 562 | /* outbound Z check */ |
| 563 | if(cop_collision_info[0].max_z >= cop_collision_info[1].min_z && cop_collision_info[0].min_z <= cop_collision_info[1].max_z) |
| 564 | cop_hit_status &= ~4; |
| 565 | |
| 558 | 566 | cop_hit_val_x = (cop_collision_info[0].x - cop_collision_info[1].x) >> 16; |
| 559 | 567 | cop_hit_val_y = (cop_collision_info[0].y - cop_collision_info[1].y) >> 16; |
| 560 | | cop_hit_val_z = 1; |
| 568 | cop_hit_val_z = (cop_collision_info[0].z - cop_collision_info[1].z) >> 16; |
| 561 | 569 | cop_hit_val_unk = cop_hit_status; // TODO: there's also bit 2 and 3 triggered in the tests, no known meaning |
| 562 | 570 | } |
| 563 | 571 | |