aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/detection.cpp22
-rw-r--r--engines/kyra/lol.cpp2
-rw-r--r--engines/kyra/screen.cpp17
-rw-r--r--engines/kyra/screen.h10
-rw-r--r--engines/kyra/screen_lol.cpp152
-rw-r--r--engines/kyra/screen_lol.h16
6 files changed, 58 insertions, 161 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index 3491c54b36..63d15419d2 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -263,26 +263,12 @@ const KYRAGameDescription adGameDescs[] = {
KYRA1_TOWNS_SJIS_FLAGS
},
- { // PC-9821 (CD) version
- {
- "kyra1",
- "CD",
- {
- { "EMC.PAK", 0, "a046bb0b422061aab8e4c4689400343a", -1 },
- { "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 },
- { NULL, 0, NULL, 0 }
- },
- Common::EN_ANY,
- Common::kPlatformPC98,
- ADGF_CD,
- Common::GUIO_NOSPEECH
- },
- KYRA1_TOWNS_FLAGS
- },
+ // PC-9801 floppy + CD / PC-9821 floppy version are all using the same data files,
+ // thus we will mark it as non CD game.
{
{
"kyra1",
- "CD",
+ "",
{
{ "JMC.PAK", 0, "9c5707a2a478e8167e44283246612d2c", -1 },
{ "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 },
@@ -290,7 +276,7 @@ const KYRAGameDescription adGameDescs[] = {
},
Common::JA_JPN,
Common::kPlatformPC98,
- ADGF_CD,
+ ADGF_NO_FLAGS,
Common::GUIO_NOSPEECH
},
KYRA1_TOWNS_SJIS_FLAGS
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 020e1ea3ea..7c4b073f29 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -2880,7 +2880,7 @@ void LoLEngine::drinkBezelCup(int numUses, int charNum) {
uint16 step = 0;
do {
- step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 2]);
+ step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 1]);
increaseCharacterHitpoints(charNum, step / 256, true);
gui_drawCharPortraitWithStats(charNum);
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index fa54bffa98..963dc3f4d6 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -1529,6 +1529,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
_dsTmpWidth = shapeWidth;
int cnt = _dsOffscreenLeft;
int scaleState = (this->*_dsProcessMargin)(d, src, cnt);
+
if (_dsTmpWidth) {
cnt += shpWidthScaled1;
if (cnt > 0) {
@@ -1584,7 +1585,6 @@ int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt)
while (cnt > 0) {
--cnt;
-
if (*src++)
continue;
@@ -1611,7 +1611,6 @@ int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cn
while (cnt > 0) {
--cnt;
-
if (*src++)
continue;
@@ -1640,10 +1639,11 @@ int Screen::drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) {
return 0;
do {
+ --cnt;
if (*src++)
continue;
cnt = cnt + 1 - (*src++);
- } while (--cnt > 0);
+ } while (cnt > 0);
return 0;
}
@@ -1656,16 +1656,17 @@ int Screen::drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt)
return 0;
do {
+ --cnt;
if (*src++)
continue;
found = true;
cnt = cnt + 1 - (*src++);
- } while (--cnt > 0);
+ } while (cnt > 0);
return found ? 0 : _dsOffscreenScaleVal1;
}
-void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
+void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) {
do {
uint8 c = *src++;
if (c) {
@@ -1680,7 +1681,7 @@ void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, i
} while (cnt > 0);
}
-void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
+void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) {
do {
uint8 c = *src++;
if (c) {
@@ -1695,7 +1696,7 @@ void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src,
} while (cnt > 0);
}
-void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
+void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) {
int c = 0;
do {
@@ -1723,7 +1724,7 @@ void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int
cnt = -1;
}
-void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
+void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) {
int c = 0;
do {
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 390d058bb8..956bd7107e 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -421,10 +421,10 @@ protected:
int drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
int drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt);
int drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
- void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
- void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
- void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
- void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
+ void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
+ void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
+ void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
+ void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
void drawShapePlotType0(uint8 *dst, uint8 cmd);
void drawShapePlotType1(uint8 *dst, uint8 cmd);
@@ -446,7 +446,7 @@ protected:
void drawShapePlotType52(uint8 *dst, uint8 cmd);
typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt);
- typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
+ typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
typedef void (Screen::*DsPlotFunc)(uint8 *dst, uint8 cmd);
DsMarginSkipFunc _dsProcessMargin;
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index b9bf9961c5..46b243a4cf 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -44,8 +44,6 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system),
_fadeFlag = 2;
_curDimIndex = 0;
-
- _internDimX = _internDimY = _internDimW = _internDimH = _internDimDstX = _internBlockWidth = _internDimDstY = _internBlockHeight = _internDimU5 = _internDimU6 = _internBlockWidth2 = _internDimU8 = 0;
}
Screen_LoL::~Screen_LoL() {
@@ -588,44 +586,25 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
va_end(args);
}
- // _internDimH: h0
-// _internDimW: w0
-// _internDimDstX: x1
-// _internDimDstY: y1
-// _internBlockWidth: w1
-// _internBlockHeight: h1
-// _internDimU5: x2
-// _internDimU6: y2
-// _internBlockWidth2: w2
-
- _internDimX = _internDimY = 0;
- _internDimW = w1;
- _internDimH = h1;
- calcBoundariesIntern(x1, y1, w3, h3);
- if (_internBlockWidth == -1)
+ int na = 0, nb = 0, nc = w3;
+ if (!calcBounds(w1, h1, x1, y1, w3, h3, na, nb, nc))
return;
- int iu5_1 = _internDimU5;
- int iu6_1 = _internDimU6;
- int ibw_1 = _internBlockWidth;
- int ibh_1 = _internBlockHeight;
- int dx_1 = _internDimDstX;
- int dy_1 = _internDimDstY;
-
- _internDimX = _internDimY = 0;
- _internDimW = w2;
- _internDimH = h2;
+ int iu5_1 = na;
+ int iu6_1 = nb;
+ int ibw_1 = w3;
+ int dx_1 = x1;
+ int dy_1 = y1;
- calcBoundariesIntern(x2, y2, ibw_1, ibh_1);
- if (_internBlockWidth == -1)
+ if (!calcBounds(w2, h2, x2, y2, w3, h3, na, nb, nc))
return;
- int iu5_2 = _internDimU5;
- int iu6_2 = _internDimU6;
- int ibw_2 = _internBlockWidth;
- int ibh_2 = _internBlockHeight;
- int dx_2 = _internDimDstX;
- int dy_2 = _internDimDstY;
+ int iu5_2 = na;
+ int iu6_2 = nb;
+ int ibw_2 = w3;
+ int ibh_2 = h3;
+ int dx_2 = x2;
+ int dy_2 = y2;
uint8 *src = getPagePtr(page1) + (dy_1 + iu6_2) * w1;
uint8 *dst = getPagePtr(page2) + (dy_2 + iu6_1) * w2;
@@ -670,7 +649,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
}
if (!page2)
- addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
+ addDirtyRect(x2, y2, w2, h2);
}
void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl) {
@@ -678,23 +657,23 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2,
return;
const ScreenDim *cdim = getScreenDim(dim);
- _internDimX = cdim->sx << 3;
- _internDimY = cdim->sy;
- _internDimW = cdim->w << 3;
- _internDimH = cdim->h;
+ int ix = cdim->sx << 3;
+ int iy = cdim->sy;
+ int iw = cdim->w << 3;
+ int ih = cdim->h;
- calcBoundariesIntern(x2, y2, w, h);
- if (_internBlockWidth == -1)
+ int na = 0, nb = 0, nc = w;
+ if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc))
return;
uint8 *src = getPagePtr(page1) + y1 * 320 + x1;
- uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320;
+ uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320;
- for (int i = 0; i < _internBlockHeight; i++) {
- uint8 *s = src + _internDimU5;
- uint8 *d = dst + (_internDimDstX + _internDimX);
+ for (int i = 0; i < h; i++) {
+ uint8 *s = src + na;
+ uint8 *d = dst + (x2 + ix);
- for (int ii = 0; ii < _internBlockWidth; ii++) {
+ for (int ii = 0; ii < w; ii++) {
uint8 p = ovl[*s++];
if (p)
*d = p;
@@ -706,7 +685,7 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2,
}
if (!page2)
- addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
+ addDirtyRect(x2 + ix, y2 + iy, w, h);
}
void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl) {
@@ -714,26 +693,26 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x
return;
const ScreenDim *cdim = getScreenDim(dim);
- _internDimX = cdim->sx << 3;
- _internDimY = cdim->sy;
- _internDimW = cdim->w << 3;
- _internDimH = cdim->h;
+ int ix = cdim->sx << 3;
+ int iy = cdim->sy;
+ int iw = cdim->w << 3;
+ int ih = cdim->h;
- calcBoundariesIntern(x2, y2, w, h);
- if (_internBlockWidth == -1)
+ int na = 0, nb = 0, nc = w;
+ if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc))
return;
uint8 *src = getPagePtr(page1) + y1 * 320 + x1;
- uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320;
+ uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320;
- for (int i = 0; i < _internBlockHeight; i++) {
- uint8 *s = src + _internDimU5;
- uint8 *d = dst + (_internDimDstX + _internDimX);
+ for (int i = 0; i < h; i++) {
+ uint8 *s = src + na;
+ uint8 *d = dst + (x2 + ix);
if (flag)
d += (i >> 1);
- for (int ii = 0; ii < _internBlockWidth; ii++) {
+ for (int ii = 0; ii < w; ii++) {
if (*s++)
*d = ovl[*d];
d++;
@@ -744,7 +723,7 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x
}
if (!page2)
- addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
+ addDirtyRect(x2 + ix, y2 + iy, w, h);
}
void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const uint8 *ovl) {
@@ -778,59 +757,6 @@ void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const u
}
}
-void Screen_LoL::calcBoundariesIntern(int dstX, int dstY, int width, int height) {
- _internBlockWidth = _internBlockWidth2 = width;
- _internBlockHeight = height;
- _internDimDstX = dstX;
- _internDimDstY = dstY;
-
- _internDimU5 = _internDimU6 = _internDimU8 = 0;
-
- int t = _internDimDstX + _internBlockWidth;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internDimDstX) {
- _internDimU5 = _internBlockWidth - t;
- _internBlockWidth = t;
- _internDimDstX = 0;
- }
-
- t = _internDimW - _internDimDstX;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internBlockWidth)
- _internBlockWidth = t;
-
- _internBlockWidth2 -= _internBlockWidth;
-
- t = _internDimDstY + _internBlockHeight;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internDimDstY) {
- _internDimU6 = _internBlockHeight - t;
- _internBlockHeight = t;
- _internDimDstY = 0;
- }
-
- t = _internDimH - _internDimDstY;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internBlockHeight)
- _internBlockHeight = t;
-}
-
void Screen_LoL::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
Screen::fadeToBlack(delay, upFunc);
_fadeFlag = 2;
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index 2545064b58..f9cd7133de 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -112,22 +112,6 @@ private:
static const uint8 _paletteConvTable[256];
void mergeOverlay(int x, int y, int w, int h);
void postProcessCursor(uint8 *data, int width, int height, int pitch);
-
- // magic atlas
- void calcBoundariesIntern(int dstX, int dstY, int c, int d);
-
- int _internDimX;
- int _internDimY;
- int _internDimW;
- int _internDimH;
- int _internDimDstX;
- int _internBlockWidth;
- int _internDimDstY;
- int _internBlockHeight;
- int _internDimU5;
- int _internDimU6;
- int _internBlockWidth2;
- int _internDimU8;
};
} // end of namespace Kyra