aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2013-07-06 10:34:12 -0400
committerPaul Gilbert2013-07-06 10:34:12 -0400
commit0154c85c6d251b8ad718b6bb9f62d82bc4720020 (patch)
treea4950b1400d22a3ea05774b3e17412be0fead719 /engines
parent29bc36d0708f228f18ed7a75bcadb72fed9fb55a (diff)
downloadscummvm-rg350-0154c85c6d251b8ad718b6bb9f62d82bc4720020.tar.gz
scummvm-rg350-0154c85c6d251b8ad718b6bb9f62d82bc4720020.tar.bz2
scummvm-rg350-0154c85c6d251b8ad718b6bb9f62d82bc4720020.zip
TSAGE: Fix for refreshing background and vertical sprite flipping in R2R scene 1200
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/core.cpp24
-rw-r--r--engines/tsage/core.h4
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp27
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h3
4 files changed, 41 insertions, 17 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 11063f985e..1f3745d085 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -3105,6 +3105,7 @@ Visage::Visage() {
_rlbNum = -1;
_data = NULL;
_flipHoriz = false;
+ _flipVert = false;
}
Visage::Visage(const Visage &v) {
@@ -3114,6 +3115,7 @@ Visage::Visage(const Visage &v) {
if (_data)
g_vm->_memoryManager.incLocks(_data);
_flipHoriz = false;
+ _flipVert = false;
}
Visage &Visage::operator=(const Visage &s) {
@@ -3157,6 +3159,7 @@ void Visage::setVisage(int resNum, int rlbNum) {
rlbNum = (int)(v & 0xff);
}
_flipHoriz = flags & 1;
+ _flipVert = flags & 2;
_data = g_resourceManager->getResource(RES_VISAGE, resNum, rlbNum);
@@ -3183,7 +3186,9 @@ GfxSurface Visage::getFrame(int frameNum) {
byte *frameData = _data + offset;
GfxSurface result = surfaceFromRes(frameData);
- if (_flipHoriz) flip(result);
+ if (_flipHoriz) flipHorizontal(result);
+ if (_flipVert) flipVertical(result);
+
return result;
}
@@ -3191,7 +3196,7 @@ int Visage::getFrameCount() const {
return READ_LE_UINT16(_data);
}
-void Visage::flip(GfxSurface &gfxSurface) {
+void Visage::flipHorizontal(GfxSurface &gfxSurface) {
Graphics::Surface s = gfxSurface.lockSurface();
for (int y = 0; y < s.h; ++y) {
@@ -3204,6 +3209,21 @@ void Visage::flip(GfxSurface &gfxSurface) {
gfxSurface.unlockSurface();
}
+void Visage::flipVertical(GfxSurface &gfxSurface) {
+ Graphics::Surface s = gfxSurface.lockSurface();
+
+ for (int y = 0; y < s.h / 2; ++y) {
+ // Flip the lines1
+ byte *line1P = (byte *)s.getBasePtr(0, y);
+ byte *line2P = (byte *)s.getBasePtr(0, s.h - y - 1);
+
+ for (int x = 0; x < s.w; ++x)
+ SWAP(line1P[x], line2P[x]);
+ }
+
+ gfxSurface.unlockSurface();
+}
+
/*--------------------------------------------------------------------------*/
Player::Player(): SceneObject() {
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 296754011e..655bd234e6 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -472,11 +472,13 @@ class Visage {
private:
byte *_data;
- void flip(GfxSurface &s);
+ void flipHorizontal(GfxSurface &s);
+ void flipVertical(GfxSurface &s);
public:
int _resNum;
int _rlbNum;
bool _flipHoriz;
+ bool _flipVert;
public:
Visage();
Visage(const Visage &v);
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 1f15d5565a..72000daa54 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -868,7 +868,8 @@ Scene1200::Scene1200() {
_field416 = 0;
_field418 = 0;
_field41A = 0;
- _field41C = 1; //CHECKME: Only if fixup_flag == 6??
+ _fixupMaze = false;
+ _drawMaze = true;
}
void Scene1200::synchronize(Serializer &s) {
@@ -879,7 +880,8 @@ void Scene1200::synchronize(Serializer &s) {
s.syncAsSint16LE(_field416);
s.syncAsSint16LE(_field418);
s.syncAsSint16LE(_field41A);
- s.syncAsSint16LE(_field41C);
+ s.syncAsSint16LE(_fixupMaze);
+ s.syncAsSint16LE(_drawMaze);
}
Scene1200::LaserPanel::LaserPanel() {
@@ -1035,6 +1037,7 @@ void Scene1200::LaserPanel::postInit(SceneObjectList *OwnerList) {
_jumper3.init(3);
R2_GLOBALS._player._canWalk = false;
+ scene->_drawMaze = false;
}
void Scene1200::LaserPanel::remove() {
@@ -1057,6 +1060,7 @@ void Scene1200::LaserPanel::remove() {
//
R2_GLOBALS._player._canWalk = true;
+ scene->_drawMaze = true;
}
void Scene1200::LaserPanel::process(Event &event) {
@@ -1067,19 +1071,16 @@ void Scene1200::LaserPanel::process(Event &event) {
if (_actor2._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) {
if (cursor == _cursorNum) {
- warning("TODO: _cursorState = ???");
- R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ R2_GLOBALS._events.setCursor(_savedCursorNum);
}
} else if (event.mousePos.y < 168) {
if (cursor != _cursorNum) {
_savedCursorNum = cursor;
- warning("TODO: _cursorState = ???");
R2_GLOBALS._events.setCursor(CURSOR_INVALID);
}
if (event.eventType == EVENT_BUTTON_DOWN) {
event.handled = true;
- warning("TODO: _cursorState = ???");
- R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ R2_GLOBALS._events.setCursor(_savedCursorNum);
remove();
}
}
@@ -1114,7 +1115,6 @@ void Scene1200::postInit(SceneObjectList *OwnerList) {
_field416 = 0;
_field418 = 0;
_field41A = 0;
- _field41C = 0;
if ((R2_GLOBALS._v56AA6 == 1) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1))
_field418 = 1;
@@ -1139,9 +1139,7 @@ void Scene1200::postInit(SceneObjectList *OwnerList) {
_mazeUI.load(1);
_mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4));
- warning("int unk = set_pane_p(_paneNumber);");
_mazeUI.draw();
- warning("set_pane_p(unk);");
R2_GLOBALS._player.enableControl();
_item1.setDetails(Rect(0, 0, 320, 200), 1200, 0, 1, 2, 1, NULL);
@@ -1550,15 +1548,18 @@ void Scene1200::process(Event &event) {
void Scene1200::dispatch() {
Rect tmpRect;
Scene::dispatch();
- if (_field41C != 0) {
+
+ if (_fixupMaze) {
_mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4));
_mazeUI.draw();
warning("_gfxManager.sub294AC(unk);");
warning("tmpRect.sub14DF3();");
- _field41C = 0;
+ _fixupMaze = false;
}
- _mazeUI.draw(); //**DEBUG**
+
+ if (_drawMaze)
+ _mazeUI.draw();
if (_field414 != 0) {
tmpRect.set(110, 20, 210, 120);
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index 3e75d83333..08fcd69d6f 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -157,7 +157,8 @@ public:
int _field416;
int _field418;
int _field41A;
- int _field41C;
+ bool _fixupMaze;
+ bool _drawMaze;
Scene1200();
void synchronize(Serializer &s);