aboutsummaryrefslogtreecommitdiff
path: root/engines/access/amazon
diff options
context:
space:
mode:
authorStrangerke2014-11-24 01:35:24 +0100
committerPaul Gilbert2014-12-12 22:42:10 -0500
commitcc07c2e5a229381a5efe5d2aa092270b6dd0b75a (patch)
treec003eb4ee700e6e3327932fe7b91ac413761b35f /engines/access/amazon
parent74a15d659989f90140b8ff30ad4af4783802b758 (diff)
downloadscummvm-rg350-cc07c2e5a229381a5efe5d2aa092270b6dd0b75a.tar.gz
scummvm-rg350-cc07c2e5a229381a5efe5d2aa092270b6dd0b75a.tar.bz2
scummvm-rg350-cc07c2e5a229381a5efe5d2aa092270b6dd0b75a.zip
ACCESS: Implement two more RIVER related functions
Diffstat (limited to 'engines/access/amazon')
-rw-r--r--engines/access/amazon/amazon_game.h4
-rw-r--r--engines/access/amazon/amazon_resources.cpp14
-rw-r--r--engines/access/amazon/amazon_resources.h16
-rw-r--r--engines/access/amazon/amazon_scripts.cpp30
-rw-r--r--engines/access/amazon/amazon_scripts.h4
5 files changed, 41 insertions, 27 deletions
diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h
index 05caa21018..c646f513b1 100644
--- a/engines/access/amazon/amazon_game.h
+++ b/engines/access/amazon/amazon_game.h
@@ -103,8 +103,8 @@ public:
bool _charSegSwitch;
bool _skipStart;
- const RiverStruct *_topList;
- const RiverStruct *_botList;
+ RiverStruct *_topList;
+ RiverStruct *_botList;
int _canoeDir;
// Fields that are mapped to flags
diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp
index af631eae7e..23929ef4ba 100644
--- a/engines/access/amazon/amazon_resources.cpp
+++ b/engines/access/amazon/amazon_resources.cpp
@@ -1574,7 +1574,7 @@ const int DOWNRIVEROBJ[14][4] = {
{ 3, 700, 0, 20 }
};
-const RiverStruct RIVER0OBJECTS[45] = {
+RiverStruct RIVER0OBJECTS[45] = {
{16, 31, 6400, 0, 4, 12},
{16, 31, 6200, 0, 2, 12},
{17, 30, 6100, 0, 3, 15},
@@ -1622,9 +1622,9 @@ const RiverStruct RIVER0OBJECTS[45] = {
{17, 30, 305, 0, 2, 15}
};
-const RiverStruct ENDRIVER0[1] = {16, 31, 260, 0, 7, 12};
+RiverStruct ENDRIVER0[1] = {16, 31, 260, 0, 7, 12};
-const RiverStruct RIVER1OBJECTS[49] = {
+RiverStruct RIVER1OBJECTS[49] = {
{16, 31, 6920, 0, 1, 12},
{16, 31, 6740, 0, 4, 12},
{17, 30, 6699, 0, 1, 15},
@@ -1676,9 +1676,9 @@ const RiverStruct RIVER1OBJECTS[49] = {
{17, 30, 305, 0, 3, 15}
};
-const RiverStruct ENDRIVER1[1] = {16, 31, 260, 0, 1, 12};
+RiverStruct ENDRIVER1[1] = {16, 31, 260, 0, 1, 12};
-const RiverStruct RIVER2OBJECTS[53] = {
+RiverStruct RIVER2OBJECTS[53] = {
{16, 31, 8230, 0, 6, 12},
{16, 31, 8115, 0, 7, 12},
{17, 30, 7955, 0, 4, 15},
@@ -1734,9 +1734,9 @@ const RiverStruct RIVER2OBJECTS[53] = {
{17, 30, 305, 0, 3, 15}
};
-const RiverStruct ENDRIVER2[1] = {16, 31, 260, 0, 6, 12};
+RiverStruct ENDRIVER2[1] = {16, 31, 260, 0, 6, 12};
-const RiverStruct *RIVEROBJECTTBL[6] = {
+RiverStruct *RIVEROBJECTTBL[6] = {
RIVER0OBJECTS, ENDRIVER0, RIVER1OBJECTS,
ENDRIVER1, RIVER2OBJECTS, ENDRIVER2
};
diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h
index 02560ccac4..99ce40e965 100644
--- a/engines/access/amazon/amazon_resources.h
+++ b/engines/access/amazon/amazon_resources.h
@@ -101,14 +101,14 @@ extern const byte *MAPTBL[3];
extern const int DOWNRIVEROBJ[14][4];
-extern const RiverStruct RIVER0OBJECTS[45];
-extern const RiverStruct ENDRIVER0[1];
-extern const RiverStruct RIVER1OBJECTS[49];
-extern const RiverStruct ENDRIVER1[1];
-extern const RiverStruct RIVER2OBJECTS[53];
-extern const RiverStruct ENDRIVER2[1];
-
-extern const RiverStruct *RIVEROBJECTTBL[6];
+extern RiverStruct RIVER0OBJECTS[45];
+extern RiverStruct ENDRIVER0[1];
+extern RiverStruct RIVER1OBJECTS[49];
+extern RiverStruct ENDRIVER1[1];
+extern RiverStruct RIVER2OBJECTS[53];
+extern RiverStruct ENDRIVER2[1];
+
+extern RiverStruct *RIVEROBJECTTBL[6];
} // End of namespace Amazon
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp
index 4fc0a4ba91..3bd1148b64 100644
--- a/engines/access/amazon/amazon_scripts.cpp
+++ b/engines/access/amazon/amazon_scripts.cpp
@@ -1699,7 +1699,7 @@ void AmazonScripts::initRiver() {
_game->_riverIndex = _game->_riverFlag;
_game->_topList = RIVEROBJECTTBL[_game->_riverIndex];
UPDATEOBSTACLES();
- SETPHYSX();
+ riverSetPhysX();
_game->_canoeDir = 0;
_game->_deathFlag = 0;
_game->_deathCount = 0;
@@ -1715,8 +1715,16 @@ void AmazonScripts::initRiver() {
_game->_saveRiver = 0;
}
-void AmazonScripts::RESETPOSITIONS() {
- warning("TODO: RESETPOSITIONS");
+void AmazonScripts::resetPositions() {
+ riverSetPhysX();
+ int val = (_vm->_screen->_scrollCol + 1 - _game->_oldScrollCol) * 16;
+ if (val > 256) {
+ val &= 0x7F;
+ val |= 0x80;
+ }
+
+ for (int i = 0; i < _pNumObj; i++)
+ _pObjX[i] += val;
}
void AmazonScripts::CHECKRIVERPAN() {
@@ -1735,7 +1743,7 @@ bool AmazonScripts::riverJumpTest() {
_vm->_screen->_scrollCol = 139;
_vm->_screen->_scrollX = 14;
_vm->_room->buildScreen();
- RESETPOSITIONS();
+ resetPositions();
return false;
}
} else if (_vm->_screen->_scrollCol == 105) {
@@ -1758,7 +1766,7 @@ bool AmazonScripts::riverJumpTest() {
_vm->_screen->_scrollCol = 44;
_vm->_screen->_scrollX = 14;
_vm->_room->buildScreen();
- RESETPOSITIONS();
+ resetPositions();
return false;
}
}
@@ -1794,8 +1802,14 @@ void AmazonScripts::UPDATEOBSTACLES() {
warning("TODO: UPDATEOBSTACLES()");
}
-void AmazonScripts::SETPHYSX() {
- warning("TODO: SETPHYSX()");
+void AmazonScripts::riverSetPhysX() {
+ int val = (_vm->_screen->_scrollCol * 16) + _vm->_screen->_scrollX;
+ RiverStruct *si = _game->_topList;
+ RiverStruct *di = _game->_botList;
+ while (si <= di) {
+ si[0]._field5 = val - (_screenVertX - si[0]._field3);
+ si = &si[1];
+ }
}
void AmazonScripts::RIVERCOLLIDE() {
@@ -1842,7 +1856,7 @@ void AmazonScripts::RIVER() {
}
UPDATEOBSTACLES();
- SETPHYSX();
+ riverSetPhysX();
RIVERCOLLIDE();
if (_game->_hitSafe != 0)
_game->_hitSafe -= 2;
diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h
index 155afb8ac7..2b634ca89a 100644
--- a/engines/access/amazon/amazon_scripts.h
+++ b/engines/access/amazon/amazon_scripts.h
@@ -96,13 +96,13 @@ protected:
void doCast(int param1);
void loadBackground(int param1, int param2);
void initRiver();
- void RESETPOSITIONS();
+ void resetPositions();
void CHECKRIVERPAN();
bool riverJumpTest();
void riverSound();
void MOVECANOE();
void UPDATEOBSTACLES();
- void SETPHYSX();
+ void riverSetPhysX();
void RIVERCOLLIDE();
void SCROLLRIVER1();
void setRiverPan();