Fix overplane

This commit is contained in:
Guy Perfect 2024-10-26 15:04:27 -05:00
parent 67bcb6d508
commit da001e02cd
1 changed files with 7 additions and 6 deletions

View File

@ -72,7 +72,7 @@ typedef struct {
int32_t bottom, top; /* Window bounds */ int32_t bottom, top; /* Window bounds */
int32_t gx, gp, gy; /* World screen position */ int32_t gx, gp, gy; /* World screen position */
int32_t mx, mp, my; /* Background scroll */ int32_t mx, mp, my; /* Background scroll */
int32_t over; /* Overplane flag */ uint8_t *over; /* Overplane character */
uint32_t params; /* Line parameters address */ uint32_t params; /* Line parameters address */
int32_t scx, scy; /* Background dimensions */ int32_t scx, scy; /* Background dimensions */
int32_t w, h; /* Window size */ int32_t w, h; /* Window size */
@ -682,7 +682,8 @@ static int vipParseWorld(VB*sim,uint8_t*world,uint16_t bits,WorldAttribs*attr){
attr->bg = (uint8_t *) BG_TEMPLATES[bits >> 8 & 15]; attr->bg = (uint8_t *) BG_TEMPLATES[bits >> 8 & 15];
attr->gx = SignExtend(busReadBuffer(world + 2, VB_U16), 10); attr->gx = SignExtend(busReadBuffer(world + 2, VB_U16), 10);
attr->gp = SignExtend(busReadBuffer(world + 4, VB_U16), 10); attr->gp = SignExtend(busReadBuffer(world + 4, VB_U16), 10);
attr->over = bits >> 7 & 1; attr->over = (bits & 0x0080) == 0 ? NULL :
&sim->vip.ram[0x00020000 | busReadBuffer(world + 10, VB_U16) << 1];
attr->scx = bits >> 10 & 3; attr->scx = bits >> 10 & 3;
attr->scy = bits >> 8 & 3; attr->scy = bits >> 8 & 3;
attr->bgw = (1 << attr->scx) - 1; attr->bgw = (1 << attr->scx) - 1;
@ -886,10 +887,10 @@ static void vipDrawWorld(VB *sim, uint8_t *world, uint16_t bits) {
bx < 0 || bx > wttr.bgw || bx < 0 || bx > wttr.bgw ||
by < 0 || by > wttr.bgh by < 0 || by > wttr.bgh
) { ) {
if (wttr.over) if (wttr.over == NULL) {
continue; /* TODO: Research overplane */ bx &= wttr.bgw;
bx &= wttr.bgw; by &= wttr.bgh;
by &= wttr.bgh; } else cell = wttr.over;
} }
/* Locate the cell in the BG map */ /* Locate the cell in the BG map */