diff --git a/core/vip.c b/core/vip.c index f2295f3..e722873 100644 --- a/core/vip.c +++ b/core/vip.c @@ -72,7 +72,7 @@ typedef struct { int32_t bottom, top; /* Window bounds */ int32_t gx, gp, gy; /* World screen position */ int32_t mx, mp, my; /* Background scroll */ - int32_t over; /* Overplane flag */ + uint8_t *over; /* Overplane character */ uint32_t params; /* Line parameters address */ int32_t scx, scy; /* Background dimensions */ 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->gx = SignExtend(busReadBuffer(world + 2, 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->scy = bits >> 8 & 3; 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 || by < 0 || by > wttr.bgh ) { - if (wttr.over) - continue; /* TODO: Research overplane */ - bx &= wttr.bgw; - by &= wttr.bgh; + if (wttr.over == NULL) { + bx &= wttr.bgw; + by &= wttr.bgh; + } else cell = wttr.over; } /* Locate the cell in the BG map */