[Scummvm-git-logs] scummvm master -> befd3b3511477b946e8a51b2809f4c1b1d3c2ef7
AndywinXp
noreply at scummvm.org
Tue Sep 27 22:12:58 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
befd3b3511 JANITORIAL: SCUMM: Costume renderer and AKOS labeling
Commit: befd3b3511477b946e8a51b2809f4c1b1d3c2ef7
https://github.com/scummvm/scummvm/commit/befd3b3511477b946e8a51b2809f4c1b1d3c2ef7
Author: AndywinXp (andywinxp at gmail.com)
Date: 2022-09-28T00:12:52+02:00
Commit Message:
JANITORIAL: SCUMM: Costume renderer and AKOS labeling
This commit:
- Continues my AKOS relabeling task and adds some documentation and missing information;
- Renames the codec functions from codec1, codec5 and codec16 to something more expressive;
- Add '_' in front of private class members, when missing;
- Changes "v1" names (unnamed variables supposedly coming from Ghidra or similar tools...) to something more expressive;
- Renames related variables from foo_bar (or foobar) to fooBar (on costume.cpp, base-costume.cpp and akos.cpp).
Changed paths:
engines/scumm/actor.cpp
engines/scumm/akos.cpp
engines/scumm/akos.h
engines/scumm/base-costume.cpp
engines/scumm/base-costume.h
engines/scumm/costume.cpp
engines/scumm/costume.h
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 6ff20197e51..d0252794b92 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -2366,8 +2366,8 @@ void Actor::drawActorCostume(bool hitTestMode) {
if (!hitTestMode) {
// Record the vertical extent of the drawn actor
- _top = bcr->_draw_top;
- _bottom = bcr->_draw_bottom;
+ _top = bcr->_drawTop;
+ _bottom = bcr->_drawBottom;
}
}
@@ -2385,9 +2385,9 @@ void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
bcr->_scaleY = _scaley;
}
- bcr->_shadow_mode = _shadowMode;
+ bcr->_shadowMode = _shadowMode;
if (_vm->_game.version >= 5 && _vm->_game.heversion == 0) {
- bcr->_shadow_table = _vm->_shadowPalette;
+ bcr->_shadowTable = _vm->_shadowPalette;
}
bcr->setCostume(_costume, (_vm->_game.heversion == 0) ? 0 : _heXmapNum);
@@ -2418,8 +2418,8 @@ void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
}
- bcr->_draw_top = 0x7fffffff;
- bcr->_draw_bottom = 0;
+ bcr->_drawTop = 0x7fffffff;
+ bcr->_drawBottom = 0;
}
void ActorHE::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
@@ -2434,7 +2434,7 @@ void ActorHE::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
bcr->_clipOverride = _clipOverride;
if (_vm->_game.heversion == 70) {
- bcr->_shadow_table = _vm->_HEV7ActorPalette;
+ bcr->_shadowTable = _vm->_HEV7ActorPalette;
}
bcr->_skipLimbs = (_heSkipLimbs != 0);
diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp
index e43c10a3bc4..51051277d30 100644
--- a/engines/scumm/akos.cpp
+++ b/engines/scumm/akos.cpp
@@ -36,12 +36,12 @@ namespace Scumm {
#include "common/pack-start.h" // START STRUCT PACKING
struct AkosHeader {
- byte unk_1[2];
- byte flags;
- byte unk_2;
- uint16 num_anims;
- uint16 unk_3;
- uint16 codec;
+ uint16 versionNumber;
+ uint16 costumeFlags;
+ uint16 choreCount;
+ uint16 celsCount;
+ uint16 celCompressionCodec;
+ uint16 layerCount;
} PACKED_STRUCT;
struct AkosOffset {
@@ -86,10 +86,10 @@ bool AkosCostumeLoader::hasManyDirections() {
const AkosHeader *akhd;
akhd = (const AkosHeader *)_vm->findResourceData(MKTAG('A','K','H','D'), _akos);
- return (akhd->flags & 2) != 0;
+ return (akhd->costumeFlags & 2) != 0;
}
-void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
+void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint useMask) {
uint anim;
const byte *r;
const AkosHeader *akhd;
@@ -111,7 +111,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
akhd = (const AkosHeader *)_vm->findResourceData(MKTAG('A','K','H','D'), _akos);
- if (anim >= READ_LE_UINT16(&akhd->num_anims))
+ if (anim >= READ_LE_UINT16(&akhd->choreCount))
return;
r = _vm->findResourceData(MKTAG('A','K','C','H'), _akos);
@@ -133,7 +133,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
const uint8 *aksf = aksfPtr;
code = *r++;
- if (usemask & AKC_ExtendWordBit) {
+ if (useMask & AKC_ExtendWordBit) {
switch (code) {
case 1:
a->_cost.animType[i] = AKAT_Empty;
@@ -224,14 +224,14 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
}
i++;
mask <<= 1;
- usemask <<= 1;
+ useMask <<= 1;
} while ((uint16)mask);
}
void AkosRenderer::setPalette(uint16 *new_palette) {
uint size, i;
- size = _vm->getResourceDataSize(akpl);
+ size = _vm->getResourceDataSize(_akpl);
if (size == 0)
return;
@@ -241,12 +241,12 @@ void AkosRenderer::setPalette(uint16 *new_palette) {
if (_vm->_game.features & GF_16BIT_COLOR) {
if (_paletteNum) {
for (i = 0; i < size; i++)
- _palette[i] = READ_LE_UINT16(_vm->_hePalettes + _paletteNum * _vm->_hePaletteSlot + 768 + akpl[i] * 2);
- } else if (rgbs) {
+ _palette[i] = READ_LE_UINT16(_vm->_hePalettes + _paletteNum * _vm->_hePaletteSlot + 768 + _akpl[i] * 2);
+ } else if (_rgbs) {
for (i = 0; i < size; i++) {
if (new_palette[i] == 0xFF) {
- uint8 col = akpl[i];
- _palette[i] = _vm->get16BitColor(rgbs[col * 3 + 0], rgbs[col * 3 + 1], rgbs[col * 3 + 2]);
+ uint8 col = _akpl[i];
+ _palette[i] = _vm->get16BitColor(_rgbs[col * 3 + 0], _rgbs[col * 3 + 1], _rgbs[col * 3 + 2]);
} else {
_palette[i] = new_palette[i];
}
@@ -254,10 +254,10 @@ void AkosRenderer::setPalette(uint16 *new_palette) {
}
} else if (_vm->_game.heversion >= 99 && _paletteNum) {
for (i = 0; i < size; i++)
- _palette[i] = (byte)_vm->_hePalettes[_paletteNum * _vm->_hePaletteSlot + 768 + akpl[i]];
+ _palette[i] = (byte)_vm->_hePalettes[_paletteNum * _vm->_hePaletteSlot + 768 + _akpl[i]];
} else {
for (i = 0; i < size; i++) {
- _palette[i] = new_palette[i] != 0xFF ? new_palette[i] : akpl[i];
+ _palette[i] = new_palette[i] != 0xFF ? new_palette[i] : _akpl[i];
}
}
@@ -280,27 +280,27 @@ void AkosRenderer::setCostume(int costume, int shadow) {
const byte *akos = _vm->getResourceAddress(rtCostume, costume);
assert(akos);
- akhd = (const AkosHeader *) _vm->findResourceData(MKTAG('A','K','H','D'), akos);
- akof = (const AkosOffset *) _vm->findResourceData(MKTAG('A','K','O','F'), akos);
- akci = _vm->findResourceData(MKTAG('A','K','C','I'), akos);
- aksq = _vm->findResourceData(MKTAG('A','K','S','Q'), akos);
- akcd = _vm->findResourceData(MKTAG('A','K','C','D'), akos);
- akpl = _vm->findResourceData(MKTAG('A','K','P','L'), akos);
- _codec = READ_LE_UINT16(&akhd->codec);
- akct = _vm->findResourceData(MKTAG('A','K','C','T'), akos);
- rgbs = _vm->findResourceData(MKTAG('R','G','B','S'), akos);
-
- xmap = nullptr;
+ _akhd = (const AkosHeader *)_vm->findResourceData(MKTAG('A','K','H','D'), akos);
+ _akof = (const AkosOffset *)_vm->findResourceData(MKTAG('A','K','O','F'), akos);
+ _akci = _vm->findResourceData(MKTAG('A','K','C','I'), akos);
+ _aksq = _vm->findResourceData(MKTAG('A','K','S','Q'), akos);
+ _akcd = _vm->findResourceData(MKTAG('A','K','C','D'), akos);
+ _akpl = _vm->findResourceData(MKTAG('A','K','P','L'), akos);
+ _codec = READ_LE_UINT16(&_akhd->celCompressionCodec);
+ _akct = _vm->findResourceData(MKTAG('A','K','C','T'), akos);
+ _rgbs = _vm->findResourceData(MKTAG('R','G','B','S'), akos);
+
+ _xmap = nullptr;
if (shadow) {
const uint8 *xmapPtr = _vm->getResourceAddress(rtImage, shadow);
assert(xmapPtr);
- xmap = _vm->findResourceData(MKTAG('X','M','A','P'), xmapPtr);
- assert(xmap);
+ _xmap = _vm->findResourceData(MKTAG('X','M','A','P'), xmapPtr);
+ assert(_xmap);
}
}
void AkosRenderer::setFacing(const Actor *a) {
- _mirror = (newDirToOldDir(a->getFacing()) != 0 || akhd->flags & 1);
+ _mirror = (newDirToOldDir(a->getFacing()) != 0 || _akhd->costumeFlags & 1);
if (a->_flip)
_mirror = !_mirror;
}
@@ -313,7 +313,7 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
const CostumeInfo *costumeInfo;
uint i, extra;
byte result = 0;
- int xmoveCur, ymoveCur;
+ int xMoveCur, yMoveCur;
uint32 heCondMaskIndex[32];
bool useCondMask;
int lastDx, lastDy;
@@ -329,18 +329,18 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
if (_vm->_game.heversion >= 70 && cost.animType[limb] == AKAT_DeltaAnim)
return 0;
- if (!cost.animType[limb] || cost.stopped & (1 << limb))
+ if (cost.animType[limb] == AKAT_Empty || cost.stopped & (1 << limb))
return 0;
useCondMask = false;
- p = aksq + cost.curpos[limb];
+ p = _aksq + cost.curpos[limb];
code = p[0];
if (code & AKC_ExtendBit)
code = READ_BE_UINT16(p);
if (_vm->_game.heversion >= 90)
- _shadow_mode = 0;
+ _shadowMode = 0;
if (code == AKC_CondDrawMany || code == AKC_CondRelativeOffsetDrawMany) {
uint16 s = cost.curpos[limb] + 4;
@@ -349,7 +349,7 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
uint8 n = extra;
assert(n <= ARRAYSIZE(heCondMaskIndex));
while (n--) {
- heCondMaskIndex[j++] = aksq[s++];
+ heCondMaskIndex[j++] = _aksq[s++];
}
useCondMask = true;
p += extra + 2;
@@ -360,30 +360,30 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
return 0;
if (code != AKC_DrawMany && code != AKC_RelativeOffsetDrawMany) {
- off = akof + (code & 0xFFF);
+ off = _akof + (code & AKC_CelMask);
- assert((code & 0xFFF) * 6 < READ_BE_UINT32((const byte *)akof - 4) - 8);
+ assert((code & AKC_CelMask) * 6 < READ_BE_UINT32((const byte *)_akof - 4) - 8);
assert((code & 0x7000) == 0);
- _srcptr = akcd + READ_LE_UINT32(&off->akcd);
- costumeInfo = (const CostumeInfo *) (akci + READ_LE_UINT16(&off->akci));
+ _srcPtr = _akcd + READ_LE_UINT32(&off->akcd);
+ costumeInfo = (const CostumeInfo *) (_akci + READ_LE_UINT16(&off->akci));
_width = READ_LE_UINT16(&costumeInfo->width);
_height = READ_LE_UINT16(&costumeInfo->height);
- xmoveCur = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x);
- ymoveCur = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y);
- _xmove += (int16)READ_LE_UINT16(&costumeInfo->move_x);
- _ymove -= (int16)READ_LE_UINT16(&costumeInfo->move_y);
+ xMoveCur = _xMove + (int16)READ_LE_UINT16(&costumeInfo->relX);
+ yMoveCur = _yMove + (int16)READ_LE_UINT16(&costumeInfo->relY);
+ _xMove += (int16)READ_LE_UINT16(&costumeInfo->moveX);
+ _yMove -= (int16)READ_LE_UINT16(&costumeInfo->moveY);
switch (_codec) {
case AKOS_BYLE_RLE_CODEC:
- result |= codec1(xmoveCur, ymoveCur);
+ result |= paintCelByleRLE(xMoveCur, yMoveCur);
break;
case AKOS_CDAT_RLE_CODEC:
- result |= codec5(xmoveCur, ymoveCur);
+ result |= paintCelCDATRLE(xMoveCur, yMoveCur);
break;
case AKOS_RUN_MAJMIN_CODEC:
- result |= codec16(xmoveCur, ymoveCur);
+ result |= paintCelMajMin(xMoveCur, yMoveCur);
break;
default:
error("akos_drawLimb: invalid _codec %d", _codec);
@@ -397,36 +397,36 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
extra = p[2];
p += 3;
- uint32 decflag = heCondMaskIndex[0];
+ uint32 decFlag = heCondMaskIndex[0];
for (i = 0; i != extra; i++) {
code = p[4];
if (code & AKC_ExtendBit)
code = READ_BE_UINT16(p + 4);
- off = akof + (code & 0xFFF);
+ off = _akof + (code & 0xFFF);
- _srcptr = akcd + READ_LE_UINT32(&off->akcd);
- costumeInfo = (const CostumeInfo *) (akci + READ_LE_UINT16(&off->akci));
+ _srcPtr = _akcd + READ_LE_UINT32(&off->akcd);
+ costumeInfo = (const CostumeInfo *) (_akci + READ_LE_UINT16(&off->akci));
_width = READ_LE_UINT16(&costumeInfo->width);
_height = READ_LE_UINT16(&costumeInfo->height);
- xmoveCur = _xmove + (int16)READ_LE_UINT16(p + 0);
- ymoveCur = _ymove + (int16)READ_LE_UINT16(p + 2);
+ xMoveCur = _xMove + (int16)READ_LE_UINT16(p + 0);
+ yMoveCur = _yMove + (int16)READ_LE_UINT16(p + 2);
if (i == extra - 1) {
- _xmove += lastDx;
- _ymove -= lastDy;
+ _xMove += lastDx;
+ _yMove -= lastDy;
}
uint16 shadowMask = 0;
- if (!useCondMask || !akct) {
- decflag = 1;
+ if (!useCondMask || !_akct) {
+ decFlag = 1;
} else {
- uint32 cond = READ_LE_UINT32(akct + cost.heCondMaskTable[limb] + heCondMaskIndex[i] * 4);
+ uint32 cond = READ_LE_UINT32(_akct + cost.heCondMaskTable[limb] + heCondMaskIndex[i] * 4);
if (cond == 0) {
- decflag = 1;
+ decFlag = 1;
} else {
uint32 type = cond & ~0x3FFFFFFF;
cond &= 0x3FFFFFFF;
@@ -435,41 +435,41 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
cond &= ~0xE000;
}
if (_vm->_game.heversion >= 90 && cond == 0) {
- decflag = 1;
+ decFlag = 1;
} else if (type == 0x40000000) { // restored_bit
- decflag = (a->_heCondMask & cond) == cond ? 1 : 0;
+ decFlag = (a->_heCondMask & cond) == cond ? 1 : 0;
} else if (type == 0x80000000) { // dirty_bit
- decflag = (a->_heCondMask & cond) ? 0 : 1;
+ decFlag = (a->_heCondMask & cond) ? 0 : 1;
} else {
- decflag = (a->_heCondMask & cond) ? 1 : 0;
+ decFlag = (a->_heCondMask & cond) ? 1 : 0;
}
}
}
p += (p[4] & AKC_ExtendBit) ? 6 : 5;
- if (decflag == 0)
+ if (decFlag == 0)
continue;
if (_vm->_game.heversion >= 90) {
if (_vm->_game.heversion >= 99)
- _shadow_mode = 0;
- if (xmap && (shadowMask & AKC_ExtendWordBit))
- _shadow_mode = 3;
+ _shadowMode = 0;
+ if (_xmap && (shadowMask & AKC_ExtendWordBit))
+ _shadowMode = 3;
}
switch (_codec) {
case AKOS_BYLE_RLE_CODEC:
- result |= codec1(xmoveCur, ymoveCur);
+ result |= paintCelByleRLE(xMoveCur, yMoveCur);
break;
case AKOS_CDAT_RLE_CODEC:
- result |= codec5(xmoveCur, ymoveCur);
+ result |= paintCelCDATRLE(xMoveCur, yMoveCur);
break;
case AKOS_RUN_MAJMIN_CODEC:
- result |= codec16(xmoveCur, ymoveCur);
+ result |= paintCelMajMin(xMoveCur, yMoveCur);
break;
case AKOS_TRLE_CODEC:
- result |= codec32(xmoveCur, ymoveCur);
+ result |= paintCelTRLE(xMoveCur, yMoveCur);
break;
default:
error("akos_drawLimb: invalid _codec %d", _codec);
@@ -480,7 +480,7 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
return result;
}
-void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
+void AkosRenderer::byleRLEDecode(ByleRLEData &dataBlock) {
const byte *mask, *src;
byte *dst;
byte len, maskbit;
@@ -490,55 +490,55 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
bool masked;
lastColumnX = -1;
- y = v1.y;
- src = _srcptr;
- dst = v1.destptr;
- len = v1.replen;
- color = v1.repcolor;
+ y = dataBlock.y;
+ src = _srcPtr;
+ dst = dataBlock.destPtr;
+ len = dataBlock.repLen;
+ color = dataBlock.repColor;
height = _height;
- scaleytab = &v1.scaletable[v1.scaleYindex];
- maskbit = revBitMask(v1.x & 7);
- mask = _vm->getMaskBuffer(v1.x - (_vm->_virtscr[kMainVirtScreen].xstart & 7), v1.y, _zbuf);
+ scaleytab = &dataBlock.scaleTable[dataBlock.scaleYIndex];
+ maskbit = revBitMask(dataBlock.x & 7);
+ mask = _vm->getMaskBuffer(dataBlock.x - (_vm->_virtscr[kMainVirtScreen].xstart & 7), dataBlock.y, _zbuf);
if (len)
goto StartPos;
do {
len = *src++;
- color = len >> v1.shr;
- len &= v1.mask;
+ color = len >> dataBlock.shr;
+ len &= dataBlock.mask;
if (!len)
len = *src++;
do {
if (_scaleY == 255 || *scaleytab++ < _scaleY) {
if (_actorHitMode) {
- if (color && y == _actorHitY && v1.x == _actorHitX) {
+ if (color && y == _actorHitY && dataBlock.x == _actorHitX) {
_actorHitResult = true;
return;
}
} else {
- masked = (y < v1.boundsRect.top || y >= v1.boundsRect.bottom) || (v1.x < 0 || v1.x >= v1.boundsRect.right) || (*mask & maskbit);
+ masked = (y < dataBlock.boundsRect.top || y >= dataBlock.boundsRect.bottom) || (dataBlock.x < 0 || dataBlock.x >= dataBlock.boundsRect.right) || (*mask & maskbit);
bool skipColumn = false;
if (color && !masked) {
pcolor = _palette[color];
- if (_shadow_mode == 1) {
+ if (_shadowMode == 1) {
if (pcolor == 13) {
// In shadow mode 1 skipColumn works more or less the same way as in shadow
// mode 3. It is only ever checked and applied if pcolor is 13.
- skipColumn = (lastColumnX == v1.x);
- pcolor = _shadow_table[*dst];
+ skipColumn = (lastColumnX == dataBlock.x);
+ pcolor = _shadowTable[*dst];
}
- } else if (_shadow_mode == 2) {
- error("codec1_spec2"); // TODO
- } else if (_shadow_mode == 3) {
+ } else if (_shadowMode == 2) {
+ error("AkosRenderer::byleRLEDecode(): shadowMode 2 not implemented."); // TODO
+ } else if (_shadowMode == 3) {
if (_vm->_game.features & GF_16BIT_COLOR) {
// I add the column skip here, too, although I don't know whether it always
// applies. But this is the only way to prevent recursive shading of pixels.
// This might need more fine tuning...
- skipColumn = (lastColumnX == v1.x);
+ skipColumn = (lastColumnX == dataBlock.x);
uint16 srcColor = (pcolor >> 1) & 0x7DEF;
uint16 dstColor = (READ_UINT16(dst) >> 1) & 0x7DEF;
pcolor = srcColor + dstColor;
@@ -546,16 +546,16 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
// I add the column skip here, too, although I don't know whether it always
// applies. But this is the only way to prevent recursive shading of pixels.
// This might need more fine tuning...
- skipColumn = (lastColumnX == v1.x);
+ skipColumn = (lastColumnX == dataBlock.x);
pcolor = (pcolor << 8) + *dst;
- pcolor = xmap[pcolor];
- } else if (pcolor < 8 ) {
+ pcolor = _xmap[pcolor];
+ } else if (pcolor < 8) {
// This mode is used in COMI. The column skip only takes place when the shading
// is actually applied (for pcolor < 8). The skip avoids shading of pixels that
// already have been shaded.
- skipColumn = (lastColumnX == v1.x);
+ skipColumn = (lastColumnX == dataBlock.x);
pcolor = (pcolor << 8) + *dst;
- pcolor = _shadow_table[pcolor];
+ pcolor = _shadowTable[pcolor];
}
}
if (!skipColumn) {
@@ -572,29 +572,29 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
y++;
}
if (!--height) {
- if (!--v1.skip_width)
+ if (!--dataBlock.skipWidth)
return;
height = _height;
- y = v1.y;
+ y = dataBlock.y;
- scaleytab = &v1.scaletable[v1.scaleYindex];
- lastColumnX = v1.x;
+ scaleytab = &dataBlock.scaleTable[dataBlock.scaleYIndex];
+ lastColumnX = dataBlock.x;
- if (_scaleX == 255 || v1.scaletable[v1.scaleXindex] < _scaleX) {
- v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= v1.boundsRect.right)
+ if (_scaleX == 255 || dataBlock.scaleTable[dataBlock.scaleXIndex] < _scaleX) {
+ dataBlock.x += dataBlock.scaleXStep;
+ if (dataBlock.x < 0 || dataBlock.x >= dataBlock.boundsRect.right)
return;
- maskbit = revBitMask(v1.x & 7);
- v1.destptr += v1.scaleXstep * _vm->_bytesPerPixel;
+ maskbit = revBitMask(dataBlock.x & 7);
+ dataBlock.destPtr += dataBlock.scaleXStep * _vm->_bytesPerPixel;
}
- v1.scaleXindex += v1.scaleXstep;
- dst = v1.destptr;
- mask = _vm->getMaskBuffer(v1.x - (_vm->_virtscr[kMainVirtScreen].xstart & 7), v1.y, _zbuf);
+ dataBlock.scaleXIndex += dataBlock.scaleXStep;
+ dst = dataBlock.destPtr;
+ mask = _vm->getMaskBuffer(dataBlock.x - (_vm->_virtscr[kMainVirtScreen].xstart & 7), dataBlock.y, _zbuf);
}
StartPos:;
} while (--len);
- } while (1);
+ } while (true);
}
const byte bigCostumeScaleTable[768] = {
@@ -698,151 +698,151 @@ const byte bigCostumeScaleTable[768] = {
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
};
-byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
+byte AkosRenderer::paintCelByleRLE(int xMoveCur, int yMoveCur) {
int num_colors;
- bool use_scaling;
+ bool actorIsScaled;
int i, j;
- int skip = 0, startScaleIndexX, startScaleIndexY;
+ int linesToSkip = 0, startScaleIndexX, startScaleIndexY;
Common::Rect rect;
int step;
byte drawFlag = 1;
- Codec1 v1;
+ ByleRLEData compData;
const int scaletableSize = (_vm->_game.heversion >= 61) ? 128 : 384;
/* implement custom scale table */
- v1.scaletable = (_vm->_game.heversion >= 61) ? smallCostumeScaleTable : bigCostumeScaleTable;
+ compData.scaleTable = (_vm->_game.heversion >= 61) ? smallCostumeScaleTable : bigCostumeScaleTable;
if (_vm->VAR_CUSTOMSCALETABLE != 0xFF && _vm->_res->isResourceLoaded(rtString, _vm->VAR(_vm->VAR_CUSTOMSCALETABLE))) {
- v1.scaletable = _vm->getStringAddressVar(_vm->VAR_CUSTOMSCALETABLE);
+ compData.scaleTable = _vm->getStringAddressVar(_vm->VAR_CUSTOMSCALETABLE);
}
// Setup color decoding variables
- num_colors = _vm->getResourceDataSize(akpl);
+ num_colors = _vm->getResourceDataSize(_akpl);
if (num_colors == 32) {
- v1.mask = 7;
- v1.shr = 3;
+ compData.mask = 7;
+ compData.shr = 3;
} else if (num_colors == 64) {
- v1.mask = 3;
- v1.shr = 2;
+ compData.mask = 3;
+ compData.shr = 2;
} else {
- v1.mask = 15;
- v1.shr = 4;
+ compData.mask = 15;
+ compData.shr = 4;
}
- use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF);
+ actorIsScaled = (_scaleX != 0xFF) || (_scaleY != 0xFF);
- v1.x = _actorX;
- v1.y = _actorY;
+ compData.x = _actorX;
+ compData.y = _actorY;
- v1.boundsRect.left = 0;
- v1.boundsRect.top = 0;
- v1.boundsRect.right = _out.w;
- v1.boundsRect.bottom = _out.h;
+ compData.boundsRect.left = 0;
+ compData.boundsRect.top = 0;
+ compData.boundsRect.right = _out.w;
+ compData.boundsRect.bottom = _out.h;
- if (use_scaling) {
+ if (actorIsScaled) {
/* Scale direction */
- v1.scaleXstep = -1;
- if (xmoveCur < 0) {
- xmoveCur = -xmoveCur;
- v1.scaleXstep = 1;
+ compData.scaleXStep = -1;
+ if (xMoveCur < 0) {
+ xMoveCur = -xMoveCur;
+ compData.scaleXStep = 1;
}
if (_mirror) {
/* Adjust X position */
- startScaleIndexX = j = scaletableSize - xmoveCur;
- for (i = 0; i < xmoveCur; i++) {
- if (v1.scaletable[j++] < _scaleX)
- v1.x -= v1.scaleXstep;
+ startScaleIndexX = j = scaletableSize - xMoveCur;
+ for (i = 0; i < xMoveCur; i++) {
+ if (compData.scaleTable[j++] < _scaleX)
+ compData.x -= compData.scaleXStep;
}
- rect.left = rect.right = v1.x;
+ rect.left = rect.right = compData.x;
j = startScaleIndexX;
- for (i = 0, skip = 0; i < _width; i++) {
+ for (i = 0, linesToSkip = 0; i < _width; i++) {
if (rect.right < 0) {
- skip++;
+ linesToSkip++;
startScaleIndexX = j;
}
- if (v1.scaletable[j++] < _scaleX)
+ if (compData.scaleTable[j++] < _scaleX)
rect.right++;
}
} else {
/* No mirror */
/* Adjust X position */
- startScaleIndexX = j = scaletableSize + xmoveCur;
- for (i = 0; i < xmoveCur; i++) {
- if (v1.scaletable[j--] < _scaleX)
- v1.x += v1.scaleXstep;
+ startScaleIndexX = j = scaletableSize + xMoveCur;
+ for (i = 0; i < xMoveCur; i++) {
+ if (compData.scaleTable[j--] < _scaleX)
+ compData.x += compData.scaleXStep;
}
- rect.left = rect.right = v1.x;
+ rect.left = rect.right = compData.x;
j = startScaleIndexX;
for (i = 0; i < _width; i++) {
- if (rect.left >= v1.boundsRect.right) {
+ if (rect.left >= compData.boundsRect.right) {
startScaleIndexX = j;
- skip++;
+ linesToSkip++;
}
- if (v1.scaletable[j--] < _scaleX)
+ if (compData.scaleTable[j--] < _scaleX)
rect.left--;
}
}
- if (skip)
- skip--;
+ if (linesToSkip)
+ linesToSkip--;
step = -1;
- if (ymoveCur < 0) {
- ymoveCur = -ymoveCur;
+ if (yMoveCur < 0) {
+ yMoveCur = -yMoveCur;
step = -step;
}
- startScaleIndexY = scaletableSize - ymoveCur;
- for (i = 0; i < ymoveCur; i++) {
- if (v1.scaletable[startScaleIndexY++] < _scaleY)
- v1.y -= step;
+ startScaleIndexY = scaletableSize - yMoveCur;
+ for (i = 0; i < yMoveCur; i++) {
+ if (compData.scaleTable[startScaleIndexY++] < _scaleY)
+ compData.y -= step;
}
- rect.top = rect.bottom = v1.y;
- startScaleIndexY = scaletableSize - ymoveCur;
+ rect.top = rect.bottom = compData.y;
+ startScaleIndexY = scaletableSize - yMoveCur;
for (i = 0; i < _height; i++) {
- if (v1.scaletable[startScaleIndexY++] < _scaleY)
+ if (compData.scaleTable[startScaleIndexY++] < _scaleY)
rect.bottom++;
}
- startScaleIndexY = scaletableSize - ymoveCur;
+ startScaleIndexY = scaletableSize - yMoveCur;
} else {
if (!_mirror)
- xmoveCur = -xmoveCur;
+ xMoveCur = -xMoveCur;
- v1.x += xmoveCur;
- v1.y += ymoveCur;
+ compData.x += xMoveCur;
+ compData.y += yMoveCur;
if (_mirror) {
- rect.left = v1.x;
- rect.right = v1.x + _width;
+ rect.left = compData.x;
+ rect.right = compData.x + _width;
} else {
- rect.left = v1.x - _width;
- rect.right = v1.x;
+ rect.left = compData.x - _width;
+ rect.right = compData.x;
}
- rect.top = v1.y;
+ rect.top = compData.y;
rect.bottom = rect.top + _height;
startScaleIndexX = scaletableSize;
startScaleIndexY = scaletableSize;
}
- v1.scaleXindex = startScaleIndexX;
- v1.scaleYindex = startScaleIndexY;
- v1.skip_width = _width;
- v1.scaleXstep = _mirror ? 1 : -1;
+ compData.scaleXIndex = startScaleIndexX;
+ compData.scaleYIndex = startScaleIndexY;
+ compData.skipWidth = _width;
+ compData.scaleXStep = _mirror ? 1 : -1;
- if (_vm->_game.heversion >= 71 && !use_scaling) {
+ if (_vm->_game.heversion >= 71 && !actorIsScaled) {
if (_clipOverride.right > _clipOverride.left && _clipOverride.bottom > _clipOverride.top) {
- v1.boundsRect = _clipOverride;
+ compData.boundsRect = _clipOverride;
}
}
@@ -852,72 +852,72 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
} else
markRectAsDirty(rect);
- if (rect.top >= v1.boundsRect.bottom || rect.bottom <= v1.boundsRect.top)
+ if (rect.top >= compData.boundsRect.bottom || rect.bottom <= compData.boundsRect.top)
return 0;
- if (rect.left >= v1.boundsRect.right || rect.right <= v1.boundsRect.left)
+ if (rect.left >= compData.boundsRect.right || rect.right <= compData.boundsRect.left)
return 0;
- v1.replen = 0;
+ compData.repLen = 0;
if (_mirror) {
- if (!use_scaling)
- skip = v1.boundsRect.left - v1.x;
+ if (!actorIsScaled)
+ linesToSkip = compData.boundsRect.left - compData.x;
- if (skip > 0) {
- v1.skip_width -= skip;
- codec1_ignorePakCols(v1, skip);
- v1.x = v1.boundsRect.left;
+ if (linesToSkip > 0) {
+ compData.skipWidth -= linesToSkip;
+ skipCelLines(compData, linesToSkip);
+ compData.x = compData.boundsRect.left;
} else {
- skip = rect.right - v1.boundsRect.right;
- if (skip <= 0) {
+ linesToSkip = rect.right - compData.boundsRect.right;
+ if (linesToSkip <= 0) {
drawFlag = 2;
} else {
- v1.skip_width -= skip;
+ compData.skipWidth -= linesToSkip;
}
}
} else {
- if (!use_scaling)
- skip = rect.right - v1.boundsRect.right + 1;
- if (skip > 0) {
- v1.skip_width -= skip;
- codec1_ignorePakCols(v1, skip) ;
- v1.x = v1.boundsRect.right - 1;
+ if (!actorIsScaled)
+ linesToSkip = rect.right - compData.boundsRect.right + 1;
+ if (linesToSkip > 0) {
+ compData.skipWidth -= linesToSkip;
+ skipCelLines(compData, linesToSkip) ;
+ compData.x = compData.boundsRect.right - 1;
} else {
- skip = (v1.boundsRect.left -1) - rect.left;
+ linesToSkip = (compData.boundsRect.left -1) - rect.left;
- if (skip <= 0)
+ if (linesToSkip <= 0)
drawFlag = 2;
else
- v1.skip_width -= skip;
+ compData.skipWidth -= linesToSkip;
}
}
- if (v1.skip_width <= 0 || _height <= 0)
+ if (compData.skipWidth <= 0 || _height <= 0)
return 0;
- if (rect.left < v1.boundsRect.left)
- rect.left = v1.boundsRect.left;
+ if (rect.left < compData.boundsRect.left)
+ rect.left = compData.boundsRect.left;
- if (rect.top < v1.boundsRect.top)
- rect.top = v1.boundsRect.top;
+ if (rect.top < compData.boundsRect.top)
+ rect.top = compData.boundsRect.top;
- if (rect.top > v1.boundsRect.bottom)
- rect.top = v1.boundsRect.bottom;
+ if (rect.top > compData.boundsRect.bottom)
+ rect.top = compData.boundsRect.bottom;
- if (rect.bottom > v1.boundsRect.bottom)
- rect.bottom = v1.boundsRect.bottom;
+ if (rect.bottom > compData.boundsRect.bottom)
+ rect.bottom = compData.boundsRect.bottom;
- if (_draw_top > rect.top)
- _draw_top = rect.top;
- if (_draw_bottom < rect.bottom)
- _draw_bottom = rect.bottom;
+ if (_drawTop > rect.top)
+ _drawTop = rect.top;
+ if (_drawBottom < rect.bottom)
+ _drawBottom = rect.bottom;
- v1.width = _out.w;
- v1.height = _out.h;
- v1.destptr = (byte *)_out.getBasePtr(v1.x, v1.y);
+ compData.width = _out.w;
+ compData.height = _out.h;
+ compData.destPtr = (byte *)_out.getBasePtr(compData.x, compData.y);
- codec1_genericDecode(v1);
+ byleRLEDecode(compData);
return drawFlag;
}
@@ -928,12 +928,12 @@ void AkosRenderer::markRectAsDirty(Common::Rect rect) {
_vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
}
-byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
+byte AkosRenderer::paintCelCDATRLE(int xmoveCur, int ymoveCur) {
Common::Rect clip;
int32 maxw, maxh;
if (_actorHitMode) {
- error("codec5: _actorHitMode not yet implemented");
+ error("paintCelCDATRLE: _actorHitMode not yet implemented");
return 0;
}
@@ -956,10 +956,10 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
return 0;
- if (_draw_top > clip.top)
- _draw_top = clip.top;
- if (_draw_bottom < clip.bottom)
- _draw_bottom = clip.bottom;
+ if (_drawTop > clip.top)
+ _drawTop = clip.top;
+ if (_drawBottom < clip.bottom)
+ _drawBottom = clip.bottom;
BompDrawData bdd;
@@ -971,7 +971,7 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
}
bdd.y = _actorY + ymoveCur;
- bdd.src = _srcptr;
+ bdd.src = _srcPtr;
bdd.srcwidth = _width;
bdd.srcheight = _height;
@@ -981,7 +981,7 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
bdd.maskPtr = _vm->getMaskBuffer(0, 0, _zbuf);
bdd.numStrips = _numStrips;
- bdd.shadowMode = _shadow_mode;
+ bdd.shadowMode = _shadowMode;
bdd.shadowPalette = _vm->_shadowPalette;
bdd.actorPalette = _useBompPalette ? _palette : nullptr;
@@ -995,241 +995,241 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
return 0;
}
-void AkosRenderer::akos16SetupBitReader(const byte *src) {
- _akos16.repeatMode = false;
- _akos16.numbits = 16;
- _akos16.mask = (1 << *src) - 1;
- _akos16.shift = *(src);
- _akos16.color = *(src + 1);
- _akos16.bits = (*(src + 2) | *(src + 3) << 8);
- _akos16.dataptr = src + 4;
+void AkosRenderer::majMinCodecSetupBitReader(const byte *src) {
+ _majMinData.repeatMode = false;
+ _majMinData.numBits = 16;
+ _majMinData.mask = (1 << *src) - 1;
+ _majMinData.shift = *(src);
+ _majMinData.color = *(src + 1);
+ _majMinData.bits = (*(src + 2) | *(src + 3) << 8);
+ _majMinData.dataPtr = src + 4;
}
-#define AKOS16_FILL_BITS() \
- if (_akos16.numbits <= 8) { \
- _akos16.bits |= (*_akos16.dataptr++) << _akos16.numbits; \
- _akos16.numbits += 8; \
+#define MAJMIN_FILL_BITS() \
+ if (_majMinData.numBits <= 8) { \
+ _majMinData.bits |= (*_majMinData.dataPtr++) << _majMinData.numBits; \
+ _majMinData.numBits += 8; \
}
-#define AKOS16_EAT_BITS(n) \
- _akos16.numbits -= (n); \
- _akos16.bits >>= (n);
+#define MAJMIN_EAT_BITS(n) \
+ _majMinData.numBits -= (n); \
+ _majMinData.bits >>= (n);
-void AkosRenderer::akos16SkipData(int32 numbytes) {
- akos16DecodeLine(nullptr, numbytes, 0);
+void AkosRenderer::majMinCodecSkipData(int32 numbytes) {
+ majMinCodecDecodeLine(nullptr, numbytes, 0);
}
-void AkosRenderer::akos16DecodeLine(byte *buf, int32 numbytes, int32 dir) {
+void AkosRenderer::majMinCodecDecodeLine(byte *buf, int32 numbytes, int32 dir) {
uint16 bits, tmp_bits;
while (numbytes != 0) {
if (buf) {
- *buf = _akos16.color;
+ *buf = _majMinData.color;
buf += dir;
}
- if (!_akos16.repeatMode) {
- AKOS16_FILL_BITS()
- bits = _akos16.bits & 3;
+ if (!_majMinData.repeatMode) {
+ MAJMIN_FILL_BITS()
+ bits = _majMinData.bits & 3;
if (bits & 1) {
- AKOS16_EAT_BITS(2)
+ MAJMIN_EAT_BITS(2)
if (bits & 2) {
- tmp_bits = _akos16.bits & 7;
- AKOS16_EAT_BITS(3)
+ tmp_bits = _majMinData.bits & 7;
+ MAJMIN_EAT_BITS(3)
if (tmp_bits != 4) {
// A color change
- _akos16.color += (tmp_bits - 4);
+ _majMinData.color += (tmp_bits - 4);
} else {
// Color does not change, but rather identical pixels get repeated
- _akos16.repeatMode = true;
- AKOS16_FILL_BITS()
- _akos16.repeatCount = (_akos16.bits & 0xff) - 1;
- AKOS16_EAT_BITS(8)
- AKOS16_FILL_BITS()
+ _majMinData.repeatMode = true;
+ MAJMIN_FILL_BITS()
+ _majMinData.repeatCount = (_majMinData.bits & 0xff) - 1;
+ MAJMIN_EAT_BITS(8)
+ MAJMIN_FILL_BITS()
}
} else {
- AKOS16_FILL_BITS()
- _akos16.color = ((byte)_akos16.bits) & _akos16.mask;
- AKOS16_EAT_BITS(_akos16.shift)
- AKOS16_FILL_BITS()
+ MAJMIN_FILL_BITS()
+ _majMinData.color = ((byte)_majMinData.bits) & _majMinData.mask;
+ MAJMIN_EAT_BITS(_majMinData.shift)
+ MAJMIN_FILL_BITS()
}
} else {
- AKOS16_EAT_BITS(1);
+ MAJMIN_EAT_BITS(1);
}
} else {
- if (--_akos16.repeatCount == 0) {
- _akos16.repeatMode = false;
+ if (--_majMinData.repeatCount == 0) {
+ _majMinData.repeatMode = false;
}
}
numbytes--;
}
}
-void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir,
- int32 numskip_before, int32 numskip_after, byte transparency, int maskLeft, int maskTop, int zBuf) {
- byte *tmp_buf = _akos16.buffer;
- int maskpitch;
- byte *maskptr;
- const byte maskbit = revBitMask(maskLeft & 7);
+void AkosRenderer::majMinCodecDecompress(byte *dest, int32 pitch, const byte *src, int32 width, int32 height, int32 dir,
+ int32 numSkipBefore, int32 numSkipAfter, byte transparency, int maskLeft, int maskTop, int zBuf) {
+ byte *tmpBuf = _majMinData.buffer;
+ int maskPitch;
+ byte *maskPtr;
+ const byte maskBit = revBitMask(maskLeft & 7);
if (dir < 0) {
- dest -= (t_width - 1);
- tmp_buf += (t_width - 1);
+ dest -= (width - 1);
+ tmpBuf += (width - 1);
}
- akos16SetupBitReader(src);
+ majMinCodecSetupBitReader(src);
- if (numskip_before != 0) {
- akos16SkipData(numskip_before);
+ if (numSkipBefore != 0) {
+ majMinCodecSkipData(numSkipBefore);
}
- maskpitch = _numStrips;
+ maskPitch = _numStrips;
- maskptr = _vm->getMaskBuffer(maskLeft, maskTop, zBuf);
+ maskPtr = _vm->getMaskBuffer(maskLeft, maskTop, zBuf);
- assert(t_height > 0);
- assert(t_width > 0);
- while (t_height--) {
- akos16DecodeLine(tmp_buf, t_width, dir);
- bompApplyMask(_akos16.buffer, maskptr, maskbit, t_width, transparency);
+ assert(height > 0);
+ assert(width > 0);
+ while (height--) {
+ majMinCodecDecodeLine(tmpBuf, width, dir);
+ bompApplyMask(_majMinData.buffer, maskPtr, maskBit, width, transparency);
bool HE7Check = (_vm->_game.heversion == 70);
- bompApplyShadow(_shadow_mode, _shadow_table, _akos16.buffer, dest, t_width, transparency, HE7Check);
+ bompApplyShadow(_shadowMode, _shadowTable, _majMinData.buffer, dest, width, transparency, HE7Check);
- if (numskip_after != 0) {
- akos16SkipData(numskip_after);
+ if (numSkipAfter != 0) {
+ majMinCodecSkipData(numSkipAfter);
}
dest += pitch;
- maskptr += maskpitch;
+ maskPtr += maskPitch;
}
}
-byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
+byte AkosRenderer::paintCelMajMin(int xMoveCur, int yMoveCur) {
assert(_vm->_bytesPerPixel == 1);
Common::Rect clip;
- int32 minx, miny, maxw, maxh;
- int32 skip_x, skip_y, cur_x, cur_y;
+ int32 minX, minY, maxW, maxH;
+ int32 skipX, skipY, curX, curY;
byte transparency = (_vm->_game.heversion >= 61) ? _palette[0] : 255;
if (_actorHitMode) {
- error("codec16: _actorHitMode not yet implemented");
+ error("paintCelMajMin: _actorHitMode not yet implemented");
return 0;
}
if (!_mirror) {
- clip.left = (_actorX - xmoveCur - _width) + 1;
+ clip.left = (_actorX - xMoveCur - _width) + 1;
} else {
- clip.left = _actorX + xmoveCur;
+ clip.left = _actorX + xMoveCur;
}
- clip.top = _actorY + ymoveCur;
+ clip.top = _actorY + yMoveCur;
clip.right = clip.left + _width;
clip.bottom = clip.top + _height;
- minx = miny = 0;
- maxw = _out.w;
- maxh = _out.h;
+ minX = minY = 0;
+ maxW = _out.w;
+ maxH = _out.h;
if (_vm->_game.heversion >= 71) {
if (_clipOverride.right > _clipOverride.left && _clipOverride.bottom > _clipOverride.top) {
- minx = _clipOverride.left;
- miny = _clipOverride.top;
- maxw = _clipOverride.right;
- maxh = _clipOverride.bottom;
+ minX = _clipOverride.left;
+ minY = _clipOverride.top;
+ maxW = _clipOverride.right;
+ maxH = _clipOverride.bottom;
}
}
markRectAsDirty(clip);
- skip_x = 0;
- skip_y = 0;
- cur_x = _width - 1;
- cur_y = _height - 1;
+ skipX = 0;
+ skipY = 0;
+ curX = _width - 1;
+ curY = _height - 1;
- if (clip.left < minx) {
- skip_x = -clip.left;
+ if (clip.left < minX) {
+ skipX = -clip.left;
clip.left = 0;
}
- if (clip.right > maxw) {
- cur_x -= clip.right - maxw;
- clip.right = maxw;
+ if (clip.right > maxW) {
+ curX -= clip.right - maxW;
+ clip.right = maxW;
}
- if (clip.top < miny) {
- skip_y -= clip.top;
+ if (clip.top < minY) {
+ skipY -= clip.top;
clip.top = 0;
}
- if (clip.bottom > maxh) {
- cur_y -= clip.bottom - maxh;
- clip.bottom = maxh;
+ if (clip.bottom > maxH) {
+ curY -= clip.bottom - maxH;
+ clip.bottom = maxH;
}
if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
return 0;
- if (_draw_top > clip.top)
- _draw_top = clip.top;
- if (_draw_bottom < clip.bottom)
- _draw_bottom = clip.bottom;
+ if (_drawTop > clip.top)
+ _drawTop = clip.top;
+ if (_drawBottom < clip.bottom)
+ _drawBottom = clip.bottom;
- int32 width_unk, height_unk;
+ int32 widthUnk, heightUnk;
- height_unk = clip.top;
+ heightUnk = clip.top;
int32 dir;
if (!_mirror) {
dir = -1;
- int tmp_skip_x = skip_x;
- skip_x = _width - 1 - cur_x;
- cur_x = _width - 1 - tmp_skip_x;
- width_unk = clip.right - 1;
+ int tmpSkipX = skipX;
+ skipX = _width - 1 - curX;
+ curX = _width - 1 - tmpSkipX;
+ widthUnk = clip.right - 1;
} else {
dir = 1;
- width_unk = clip.left;
+ widthUnk = clip.left;
}
- int32 out_height;
+ int32 outHeight;
- out_height = cur_y - skip_y;
- if (out_height < 0) {
- out_height = -out_height;
+ outHeight = curY - skipY;
+ if (outHeight < 0) {
+ outHeight = -outHeight;
}
- out_height++;
+ outHeight++;
- cur_x -= skip_x;
- if (cur_x < 0) {
- cur_x = -cur_x;
+ curX -= skipX;
+ if (curX < 0) {
+ curX = -curX;
}
- cur_x++;
+ curX++;
- int32 numskip_before = skip_x + (skip_y * _width);
- int32 numskip_after = _width - cur_x;
+ int32 numSkipBefore = skipX + (skipY * _width);
+ int32 numSkipAfter = _width - curX;
- byte *dst = (byte *)_out.getBasePtr(width_unk, height_unk);
+ byte *dst = (byte *)_out.getBasePtr(widthUnk, heightUnk);
- akos16Decompress(dst, _out.pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf);
+ majMinCodecDecompress(dst, _out.pitch, _srcPtr, curX, outHeight, dir, numSkipBefore, numSkipAfter, transparency, clip.left, clip.top, _zbuf);
return 0;
}
-byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
+byte AkosRenderer::paintCelTRLE(int xMoveCur, int yMoveCur) {
#ifdef ENABLE_HE
Common::Rect src, dst;
if (!_mirror) {
- dst.left = (_actorX - xmoveCur - _width) + 1;
+ dst.left = (_actorX - xMoveCur - _width) + 1;
} else {
- dst.left = _actorX + xmoveCur;
+ dst.left = _actorX + xMoveCur;
}
src.top = src.left = 0;
src.right = _width;
src.bottom = _height;
- dst.top = _actorY + ymoveCur;
+ dst.top = _actorY + yMoveCur;
dst.right = dst.left + _width;
dst.bottom = dst.top + _height;
@@ -1260,19 +1260,19 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
markRectAsDirty(dst);
- if (_draw_top > dst.top)
- _draw_top = dst.top;
- if (_draw_bottom < dst.bottom)
- _draw_bottom = dst.bottom;
+ if (_drawTop > dst.top)
+ _drawTop = dst.top;
+ if (_drawBottom < dst.bottom)
+ _drawBottom = dst.bottom;
const uint8 *palPtr = NULL;
if (_vm->_game.features & GF_16BIT_COLOR) {
palPtr = _vm->_hePalettes + _vm->_hePaletteSlot + 768;
if (_paletteNum) {
palPtr = _vm->_hePalettes + _paletteNum * _vm->_hePaletteSlot + 768;
- } else if (rgbs) {
+ } else if (_rgbs) {
for (uint i = 0; i < 256; i++)
- WRITE_LE_UINT16(_palette + i, _vm->get16BitColor(rgbs[i * 3 + 0], rgbs[i * 3 + 1], rgbs[i * 3 + 2]));
+ WRITE_LE_UINT16(_palette + i, _vm->get16BitColor(_rgbs[i * 3 + 0], _rgbs[i * 3 + 1], _rgbs[i * 3 + 2]));
palPtr = (uint8 *)_palette;
}
} else if (_vm->_game.heversion >= 99) {
@@ -1280,20 +1280,20 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
}
byte *dstPtr = (byte *)_out.getBasePtr(dst.left, dst.top);
- if (_shadow_mode == 3) {
- Wiz::decompressWizImage<kWizXMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, xmap, _vm->_bytesPerPixel);
+ if (_shadowMode == 3) {
+ Wiz::decompressWizImage<kWizXMap>(dstPtr, _out.pitch, kDstScreen, _srcPtr, src, 0, palPtr, _xmap, _vm->_bytesPerPixel);
} else {
if (palPtr != NULL) {
- Wiz::decompressWizImage<kWizRMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, NULL, _vm->_bytesPerPixel);
+ Wiz::decompressWizImage<kWizRMap>(dstPtr, _out.pitch, kDstScreen, _srcPtr, src, 0, palPtr, NULL, _vm->_bytesPerPixel);
} else {
- Wiz::decompressWizImage<kWizCopy>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, NULL, NULL, _vm->_bytesPerPixel);
+ Wiz::decompressWizImage<kWizCopy>(dstPtr, _out.pitch, kDstScreen, _srcPtr, src, 0, NULL, NULL, _vm->_bytesPerPixel);
}
}
#endif
return 0;
}
-byte AkosCostumeLoader::increaseAnims(Actor *a) {
+bool AkosCostumeLoader::increaseAnims(Actor *a) {
return ((ScummEngine_v6 *)_vm)->akos_increaseAnims(_akos, a);
}
@@ -1315,21 +1315,20 @@ bool ScummEngine_v6::akos_increaseAnims(const byte *akos, Actor *a) {
return result;
}
-bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const uint16 *akfo, int numakfo) {
+bool ScummEngine_v6::akos_increaseAnim(Actor *a, int limb, const byte *aksq, const uint16 *akfo, int numakfo) {
byte animType;
uint startState, curState, endState;
uint code;
bool skipNextState, needRedraw;
int counter, tmp2;
- animType = a->_cost.animType[chan];
- endState = a->_cost.end[chan];
- startState = curState = a->_cost.curpos[chan];
+ animType = a->_cost.animType[limb];
+ endState = a->_cost.end[limb];
+ startState = curState = a->_cost.curpos[limb];
skipNextState = false;
needRedraw = false;
do {
-
code = aksq[curState];
if (code & AKC_ExtendBit)
code = READ_BE_UINT16(aksq + curState);
@@ -1435,7 +1434,7 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con
case AKAT_LoopLayer:
curState += (code & AKC_ExtendWordBit) ? 2 : 1;
if (curState > endState)
- curState = a->_cost.start[chan];
+ curState = a->_cost.start[limb];
break;
case AKAT_RunLayer:
if (curState != endState)
@@ -1531,9 +1530,9 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con
error("akos_increaseAnim: no AKFO table");
counter = a->getAnimVar(GB(2)) - 1;
if (_game.heversion >= 80) {
- if (counter < 0 || counter > a->_cost.heJumpCountTable[chan] - 1)
+ if (counter < 0 || counter > a->_cost.heJumpCountTable[limb] - 1)
error("akos_increaseAnim: invalid jump value %d", counter);
- curState = READ_LE_UINT16(akfo + a->_cost.heJumpOffsetTable[chan] + counter * 2);
+ curState = READ_LE_UINT16(akfo + a->_cost.heJumpOffsetTable[limb] + counter * 2);
} else {
if (counter < 0 || counter > numakfo - 1)
error("akos_increaseAnim: invalid jump value %d", counter);
@@ -1560,7 +1559,7 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con
// To prevent an undefined 'uSweat token' the animation is reset to its start.
if (_game.id == GID_HEGAME && _language == Common::DE_DEU && \
_currentRoom == 21 && a->_costume == 352 && curState == 846) {
- curState = a->_cost.start[chan];
+ curState = a->_cost.start[limb];
}
break;
@@ -1681,7 +1680,7 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con
if ((code2 & AKC_CommandMask) == AKC_CommandMask && code2 != AKC_DrawMany && code2 != AKC_EmptyCel && code2 != AKC_EndSeq && code2 != AKC_DisplayAuxFrame && code2 != AKC_RelativeOffsetDrawMany && code2 != AKC_CondDrawMany && code2 != AKC_CondRelativeOffsetDrawMany)
error("Ending with undefined uSweat token %X", code2);
- a->_cost.curpos[chan] = curState;
+ a->_cost.curpos[limb] = curState;
if (needRedraw)
return true;
@@ -1689,25 +1688,25 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con
return curState != startState;
}
-void ScummEngine_v6::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2) {
+void ScummEngine_v6::akos_queCommand(byte cmd, Actor *a, int param1, int param2) {
_akosQueuePos++;
assertRange(0, _akosQueuePos, 31, "akos_queCommand: _akosQueuePos");
_akosQueue[_akosQueuePos].cmd = cmd;
_akosQueue[_akosQueuePos].actor = a->_number;
- _akosQueue[_akosQueuePos].param1 = param_1;
- _akosQueue[_akosQueuePos].param2 = param_2;
+ _akosQueue[_akosQueuePos].param1 = param1;
+ _akosQueue[_akosQueuePos].param2 = param2;
}
void ScummEngine_v6::akos_processQueue() {
byte cmd;
- int actor, param_1, param_2;
+ int actor, param1, param2;
while (_akosQueuePos) {
cmd = _akosQueue[_akosQueuePos].cmd;
actor = _akosQueue[_akosQueuePos].actor;
- param_1 = _akosQueue[_akosQueuePos].param1;
- param_2 = _akosQueue[_akosQueuePos].param2;
+ param1 = _akosQueue[_akosQueuePos].param1;
+ param2 = _akosQueue[_akosQueuePos].param2;
_akosQueuePos--;
Actor *a = derefActor(actor, "akos_processQueue");
@@ -1717,41 +1716,41 @@ void ScummEngine_v6::akos_processQueue() {
a->putActor(0, 0, 0);
break;
case AKQC_StartSound:
- _sound->addSoundToQueue(param_1, 0, -1, 0);
+ _sound->addSoundToQueue(param1, 0, -1, 0);
break;
case AKQC_StartAnimation:
- a->startAnimActor(param_1);
+ a->startAnimActor(param1);
break;
case AKQC_SetZClipping:
- a->_forceClip = param_1;
+ a->_forceClip = param1;
break;
case AKQC_SetXYOffset:
- a->_heOffsX = param_1;
- a->_heOffsY = param_2;
+ a->_heOffsX = param1;
+ a->_heOffsY = param2;
break;
case AKQC_DisplayAuxFrame:
#ifdef ENABLE_HE
assert(_game.heversion >= 71);
- ((ScummEngine_v71he *)this)->queueAuxEntry(a->_number, param_1);
+ ((ScummEngine_v71he *)this)->queueAuxEntry(a->_number, param1);
#endif
break;
case AKQC_StartTalkie:
_actorToPrintStrFor = a->_number;
- a->_talkPosX = ((ActorHE *)a)->_heTalkQueue[param_1].posX;
- a->_talkPosY = ((ActorHE *)a)->_heTalkQueue[param_1].posY;
- a->_talkColor = ((ActorHE *)a)->_heTalkQueue[param_1].color;
+ a->_talkPosX = ((ActorHE *)a)->_heTalkQueue[param1].posX;
+ a->_talkPosY = ((ActorHE *)a)->_heTalkQueue[param1].posY;
+ a->_talkColor = ((ActorHE *)a)->_heTalkQueue[param1].color;
_string[0].loadDefault();
_string[0].color = a->_talkColor;
- actorTalk(((ActorHE *)a)->_heTalkQueue[param_1].sentence);
+ actorTalk(((ActorHE *)a)->_heTalkQueue[param1].sentence);
break;
case AKQC_SoftStartSound:
- _sound->addSoundToQueue(param_1, 0, -1, 4);
+ _sound->addSoundToQueue(param1, 0, -1, 4);
break;
default:
- error("akos_queCommand(%d,%d,%d,%d)", cmd, a->_number, param_1, param_2);
+ error("akos_queCommand(%d,%d,%d,%d)", cmd, a->_number, param1, param2);
}
}
@@ -1766,13 +1765,13 @@ void ScummEngine_v6::akos_processQueue() {
#ifdef ENABLE_SCUMM_7_8
void ScummEngine_v7::akos_processQueue() {
byte cmd;
- int actor, param_1, param_2;
+ int actor, param1, param2;
while (_akosQueuePos) {
cmd = _akosQueue[_akosQueuePos].cmd;
actor = _akosQueue[_akosQueuePos].actor;
- param_1 = _akosQueue[_akosQueuePos].param1;
- param_2 = _akosQueue[_akosQueuePos].param2;
+ param1 = _akosQueue[_akosQueuePos].param1;
+ param2 = _akosQueue[_akosQueuePos].param2;
_akosQueuePos--;
Actor *a = derefActor(actor, "akos_processQueue");
@@ -1782,45 +1781,45 @@ void ScummEngine_v7::akos_processQueue() {
a->putActor(0, 0, 0);
break;
case AKQC_StartSound:
- if (param_1 != 0) {
+ if (param1 != 0) {
if (_imuseDigital) {
- _imuseDigital->startSfx(param_1, 63);
+ _imuseDigital->startSfx(param1, 63);
}
}
break;
case AKQC_StartAnimation:
- a->startAnimActor(param_1);
+ a->startAnimActor(param1);
break;
case AKQC_SetZClipping:
- a->_forceClip = param_1;
+ a->_forceClip = param1;
break;
case AKQC_SetXYOffset:
- a->_heOffsX = param_1;
- a->_heOffsY = param_2;
+ a->_heOffsX = param1;
+ a->_heOffsY = param2;
break;
case AKQC_SetSoundVolume:
- if (param_1 != 0) {
+ if (param1 != 0) {
if (_imuseDigital) {
- _imuseDigital->setVolume(param_1, param_2);
+ _imuseDigital->setVolume(param1, param2);
}
}
break;
case AKQC_SetSoundPan:
- if (param_1 != 0) {
+ if (param1 != 0) {
if (_imuseDigital) {
- _imuseDigital->setPan(param_1, param_2);
+ _imuseDigital->setPan(param1, param2);
}
}
break;
case AKQC_SetSoundPriority:
- if (param_1 != 0) {
+ if (param1 != 0) {
if (_imuseDigital) {
- _imuseDigital->setPriority(param_1, param_2);
+ _imuseDigital->setPriority(param1, param2);
}
}
break;
default:
- error("akos_queCommand(%d,%d,%d,%d)", cmd, a->_number, param_1, param_2);
+ error("akos_queCommand(%d,%d,%d,%d)", cmd, a->_number, param1, param2);
}
}
}
diff --git a/engines/scumm/akos.h b/engines/scumm/akos.h
index 873d6d2e8b4..f35cc918c94 100644
--- a/engines/scumm/akos.h
+++ b/engines/scumm/akos.h
@@ -43,8 +43,8 @@ public:
AkosCostumeLoader(ScummEngine *vm) : BaseCostumeLoader(vm) {}
void loadCostume(int id) override;
- byte increaseAnims(Actor *a) override;
- void costumeDecodeData(Actor *a, int frame, uint usemask) override;
+ bool increaseAnims(Actor *a) override;
+ void costumeDecodeData(Actor *a, int frame, uint useMask) override;
//void animateLimb(int limb, int f);
bool hasManyDirections(int id) {
@@ -65,17 +65,29 @@ protected:
bool _useBompPalette;
// pointer to various parts of the costume resource
- const AkosHeader *akhd; // header
+ const AkosHeader *_akhd; // Header
- const byte *akpl; // palette data
- const byte *akci; // CostumeInfo table
- const byte *aksq; // command sequence
- const AkosOffset *akof; // offsets into ci and cd table
- const byte *akcd; // costume data (contains the data for the codecs)
+ const byte *_akpl; // Color lookup table for the costume
+ const byte *_akci; // AKOS Cel Info block, containing:
+ // - Cel width;
+ // - Cel height;
+ // - Cel x coordinate;
+ // - Cel y coordinate;
+ // - Cel x relative coordinate;
+ // - Cel y relative coordinate.
- const byte *akct; // HE specific: condition table
- const byte *rgbs; // HE specific: RGB table
- const uint8 *xmap; // HE specific: shadow color table
+ const byte *_aksq; // Costume sequence table, containing:
+ // - A sequence of N bytes containing animation commands.
+
+ const AkosOffset *_akof; // Cel offset table, containing:
+ // - Offset starting from the cel data block to the start of cel data;
+ // - Offset starting from the cel info block to the start of cel header.
+
+ const byte *_akcd; // Cel data block (contains the codec specific data)
+
+ const byte *_akct; // Sequence condition table (HE specific)
+ const byte *_rgbs; // Raw costume RGB colors (HE specific)
+ const uint8 *_xmap; // shadow color table (HE specific)
struct {
bool repeatMode;
@@ -84,23 +96,23 @@ protected:
byte color;
byte shift;
uint16 bits;
- byte numbits;
- const byte *dataptr;
+ byte numBits;
+ const byte *dataPtr;
byte buffer[336];
- } _akos16;
+ } _majMinData;
public:
AkosRenderer(ScummEngine *scumm) : BaseCostumeRenderer(scumm) {
_useBompPalette = false;
- akhd = 0;
- akpl = 0;
- akci = 0;
- aksq = 0;
- akof = 0;
- akcd = 0;
- akct = 0;
- rgbs = 0;
- xmap = 0;
+ _akhd = nullptr;
+ _akpl = nullptr;
+ _akci = nullptr;
+ _aksq = nullptr;
+ _akof = nullptr;
+ _akcd = nullptr;
+ _akct = nullptr;
+ _rgbs = nullptr;
+ _xmap = nullptr;
_actorHitMode = false;
}
@@ -115,15 +127,15 @@ public:
protected:
byte drawLimb(const Actor *a, int limb) override;
- byte codec1(int xmoveCur, int ymoveCur);
- void codec1_genericDecode(Codec1 &v1);
- byte codec5(int xmoveCur, int ymoveCur);
- byte codec16(int xmoveCur, int ymoveCur);
- byte codec32(int xmoveCur, int ymoveCur);
- void akos16SetupBitReader(const byte *src);
- void akos16SkipData(int32 numskip);
- void akos16DecodeLine(byte *buf, int32 numbytes, int32 dir);
- void akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, int maskLeft, int maskTop, int zBuf);
+ byte paintCelByleRLE(int xMoveCur, int yMoveCur);
+ void byleRLEDecode(ByleRLEData &v1);
+ byte paintCelCDATRLE(int xMoveCur, int yMoveCur);
+ byte paintCelMajMin(int xMoveCur, int yMoveCur);
+ byte paintCelTRLE(int xMoveCur, int yMoveCur);
+ void majMinCodecSetupBitReader(const byte *src);
+ void majMinCodecSkipData(int32 numSkip);
+ void majMinCodecDecodeLine(byte *buf, int32 numBytes, int32 dir);
+ void majMinCodecDecompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numSkipBefore, int32 numSkipAfter, byte transparency, int maskLeft, int maskTop, int zBuf);
void markRectAsDirty(Common::Rect rect);
};
@@ -132,6 +144,7 @@ enum AkosSequenceCodes {
// Auxiliary uSweat tokens:
AKC_ExtendBit = 0x80,
AKC_ExtendWordBit = 0x8000,
+ AKC_CelMask = 0x0FFF,
// Opcode uSweat tokens:
AKC_CommandMask = 0xC000,
diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp
index 300b54781b7..31ae5378b8c 100644
--- a/engines/scumm/base-costume.cpp
+++ b/engines/scumm/base-costume.cpp
@@ -44,43 +44,42 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const
_numStrips = numStrips;
if (_vm->_game.version <= 1) {
- _xmove = 0;
- _ymove = 0;
+ _xMove = 0;
+ _yMove = 0;
} else if (_vm->_game.features & GF_OLD_BUNDLE) {
- _xmove = -72;
- _ymove = -100;
+ _xMove = -72;
+ _yMove = -100;
} else {
- _xmove = _ymove = 0;
+ _xMove = _yMove = 0;
}
for (i = 0; i < 16; i++)
result |= drawLimb(a, i);
return result;
}
-void BaseCostumeRenderer::codec1_ignorePakCols(Codec1 &v1, int num) {
+void BaseCostumeRenderer::skipCelLines(ByleRLEData &compData, int num) {
num *= _height;
do {
- v1.replen = *_srcptr++;
- v1.repcolor = v1.replen >> v1.shr;
- v1.replen &= v1.mask;
+ compData.repLen = *_srcPtr++;
+ compData.repColor = compData.repLen >> compData.shr;
+ compData.repLen &= compData.mask;
- if (!v1.replen)
- v1.replen = *_srcptr++;
+ if (!compData.repLen)
+ compData.repLen = *_srcPtr++;
do {
if (!--num)
return;
- } while (--v1.replen);
- } while (1);
+ } while (--compData.repLen);
+ } while (true);
}
bool ScummEngine::isCostumeInUse(int cost) const {
- int i;
Actor *a;
if (_roomResource != 0)
- for (i = 1; i < _numActors; i++) {
+ for (int i = 1; i < _numActors; i++) {
a = derefActor(i);
if (a->isInCurrentRoom() && a->_costume == cost)
return true;
diff --git a/engines/scumm/base-costume.h b/engines/scumm/base-costume.h
index 41e422062e3..230dabbbda7 100644
--- a/engines/scumm/base-costume.h
+++ b/engines/scumm/base-costume.h
@@ -31,8 +31,8 @@ namespace Scumm {
struct CostumeInfo {
uint16 width, height;
- int16 rel_x, rel_y;
- int16 move_x, move_y;
+ int16 relX, relY;
+ int16 moveX, moveY;
} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
@@ -55,7 +55,7 @@ public:
virtual ~BaseCostumeLoader() {}
virtual void loadCostume(int id) = 0;
- virtual byte increaseAnims(Actor *a) = 0;
+ virtual bool increaseAnims(Actor *a) = 0;
virtual void costumeDecodeData(Actor *a, int frame, uint usemask) = 0;
bool hasManyDirections(int id) { return false; }
@@ -70,14 +70,14 @@ public:
Common::Rect _clipOverride;
byte _actorID;
- byte _shadow_mode;
- byte *_shadow_table;
+ byte _shadowMode;
+ byte *_shadowTable;
int _actorX, _actorY;
byte _zbuf;
byte _scaleX, _scaleY;
- int _draw_top, _draw_bottom;
+ int _drawTop, _drawBottom;
byte _paletteNum;
bool _skipLimbs;
bool _actorDrawVirScr;
@@ -91,10 +91,10 @@ protected:
int32 _numStrips;
// Source pointer
- const byte *_srcptr;
+ const byte *_srcPtr;
// current move offset
- int _xmove, _ymove;
+ int _xMove, _yMove;
// whether to draw the actor mirrored
bool _mirror;
@@ -105,42 +105,42 @@ protected:
int _width, _height;
public:
- struct Codec1 {
+ struct ByleRLEData {
// Parameters for the original ("V1") costume codec.
// These ones are accessed from ARM code. Don't reorder.
int x;
int y;
- const byte *scaletable;
+ const byte *scaleTable;
int height;
int width;
- int skip_width;
- byte *destptr;
- const byte *mask_ptr;
- int scaleXstep;
+ int skipWidth;
+ byte *destPtr;
+ const byte *maskPtr;
+ int scaleXStep;
byte mask, shr;
- byte repcolor;
- byte replen;
+ byte repColor;
+ byte repLen;
// These ones aren't accessed from ARM code.
Common::Rect boundsRect;
- int scaleXindex, scaleYindex;
+ int scaleXIndex, scaleYIndex;
};
BaseCostumeRenderer(ScummEngine *scumm) {
_actorID = 0;
- _shadow_mode = 0;
- _shadow_table = 0;
+ _shadowMode = 0;
+ _shadowTable = nullptr;
_actorX = _actorY = 0;
_zbuf = 0;
_scaleX = _scaleY = 0;
- _draw_top = _draw_bottom = 0;
+ _drawTop = _drawBottom = 0;
_vm = scumm;
_numStrips = -1;
- _srcptr = 0;
- _xmove = _ymove = 0;
+ _srcPtr = nullptr;
+ _xMove = _yMove = 0;
_mirror = false;
_width = _height = 0;
- _skipLimbs = 0;
+ _skipLimbs = false;
_paletteNum = 0;
}
virtual ~BaseCostumeRenderer() {}
@@ -155,7 +155,7 @@ public:
protected:
virtual byte drawLimb(const Actor *a, int limb) = 0;
- void codec1_ignorePakCols(Codec1 &v1, int num);
+ void skipCelLines(ByleRLEData &compData, int num);
};
} // End of namespace Scumm
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index 45417a89c46..fc2624ad7c6 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -79,32 +79,32 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
int ex1, ex2;
Common::Rect rect;
int step;
- Codec1 v1;
+ ByleRLEData compData;
const int scaletableSize = 128;
const bool newAmiCost = (_vm->_game.version == 5) && (_vm->_game.platform == Common::kPlatformAmiga);
const bool pcEngCost = (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine);
- v1.scaletable = smallCostumeScaleTable;
+ compData.scaleTable = smallCostumeScaleTable;
if (_loaded._numColors == 32) {
- v1.mask = 7;
- v1.shr = 3;
+ compData.mask = 7;
+ compData.shr = 3;
} else {
- v1.mask = 15;
- v1.shr = 4;
+ compData.mask = 15;
+ compData.shr = 4;
}
switch (_loaded._format) {
case 0x60:
case 0x61:
// This format is used e.g. in the Sam&Max intro
- ex1 = _srcptr[0];
- ex2 = _srcptr[1];
- _srcptr += 2;
+ ex1 = _srcPtr[0];
+ ex2 = _srcPtr[1];
+ _srcPtr += 2;
if (ex1 != 0xFF || ex2 != 0xFF) {
ex1 = READ_LE_UINT16(_loaded._frameOffsets + ex1 * 2);
- _srcptr = _loaded._baseptr + READ_LE_UINT16(_loaded._baseptr + ex1 + ex2 * 2) + 14;
+ _srcPtr = _loaded._baseptr + READ_LE_UINT16(_loaded._baseptr + ex1 + ex2 * 2) + 14;
}
break;
default:
@@ -113,20 +113,20 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF);
- v1.x = _actorX;
- v1.y = _actorY;
+ compData.x = _actorX;
+ compData.y = _actorY;
// V0/V1 games are off by 1
if (_vm->_game.version <= 1)
- v1.y += 1;
+ compData.y += 1;
if (use_scaling) {
/* Scale direction */
- v1.scaleXstep = -1;
+ compData.scaleXStep = -1;
if (xmoveCur < 0) {
xmoveCur = -xmoveCur;
- v1.scaleXstep = 1;
+ compData.scaleXStep = 1;
}
// It's possible that the scale indexes will overflow and wrap
@@ -138,11 +138,11 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
/* Adjust X position */
startScaleIndexX = _scaleIndexX = scaletableSize - xmoveCur;
for (i = 0; i < xmoveCur; i++) {
- if (v1.scaletable[_scaleIndexX++] < _scaleX)
- v1.x -= v1.scaleXstep;
+ if (compData.scaleTable[_scaleIndexX++] < _scaleX)
+ compData.x -= compData.scaleXStep;
}
- rect.left = rect.right = v1.x;
+ rect.left = rect.right = compData.x;
_scaleIndexX = startScaleIndexX;
for (i = 0; i < _width; i++) {
@@ -150,7 +150,7 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
skip++;
startScaleIndexX = _scaleIndexX;
}
- if (v1.scaletable[_scaleIndexX++] < _scaleX)
+ if (compData.scaleTable[_scaleIndexX++] < _scaleX)
rect.right++;
}
} else {
@@ -158,11 +158,11 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
/* Adjust X position */
startScaleIndexX = _scaleIndexX = xmoveCur + scaletableSize;
for (i = 0; i < xmoveCur; i++) {
- if (v1.scaletable[_scaleIndexX--] < _scaleX)
- v1.x += v1.scaleXstep;
+ if (compData.scaleTable[_scaleIndexX--] < _scaleX)
+ compData.x += compData.scaleXStep;
}
- rect.left = rect.right = v1.x;
+ rect.left = rect.right = compData.x;
_scaleIndexX = startScaleIndexX;
for (i = 0; i < _width; i++) {
@@ -170,7 +170,7 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
startScaleIndexX = _scaleIndexX;
skip++;
}
- if (v1.scaletable[_scaleIndexX--] < _scaleX)
+ if (compData.scaleTable[_scaleIndexX--] < _scaleX)
rect.left--;
}
}
@@ -187,14 +187,14 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
_scaleIndexY = scaletableSize - ymoveCur;
for (i = 0; i < ymoveCur; i++) {
- if (v1.scaletable[_scaleIndexY++] < _scaleY)
- v1.y -= step;
+ if (compData.scaleTable[_scaleIndexY++] < _scaleY)
+ compData.y -= step;
}
- rect.top = rect.bottom = v1.y;
+ rect.top = rect.bottom = compData.y;
_scaleIndexY = scaletableSize - ymoveCur;
for (i = 0; i < _height; i++) {
- if (v1.scaletable[_scaleIndexY++] < _scaleY)
+ if (compData.scaleTable[_scaleIndexY++] < _scaleY)
rect.bottom++;
}
@@ -203,24 +203,24 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
if (!_mirror)
xmoveCur = -xmoveCur;
- v1.x += xmoveCur;
- v1.y += ymoveCur;
+ compData.x += xmoveCur;
+ compData.y += ymoveCur;
if (_mirror) {
- rect.left = v1.x;
- rect.right = v1.x + _width;
+ rect.left = compData.x;
+ rect.right = compData.x + _width;
} else {
- rect.left = v1.x - _width;
- rect.right = v1.x;
+ rect.left = compData.x - _width;
+ rect.right = compData.x;
}
- rect.top = v1.y;
+ rect.top = compData.y;
rect.bottom = rect.top + _height;
}
- v1.skip_width = _width;
- v1.scaleXstep = _mirror ? 1 : -1;
+ compData.skipWidth = _width;
+ compData.scaleXStep = _mirror ? 1 : -1;
if (_vm->_game.version == 1)
// V1 games uses 8 x 8 pixels for actors
@@ -234,23 +234,23 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
if (rect.left >= _out.w || rect.right <= 0)
return 0;
- v1.replen = 0;
+ compData.repLen = 0;
if (_mirror) {
if (!use_scaling)
- skip = -v1.x;
+ skip = -compData.x;
if (skip > 0) {
if (!newAmiCost && !pcEngCost && _loaded._format != 0x57) {
- v1.skip_width -= skip;
- codec1_ignorePakCols(v1, skip);
- v1.x = 0;
+ compData.skipWidth -= skip;
+ skipCelLines(compData, skip);
+ compData.x = 0;
}
} else {
skip = rect.right - _out.w;
if (skip <= 0) {
drawFlag = 2;
} else {
- v1.skip_width -= skip;
+ compData.skipWidth -= skip;
}
}
} else {
@@ -258,9 +258,9 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
skip = rect.right - _out.w;
if (skip > 0) {
if (!newAmiCost && !pcEngCost && _loaded._format != 0x57) {
- v1.skip_width -= skip;
- codec1_ignorePakCols(v1, skip);
- v1.x = _out.w - 1;
+ compData.skipWidth -= skip;
+ skipCelLines(compData, skip);
+ compData.x = _out.w - 1;
}
} else {
// V1 games uses 8 x 8 pixels for actors
@@ -271,11 +271,11 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
if (skip <= 0)
drawFlag = 2;
else
- v1.skip_width -= skip;
+ compData.skipWidth -= skip;
}
}
- if (v1.skip_width <= 0)
+ if (compData.skipWidth <= 0)
return 0;
if (rect.left < 0)
@@ -290,31 +290,31 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
if (rect.bottom > _out.h)
rect.bottom = _out.h;
- if (_draw_top > rect.top)
- _draw_top = rect.top;
- if (_draw_bottom < rect.bottom)
- _draw_bottom = rect.bottom;
+ if (_drawTop > rect.top)
+ _drawTop = rect.top;
+ if (_drawBottom < rect.bottom)
+ _drawBottom = rect.bottom;
if (_height + rect.top >= 256) {
return 2;
}
- v1.width = _out.w;
- v1.height = _out.h;
- v1.destptr = (byte *)_out.getBasePtr(v1.x, v1.y);
+ compData.width = _out.w;
+ compData.height = _out.h;
+ compData.destPtr = (byte *)_out.getBasePtr(compData.x, compData.y);
- v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf);
+ compData.maskPtr = _vm->getMaskBuffer(0, compData.y, _zbuf);
if (_loaded._format == 0x57) {
// The v1 costume renderer needs the actor number, which is
// the same thing as the costume renderer's _actorID.
- procC64(v1, _actorID);
+ procC64(compData, _actorID);
} else if (newAmiCost)
- proc3_ami(v1);
+ proc3_ami(compData);
else if (pcEngCost)
- procPCEngine(v1);
+ procPCEngine(compData);
else
- proc3(v1);
+ proc3(compData);
return drawFlag;
}
@@ -329,7 +329,7 @@ static const int v1MMActorPalatte2[25] = {
};
#define MASK_AT(xoff) \
- (mask && (mask[((v1.x + xoff) / 8)] & revBitMask((v1.x + xoff) & 7)))
+ (mask && (mask[((compData.x + xoff) / 8)] & revBitMask((compData.x + xoff) & 7)))
#define LINE(c,p) \
pcolor = (color >> c) & 3; \
if (pcolor) { \
@@ -339,7 +339,7 @@ static const int v1MMActorPalatte2[25] = {
dst[p + 1] = palette[pcolor]; \
}
-void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) {
+void ClassicCostumeRenderer::procC64(ByleRLEData &compData, int actor) {
const byte *mask, *src;
byte *dst;
byte len;
@@ -348,14 +348,14 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) {
byte color, pcolor;
bool rep;
- y = v1.y;
- src = _srcptr;
- dst = v1.destptr;
- len = v1.replen;
- color = v1.repcolor;
+ y = compData.y;
+ src = _srcPtr;
+ dst = compData.destPtr;
+ len = compData.repLen;
+ color = compData.repColor;
height = _height;
- v1.skip_width /= 8;
+ compData.skipWidth /= 8;
// Set up the palette data
byte palette[4] = { 0, 0, 0, 0 };
@@ -372,7 +372,7 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) {
palette[2] = _vm->_gdi->remapColorToRenderMode(11);
palette[3] = _vm->_gdi->remapColorToRenderMode(11);
}
- mask = v1.mask_ptr;
+ mask = compData.maskPtr;
if (len)
goto StartPos;
@@ -388,7 +388,7 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) {
if (!rep)
color = *src++;
- if (0 <= y && y < _out.h && 0 <= v1.x && v1.x < _out.w) {
+ if (0 <= y && y < _out.h && 0 <= compData.x && compData.x < _out.w) {
if (!_mirror) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else {
@@ -399,16 +399,16 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) {
y++;
mask += _numStrips;
if (!--height) {
- if (!--v1.skip_width)
+ if (!--compData.skipWidth)
return;
height = _height;
- y = v1.y;
- v1.x += 8 * v1.scaleXstep;
- if (v1.x < 0 || v1.x >= _out.w)
+ y = compData.y;
+ compData.x += 8 * compData.scaleXStep;
+ if (compData.x < 0 || compData.x >= _out.w)
return;
- mask = v1.mask_ptr;
- v1.destptr += 8 * v1.scaleXstep;
- dst = v1.destptr;
+ mask = compData.maskPtr;
+ compData.destPtr += 8 * compData.scaleXStep;
+ dst = compData.destPtr;
}
}
} while (1);
@@ -424,19 +424,19 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) {
#endif
extern "C" int ClassicProc3RendererShadowARM(int _scaleY,
- ClassicCostumeRenderer::Codec1 *v1,
+ ClassicCostumeRenderer::ByleRLEData *compData,
int pitch,
const byte *src,
int height,
int _scaleX,
int _scaleIndexX,
- byte *_shadow_table,
+ byte *_shadowTable,
uint16 _palette[32],
int32 _numStrips,
int _scaleIndexY);
#endif
-void ClassicCostumeRenderer::proc3(Codec1 &v1) {
+void ClassicCostumeRenderer::proc3(ByleRLEData &compData) {
const byte *mask, *src;
byte *dst;
byte len, maskbit;
@@ -446,18 +446,18 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
bool masked;
#ifdef USE_ARM_COSTUME_ASM
- if (((_shadow_mode & 0x20) == 0) &&
- (v1.mask_ptr != NULL) &&
- (_shadow_table != NULL))
+ if (((_shadowMode & 0x20) == 0) &&
+ (compData.maskPtr != NULL) &&
+ (_shadowTable != NULL))
{
_scaleIndexX = ClassicProc3RendererShadowARM(_scaleY,
- &v1,
+ &compData,
_out.pitch,
- _srcptr,
+ _srcPtr,
_height,
_scaleX,
_scaleIndexX,
- _shadow_table,
+ _shadowTable,
_palette,
_numStrips,
_scaleIndexY);
@@ -465,38 +465,38 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
}
#endif /* USE_ARM_COSTUME_ASM */
- y = v1.y;
- src = _srcptr;
- dst = v1.destptr;
- len = v1.replen;
- color = v1.repcolor;
+ y = compData.y;
+ src = _srcPtr;
+ dst = compData.destPtr;
+ len = compData.repLen;
+ color = compData.repColor;
height = _height;
scaleIndexY = _scaleIndexY;
- maskbit = revBitMask(v1.x & 7);
- mask = v1.mask_ptr + v1.x / 8;
+ maskbit = revBitMask(compData.x & 7);
+ mask = compData.maskPtr + compData.x / 8;
if (len)
goto StartPos;
do {
len = *src++;
- color = len >> v1.shr;
- len &= v1.mask;
+ color = len >> compData.shr;
+ len &= compData.mask;
if (!len)
len = *src++;
do {
- if (_scaleY == 255 || v1.scaletable[scaleIndexY++] < _scaleY) {
- masked = (y < 0 || y >= _out.h) || (v1.x < 0 || v1.x >= _out.w) || (v1.mask_ptr && (mask[0] & maskbit));
+ if (_scaleY == 255 || compData.scaleTable[scaleIndexY++] < _scaleY) {
+ masked = (y < 0 || y >= _out.h) || (compData.x < 0 || compData.x >= _out.w) || (compData.maskPtr && (mask[0] & maskbit));
if (color && !masked) {
- if (_shadow_mode & 0x20) {
- pcolor = _shadow_table[*dst];
+ if (_shadowMode & 0x20) {
+ pcolor = _shadowTable[*dst];
} else {
pcolor = _palette[color];
- if (pcolor == 13 && _shadow_table)
- pcolor = _shadow_table[*dst];
+ if (pcolor == 13 && _shadowTable)
+ pcolor = _shadowTable[*dst];
}
*dst = pcolor;
}
@@ -505,30 +505,30 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
y++;
}
if (!--height) {
- if (!--v1.skip_width)
+ if (!--compData.skipWidth)
return;
height = _height;
- y = v1.y;
+ y = compData.y;
scaleIndexY = _scaleIndexY;
- if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
- v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= _out.w)
+ if (_scaleX == 255 || compData.scaleTable[_scaleIndexX] < _scaleX) {
+ compData.x += compData.scaleXStep;
+ if (compData.x < 0 || compData.x >= _out.w)
return;
- maskbit = revBitMask(v1.x & 7);
- v1.destptr += v1.scaleXstep;
+ maskbit = revBitMask(compData.x & 7);
+ compData.destPtr += compData.scaleXStep;
}
- _scaleIndexX += v1.scaleXstep;
- dst = v1.destptr;
- mask = v1.mask_ptr + v1.x / 8;
+ _scaleIndexX += compData.scaleXStep;
+ dst = compData.destPtr;
+ mask = compData.maskPtr + compData.x / 8;
}
StartPos:;
} while (--len);
} while (1);
}
-void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
+void ClassicCostumeRenderer::proc3_ami(ByleRLEData &compData) {
const byte *mask, *src;
byte *dst;
byte maskbit, len, height, width;
@@ -537,14 +537,14 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
bool masked;
int oldXpos, oldScaleIndexX;
- mask = v1.mask_ptr + v1.x / 8;
- dst = v1.destptr;
+ mask = compData.maskPtr + compData.x / 8;
+ dst = compData.destPtr;
height = _height;
width = _width;
- src = _srcptr;
- maskbit = revBitMask(v1.x & 7);
- y = v1.y;
- oldXpos = v1.x;
+ src = _srcPtr;
+ maskbit = revBitMask(compData.x & 7);
+ y = compData.y;
+ oldXpos = compData.x;
oldScaleIndexX = _scaleIndexX;
// Indy4 Amiga always uses the room map to match colors to the currently
@@ -556,13 +556,13 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
do {
len = *src++;
- color = len >> v1.shr;
- len &= v1.mask;
+ color = len >> compData.shr;
+ len &= compData.mask;
if (!len)
len = *src++;
do {
- if (_scaleY == 255 || v1.scaletable[_scaleIndexY] < _scaleY) {
- masked = (y < 0 || y >= _out.h) || (v1.x < 0 || v1.x >= _out.w) || (v1.mask_ptr && (mask[0] & maskbit));
+ if (_scaleY == 255 || compData.scaleTable[_scaleIndexY] < _scaleY) {
+ masked = (y < 0 || y >= _out.h) || (compData.x < 0 || compData.x >= _out.w) || (compData.maskPtr && (mask[0] & maskbit));
if (color && !masked) {
if (amigaMap)
@@ -571,13 +571,13 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
*dst = _palette[color];
}
- if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
- v1.x += v1.scaleXstep;
- dst += v1.scaleXstep;
- maskbit = revBitMask(v1.x & 7);
+ if (_scaleX == 255 || compData.scaleTable[_scaleIndexX] < _scaleX) {
+ compData.x += compData.scaleXStep;
+ dst += compData.scaleXStep;
+ maskbit = revBitMask(compData.x & 7);
}
- _scaleIndexX += v1.scaleXstep;
- mask = v1.mask_ptr + v1.x / 8;
+ _scaleIndexX += compData.scaleXStep;
+ mask = compData.maskPtr + compData.x / 8;
}
if (!--width) {
if (!--height)
@@ -586,15 +586,15 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
if (y >= _out.h)
return;
- if (v1.x != oldXpos) {
- dst += _out.pitch - (v1.x - oldXpos);
- v1.mask_ptr += _numStrips;
- mask = v1.mask_ptr + oldXpos / 8;
+ if (compData.x != oldXpos) {
+ dst += _out.pitch - (compData.x - oldXpos);
+ compData.maskPtr += _numStrips;
+ mask = compData.maskPtr + oldXpos / 8;
maskbit = revBitMask(oldXpos & 7);
y++;
}
width = _width;
- v1.x = oldXpos;
+ compData.x = oldXpos;
_scaleIndexX = oldScaleIndexX;
_scaleIndexY++;
}
@@ -612,7 +612,7 @@ static void PCESetCostumeData(byte block[16][16], int index, byte value) {
}
}
-void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) {
+void ClassicCostumeRenderer::procPCEngine(ByleRLEData &compData) {
const byte *mask, *src;
byte *dst;
byte maskbit;
@@ -623,7 +623,7 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) {
int xStep;
byte block[16][16];
- src = _srcptr;
+ src = _srcPtr;
width = _width / 16;
height = _height / 16;
@@ -668,14 +668,14 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) {
for (int row = 0; row < 16; ++row) {
xPos = xStep * x * 16;
for (int col = 0; col < 16; ++col) {
- dst = v1.destptr + yPos * _out.pitch + xPos * _vm->_bytesPerPixel;
- mask = v1.mask_ptr + yPos * _numStrips + (v1.x + xPos) / 8;
- maskbit = revBitMask((v1.x + xPos) % 8);
+ dst = compData.destPtr + yPos * _out.pitch + xPos * _vm->_bytesPerPixel;
+ mask = compData.maskPtr + yPos * _numStrips + (compData.x + xPos) / 8;
+ maskbit = revBitMask((compData.x + xPos) % 8);
pcolor = block[row][col];
- masked = (v1.y + yPos < 0 || v1.y + yPos >= _out.h) ||
- (v1.x + xPos < 0 || v1.x + xPos >= _out.w) ||
- (v1.mask_ptr && (mask[0] & maskbit));
+ masked = (compData.y + yPos < 0 || compData.y + yPos >= _out.h) ||
+ (compData.x + xPos < 0 || compData.x + xPos >= _out.w) ||
+ (compData.maskPtr && (mask[0] & maskbit));
if (pcolor && !masked) {
WRITE_UINT16(dst, ((uint16 *)_palette)[pcolor]);
@@ -854,8 +854,8 @@ byte NESCostumeRenderer::drawLimb(const Actor *a, int limb) {
}
}
- _draw_top = top;
- _draw_bottom = bottom;
+ _drawTop = top;
+ _drawBottom = bottom;
_vm->markRectAsDirty(kMainVirtScreen, left, right, top, bottom, _actorID);
@@ -891,38 +891,38 @@ byte ClassicCostumeRenderer::drawLimb(const Actor *a, int limb) {
if (code != 0x7B) {
if (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine)
baseptr = frameptr + code * 2 + 2;
- _srcptr = baseptr + READ_LE_UINT16(frameptr + code * 2);
+ _srcPtr = baseptr + READ_LE_UINT16(frameptr + code * 2);
if (!(_vm->_game.features & GF_OLD256) || code < 0x79) {
const CostumeInfo *costumeInfo;
int xmoveCur, ymoveCur;
if (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine) {
- _numBlocks = _srcptr[0];
- _width = _srcptr[1] * 16;
- _height = _srcptr[2] * 16;
- xmoveCur = _xmove + PCE_SIGNED(_srcptr[3]);
- ymoveCur = _ymove + PCE_SIGNED(_srcptr[4]);
- _xmove += PCE_SIGNED(_srcptr[5]);
- _ymove -= PCE_SIGNED(_srcptr[6]);
- _srcptr += 7;
+ _numBlocks = _srcPtr[0];
+ _width = _srcPtr[1] * 16;
+ _height = _srcPtr[2] * 16;
+ xmoveCur = _xMove + PCE_SIGNED(_srcPtr[3]);
+ ymoveCur = _yMove + PCE_SIGNED(_srcPtr[4]);
+ _xMove += PCE_SIGNED(_srcPtr[5]);
+ _yMove -= PCE_SIGNED(_srcPtr[6]);
+ _srcPtr += 7;
} else if (_loaded._format == 0x57) {
- _width = _srcptr[0] * 8;
- _height = _srcptr[1];
- xmoveCur = _xmove + (int8)_srcptr[2] * 8;
- ymoveCur = _ymove - (int8)_srcptr[3];
- _xmove += (int8)_srcptr[4] * 8;
- _ymove -= (int8)_srcptr[5];
- _srcptr += 6;
+ _width = _srcPtr[0] * 8;
+ _height = _srcPtr[1];
+ xmoveCur = _xMove + (int8)_srcPtr[2] * 8;
+ ymoveCur = _yMove - (int8)_srcPtr[3];
+ _xMove += (int8)_srcPtr[4] * 8;
+ _yMove -= (int8)_srcPtr[5];
+ _srcPtr += 6;
} else {
- costumeInfo = (const CostumeInfo *)_srcptr;
+ costumeInfo = (const CostumeInfo *)_srcPtr;
_width = READ_LE_UINT16(&costumeInfo->width);
_height = READ_LE_UINT16(&costumeInfo->height);
- xmoveCur = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x);
- ymoveCur = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y);
- _xmove += (int16)READ_LE_UINT16(&costumeInfo->move_x);
- _ymove -= (int16)READ_LE_UINT16(&costumeInfo->move_y);
- _srcptr += 12;
+ xmoveCur = _xMove + (int16)READ_LE_UINT16(&costumeInfo->relX);
+ ymoveCur = _yMove + (int16)READ_LE_UINT16(&costumeInfo->relY);
+ _xMove += (int16)READ_LE_UINT16(&costumeInfo->moveX);
+ _yMove -= (int16)READ_LE_UINT16(&costumeInfo->moveY);
+ _srcPtr += 12;
}
// WORKAROUND: During the intro, there are a couple of
@@ -1071,7 +1071,7 @@ void ClassicCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask)
i++;
usemask <<= 1;
mask <<= 1;
- } while (mask&0xFFFF);
+ } while (mask & 0xFFFF);
}
void ClassicCostumeRenderer::setPalette(uint16 *palette) {
@@ -1116,24 +1116,23 @@ void ClassicCostumeRenderer::setCostume(int costume, int shadow) {
_loaded.loadCostume(costume);
}
-byte ClassicCostumeLoader::increaseAnims(Actor *a) {
- int i;
- byte r = 0;
+bool ClassicCostumeLoader::increaseAnims(Actor *a) {
+ bool r = false;
- for (i = 0; i != 16; i++) {
+ for (int i = 0; i != 16; i++) {
if (a->_cost.curpos[i] != 0xFFFF)
- r += increaseAnim(a, i);
+ r |= increaseAnim(a, i);
}
return r;
}
-byte ClassicCostumeLoader::increaseAnim(Actor *a, int slot) {
+bool ClassicCostumeLoader::increaseAnim(Actor *a, int slot) {
int highflag;
int i, end;
byte code, nc;
if (a->_cost.curpos[slot] == 0xFFFF)
- return 0;
+ return false;
highflag = a->_cost.curpos[slot] & 0x8000;
i = a->_cost.curpos[slot] & 0x7FFF;
@@ -1178,7 +1177,7 @@ byte ClassicCostumeLoader::increaseAnim(Actor *a, int slot) {
a->_cost.curpos[slot] = i | highflag;
return (_animCmds[i] & 0x7F) != code;
- } while (1);
+ } while (true);
}
/**
@@ -1208,18 +1207,17 @@ void NESCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
a->_cost.frame[0] = anim;
}
-byte NESCostumeLoader::increaseAnims(Actor *a) {
- int i;
- byte r = 0;
+bool NESCostumeLoader::increaseAnims(Actor *a) {
+ bool r = false;
- for (i = 0; i != 16; i++) {
+ for (int i = 0; i != 16; i++) {
if (a->_cost.curpos[i] != 0xFFFF)
- r += increaseAnim(a, i);
+ r |= increaseAnim(a, i);
}
return r;
}
-byte NESCostumeLoader::increaseAnim(Actor *a, int slot) {
+bool NESCostumeLoader::increaseAnim(Actor *a, int slot) {
int oldframe = a->_cost.curpos[slot]++;
if (a->_cost.curpos[slot] >= a->_cost.end[slot])
a->_cost.curpos[slot] = a->_cost.start[slot];
@@ -1248,8 +1246,8 @@ byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) {
return 0;
if (limb == 0) {
- _draw_top = 200;
- _draw_bottom = 0;
+ _drawTop = 200;
+ _drawBottom = 0;
}
// Invalid current position?
@@ -1278,10 +1276,10 @@ byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) {
int width = data[0];
int height = data[1];
- int offsetX = _xmove + data[2];
- int offsetY = _ymove + data[3];
- _xmove += (int8)data[4];
- _ymove += (int8)data[5];
+ int offsetX = _xMove + data[2];
+ int offsetY = _yMove + data[3];
+ _xMove += (int8)data[4];
+ _yMove += (int8)data[5];
data += 6;
if (!width || !height)
@@ -1312,8 +1310,8 @@ byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) {
}
}
- _draw_top = MIN(_draw_top, ypos);
- _draw_bottom = MAX(_draw_bottom, ypos + height);
+ _drawTop = MIN(_drawTop, ypos);
+ _drawBottom = MAX(_drawBottom, ypos + height);
if (a0->_limb_flipped[limb])
_vm->markRectAsDirty(kMainVirtScreen, xpos - (width * 8), xpos, ypos, ypos + height, _actorID);
else
@@ -1407,19 +1405,19 @@ byte V0CostumeLoader::getFrame(Actor *a, int limb) {
return _frameOffsets[_frameOffsets[limb] + a->_cost.start[limb]];
}
-byte V0CostumeLoader::increaseAnims(Actor *a) {
+bool V0CostumeLoader::increaseAnims(Actor *a) {
Actor_v0 *a0 = (Actor_v0 *)a;
int i;
- byte r = 0;
+ bool r = false;
for (i = 0; i != 8; i++) {
a0->limbFrameCheck(i);
- r += increaseAnim(a, i);
+ r |= increaseAnim(a, i);
}
return r;
}
-byte V0CostumeLoader::increaseAnim(Actor *a, int limb) {
+bool V0CostumeLoader::increaseAnim(Actor *a, int limb) {
Actor_v0 *a0 = (Actor_v0 *)a;
const uint16 limbPrevious = a->_cost.curpos[limb]++;
@@ -1457,10 +1455,7 @@ byte V0CostumeLoader::increaseAnim(Actor *a, int limb) {
}
// Limb frame has changed?
- if (limbPrevious == a->_cost.curpos[limb])
- return 0;
-
- return 1;
+ return limbPrevious != a->_cost.curpos[limb];
}
} // End of namespace Scumm
diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h
index 9f8d846f5ad..9615664cdd1 100644
--- a/engines/scumm/costume.h
+++ b/engines/scumm/costume.h
@@ -45,10 +45,10 @@ public:
void loadCostume(int id) override;
void costumeDecodeData(Actor *a, int frame, uint usemask) override;
- byte increaseAnims(Actor *a) override;
+ bool increaseAnims(Actor *a) override;
protected:
- byte increaseAnim(Actor *a, int slot);
+ bool increaseAnim(Actor *a, int slot);
};
class NESCostumeLoader : public BaseCostumeLoader {
@@ -61,10 +61,10 @@ public:
NESCostumeLoader(ScummEngine *vm) : BaseCostumeLoader(vm) {}
void loadCostume(int id) override;
void costumeDecodeData(Actor *a, int frame, uint usemask) override;
- byte increaseAnims(Actor *a) override;
+ bool increaseAnims(Actor *a) override;
protected:
- byte increaseAnim(Actor *a, int slot);
+ bool increaseAnim(Actor *a, int slot);
};
class V0CostumeLoader : public ClassicCostumeLoader {
@@ -72,11 +72,11 @@ public:
V0CostumeLoader(ScummEngine *vm) : ClassicCostumeLoader(vm) {}
void loadCostume(int id) override;
void costumeDecodeData(Actor *a, int frame, uint usemask) override;
- byte increaseAnims(Actor *a) override;
+ bool increaseAnims(Actor *a) override;
byte getFrame(Actor *a, int limb);
protected:
- byte increaseAnim(Actor *a, int limb);
+ bool increaseAnim(Actor *a, int limb);
};
class ClassicCostumeRenderer : public BaseCostumeRenderer {
@@ -97,12 +97,12 @@ public:
protected:
byte drawLimb(const Actor *a, int limb) override;
- void proc3(Codec1 &v1);
- void proc3_ami(Codec1 &v1);
+ void proc3(ByleRLEData &v1);
+ void proc3_ami(ByleRLEData &v1);
- void procC64(Codec1 &v1, int actor);
+ void procC64(ByleRLEData &v1, int actor);
- void procPCEngine(Codec1 &v1);
+ void procPCEngine(ByleRLEData &v1);
byte mainRoutine(int xmoveCur, int ymoveCur);
};
More information about the Scummvm-git-logs
mailing list