aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukaslw2014-05-06 22:46:45 +0200
committerlukaslw2014-06-22 20:07:57 +0200
commitfff1ff5b1a4dc6d24d8592d73677e5a69471c1a0 (patch)
tree9aa514eeb3dc592b23adc334cbc1240cf3d798b4
parent583d6bdca10deb14578fa68bbee23e77c154d0f0 (diff)
downloadscummvm-rg350-fff1ff5b1a4dc6d24d8592d73677e5a69471c1a0.tar.gz
scummvm-rg350-fff1ff5b1a4dc6d24d8592d73677e5a69471c1a0.tar.bz2
scummvm-rg350-fff1ff5b1a4dc6d24d8592d73677e5a69471c1a0.zip
PRINCE: showHeroShadow update, line() implementation
-rw-r--r--engines/prince/hero.cpp126
-rw-r--r--engines/prince/hero.h1
-rw-r--r--engines/prince/prince.cpp2
-rw-r--r--engines/prince/prince.h1
4 files changed, 126 insertions, 4 deletions
diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp
index 177ee0c981..57743b7069 100644
--- a/engines/prince/hero.cpp
+++ b/engines/prince/hero.cpp
@@ -249,6 +249,79 @@ void Hero::countDrawPosition() {
}
}
+void Hero::line(int x1, int y1, int x2, int y2) {
+ //EAX - x1 <- LightX
+ //EBX - y1 <- LightY
+ //ECX - x2 <- DestX
+ //EDX - y2 <- DestY
+
+ //pushad
+ int dX = 1;
+ int vx = y2 - y1;
+ if(x2 <= x1) {
+ dX = -1;
+ vx = -1 * vx;
+ }
+ // pl_1
+ int lvx = vx;
+ int dY = 1;
+ int vy = x1 - x2;
+ if (y2 <= y1) {
+ dY = -1;
+ vy = -1 * vy;
+ }
+ // pl_2
+ int lvy = vy;
+ int lx = x1;
+ int ly = y1;
+ int lx2 = x2;
+ int ly2 = y2;
+ int lfa = 0;
+
+ //loop
+ //if (x1 != x2 && y1 != y2) {
+ while (lx != lx2 && ly != ly2) {
+ // not_end
+ // pushad
+ // LineCode() ?
+ // popad
+ int lfx = lfa + lvx;
+ int lfy = lfa + lvy;
+ int lfxy = lfx + lfy - lfa;
+ if (lfxy < 0) {
+ lfxy = -1 * lfxy;
+ }
+ //abs_fxy_done
+ if (lfx < 0) {
+ lfx = -1 * lfx;
+ }
+ //abs_fx_done
+ if (lfy < 0) {
+ lfy = -1 * lfy;
+ }
+ //abs_fy_done
+ if (lfx > lfy || lfx > lfxy) {
+ //c2
+ if (lfy >= lfx || lfy > lfxy) {
+ //c3
+ ly += dY;
+ lx += dX;
+ lfa = lfxy;
+ } else {
+ ly += dY;
+ lfa = lfa + lvy; // lfx / lfy = ?
+ }
+ } else {
+ lx += dX;
+ lfa = lfa + lvx; //9600 ???
+ // jump to @@next
+ }
+ //next
+ //
+ }
+
+}
+
Graphics::Surface *Hero::showHeroShadow(Graphics::Surface *heroFrame) {
int16 frameXSize = _moveSet[_moveSetType]->getFrameWidth(_phase);
int16 frameYSize = _moveSet[_moveSetType]->getFrameHeight(_phase);
@@ -272,7 +345,7 @@ Graphics::Surface *Hero::showHeroShadow(Graphics::Surface *heroFrame) {
return makeShadow;
// source Bitmap of sprite - esi
- //int destX = _drawX; // eax
+ int destX = _drawX; // eax
int destY = _middleY - _shadMinus; // ecx
// modulo of source Bitmap - ebp
//int scaledX = getScaledValue(frameXSize); // ebx
@@ -305,8 +378,55 @@ Graphics::Surface *Hero::showHeroShadow(Graphics::Surface *heroFrame) {
// sprModulo = modulo of source Bitmap
// sprWidth = scaledX
// sprHeight = scaledY
- //int sprDestX = destX - PicWindowX;
- //int sprDestY = destY - PicWindowY;
+ int sprDestX = destX - _vm->_picWindowX;
+ int sprDestY = destY - _vm->_picWindowY;
+
+ int shadPosX = sprDestX;
+ int shadMinX = sprDestX;
+ int shadMaxX = sprDestX;
+
+ int shadPosY = sprDestY;
+ int shadMinY = sprDestY;
+ int shadMaxY = sprDestY;
+ // destY * kMaxPicWidth / 8 + destX / 8
+ int shadBitAddr = _shadowBitmap->getZoom(destY * kMaxPicWidth / 8 + destX / 8);
+ int shadBitMask = 128 / (destX % 8);
+
+ int shadZoomY2 = _shadScaleValue;
+ int shadZoomY = _scaleValue;
+
+ // lockscreen etc
+
+ // banked2
+ // edx = linijka() + 8
+
+ // linear_loop
+ //for(int i = 0; i < ; i++) {
+ int ebx16795 = shadPosY;
+ int sprModulo = 0;
+ int shadSkipX = 0;
+ //retry_line:
+ for(int j = 0; j < shadPosY; j++) {
+ shadZoomY -= 100;
+ if(shadZoomY < 0 || _scaleValue != 10000) {
+ shadZoomY += _scaleValue;
+ // esi -= sprWidth
+ } else {
+ break; //to line_y_ok
+ }
+ // esp += 4*4
+ // koniec_bajki
+ }
+ //line_y_ok
+ int shadLastY = 0;
+ if (shadPosY < 0 || shadPosY == shadLastY || shadPosY >= 480 || shadPosX >= 640) {
+ shadLastY = shadPosY;
+ //skip_line
+
+ } else if (shadPosX < 0) {
+ shadSkipX = -1 * shadPosX;
+ }
+ //}
}
}
diff --git a/engines/prince/hero.h b/engines/prince/hero.h
index edc95e12ca..efa9027d4c 100644
--- a/engines/prince/hero.h
+++ b/engines/prince/hero.h
@@ -114,6 +114,7 @@ public:
void checkNak();
Graphics::Surface *zoomSprite(Graphics::Surface *heroFrame);
void showHeroAnimFrame();
+ void line(int x1, int y1, int x2, int y2);
Graphics::Surface *showHeroShadow(Graphics::Surface *heroFrame);
void setShadowScale(int32 shadowScale);
void specialAnim();
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index fc109b31ce..39183d35f1 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -78,7 +78,7 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc)
Engine(syst), _gameDescription(gameDesc), _graph(nullptr), _script(nullptr), _interpreter(nullptr), _flags(nullptr),
_locationNr(0), _debugger(nullptr), _midiPlayer(nullptr),
_cameraX(0), _newCameraX(0), _frameNr(0), _cursor1(nullptr), _cursor2(nullptr), _font(nullptr),
- _walizkaBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0) {
+ _walizkaBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0) {
// Debug/console setup
DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel");
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index 3dd372dd48..8213b2d32b 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -144,6 +144,7 @@ public:
uint16 _newCameraX;
uint16 _sceneWidth;
uint32 _picWindowX;
+ uint32 _picWindowY;
private:
bool playNextFrame();