Skip to content

Commit

Permalink
TINSEL: Merge the different TinselV0/V1 graphics code handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Dec 11, 2012
1 parent ee613fe commit f23e7a2
Showing 1 changed file with 25 additions and 61 deletions.
86 changes: 25 additions & 61 deletions engines/tinsel/graphics.cpp
Expand Up @@ -872,53 +872,31 @@ void DrawObject(DRAWOBJECT *pObj) {
(pObj->flags & DMA_FLIPH), packType);
}

} else if (TinselV1PSX) {
// Tinsel v1 decoders, PSX specific variants
} else { // TinselV1
switch (typeId) {
case 0x01:
case 0x41:
PsxDrawTiles(pObj, srcPtr, destPtr, typeId >= 0x40, psxFourBitClut, psxSkipBytes, psxMapperTable, true);
break;
case 0x08:
case 0x48:
PsxDrawTiles(pObj, srcPtr, destPtr, typeId >= 0x40, psxFourBitClut, psxSkipBytes, psxMapperTable, false);
break;
case 0x84:
case 0xC4:
// WrtTrans with/without clipping
WrtTrans(pObj, destPtr, typeId == 0xC4);
break;
case 0x04:
case 0x44:
// WrtConst with/without clipping
WrtConst(pObj, destPtr, typeId == 0x44);
break;
default:
error("Unknown drawing type %d", typeId);
}
} else if (TinselV1Mac) {
// Tinsel v1 Mac decoders
// TODO: Finish this
switch (typeId) {
case 0x01:
case 0x41:
// TODO
if (TinselV1PSX) {
PsxDrawTiles(pObj, srcPtr, destPtr, typeId >= 0x40, psxFourBitClut, psxSkipBytes, psxMapperTable, true);
} else if (TinselV1Mac) {
// TODO
} else if (TinselV1) {
WrtNonZero(pObj, srcPtr, destPtr, typeId >= 0x40);
} else if (TinselV0) {
t0WrtNonZero(pObj, srcPtr, destPtr, typeId >= 0x40);
}
break;
case 0x08:
case 0x48:
WrtAll(pObj, srcPtr, destPtr, typeId >= 0x40);
break;
default:
error("Unknown drawing type %d", typeId);
}
} else if (TinselV1) {
// Tinsel v1 decoders
switch (typeId) {
case 0x01:
case 0x08:
case 0x41:
case 0x48:
WrtNonZero(pObj, srcPtr, destPtr, typeId >= 0x40);
if (TinselV1PSX) {
PsxDrawTiles(pObj, srcPtr, destPtr, typeId >= 0x40, psxFourBitClut, psxSkipBytes, psxMapperTable, false);
} else if (TinselV1Mac) {
WrtAll(pObj, srcPtr, destPtr, typeId >= 0x40);
} else if (TinselV1) {
WrtNonZero(pObj, srcPtr, destPtr, typeId >= 0x40);
} else if (TinselV0) {
WrtAll(pObj, srcPtr, destPtr, typeId >= 0x40);
}
break;
case 0x04:
case 0x44:
Expand All @@ -927,26 +905,12 @@ void DrawObject(DRAWOBJECT *pObj) {
break;
case 0x84:
case 0xC4:
// WrtTrans with/without clipping
WrtTrans(pObj, destPtr, typeId == 0xC4);
break;
default:
error("Unknown drawing type %d", typeId);
}
} else {
// Tinsel v0 decoders
switch (typeId) {
case 0x01:
case 0x41:
t0WrtNonZero(pObj, srcPtr, destPtr, typeId >= 0x40);
break;
case 0x08:
case 0x48:
WrtAll(pObj, srcPtr, destPtr, typeId >= 0x40);
break;
case 0x84:
case 0xC4:
WrtTrans(pObj, destPtr, (typeId & 0x40) != 0);
if (!TinselV0) {
// WrtTrans with/without clipping
WrtTrans(pObj, destPtr, typeId == 0xC4);
} else {
WrtTrans(pObj, destPtr, (typeId & 0x40) != 0);
}
break;
default:
error("Unknown drawing type %d", typeId);
Expand Down

0 comments on commit f23e7a2

Please sign in to comment.