port: swap all portal vertex batches

actually fixes #43

credit to Ryan for the patch
This commit is contained in:
fgsfds 2023-08-20 15:44:01 +02:00
parent bd5d613a24
commit 933ba8a708
1 changed files with 5 additions and 1 deletions

View File

@ -1307,14 +1307,18 @@ void preprocessBgSection1(u8 *data, u32 ofs) {
++numportals;
}
s32 maxbatchnum = 0;
for (s32 i = 0; i < numportals; ++i) {
PD_SWAP_VAL(portals[i].verticesoffset);
PD_SWAP_VAL(portals[i].roomnum1);
PD_SWAP_VAL(portals[i].roomnum2);
if (portals[i].verticesoffset > maxbatchnum) {
maxbatchnum = portals[i].verticesoffset;
}
}
uintptr_t pvoffset = sizeof(portals[0]) * (numportals + 1);
for (s32 i = 0; i < numportals; i++) {
for (s32 i = 0; i <= maxbatchnum; i++) {
struct portalvertices *pverts = PD_PTR_BASE(pvoffset, portals);
for (u32 j = 0; j < pverts->count; ++j) {
PD_SWAP_VAL(pverts->vertices[j]);