Merge pull request #1088 from ajrhacker/copsortdma

zeroteam: Improve sprite/sprite priorities
This commit is contained in:
Olivier Galibert 2016-07-12 08:16:50 +02:00 committed by GitHub
commit 61ba533997

View File

@ -155,7 +155,7 @@ void raiden2cop_device::dma_fill()
void raiden2cop_device::dma_zsorting(UINT16 data) void raiden2cop_device::dma_zsorting(UINT16 data)
{ {
struct sort_entry { struct sort_entry {
INT16 sorting_key; INT32 sorting_key;
UINT16 val; UINT16 val;
}; };
@ -163,13 +163,13 @@ void raiden2cop_device::dma_zsorting(UINT16 data)
for(int i=0; i<data; i++) { for(int i=0; i<data; i++) {
sort_entry &e = entries[i]; sort_entry &e = entries[i];
e.val = m_host_space->read_word(cop_sort_lookup + 2*i); e.val = m_host_space->read_word(cop_sort_lookup + 2*i);
e.sorting_key = m_host_space->read_word(cop_sort_ram_addr + e.val); e.sorting_key = m_host_space->read_dword(cop_sort_ram_addr + e.val);
} }
switch(cop_sort_param) { switch(cop_sort_param) {
case 1: case 2:
std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b){ return a.sorting_key > b.sorting_key; }); std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b){ return a.sorting_key > b.sorting_key; });
break; break;
case 2: case 1:
std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b){ return a.sorting_key < b.sorting_key; }); std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b){ return a.sorting_key < b.sorting_key; });
break; break;
} }