aboutsummaryrefslogtreecommitdiff
path: root/saga/scene.cpp
diff options
context:
space:
mode:
authorAndrew Kurushin2005-01-04 16:10:43 +0000
committerAndrew Kurushin2005-01-04 16:10:43 +0000
commite733d05fefa929f131cd39aed4b1eb935dac40ef (patch)
tree36743fbcc72fa8625aa6ac271966a13471c4107b /saga/scene.cpp
parent6d966a6e17900a865b3617515638f55f67031c4f (diff)
downloadscummvm-rg350-e733d05fefa929f131cd39aed4b1eb935dac40ef.tar.gz
scummvm-rg350-e733d05fefa929f131cd39aed4b1eb935dac40ef.tar.bz2
scummvm-rg350-e733d05fefa929f131cd39aed4b1eb935dac40ef.zip
- added setup of followers position at start of scene
svn-id: r16423
Diffstat (limited to 'saga/scene.cpp')
-rw-r--r--saga/scene.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 68cfb0c24e..18b3e42a4b 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -46,6 +46,10 @@
namespace Saga {
+static int initSceneDoors[SCENE_DOORS_MAX] = {
+0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+};
+
Scene::Scene(SagaEngine *vm) : _vm(vm), _initialized(false) {
GAME_SCENEDESC gs_desc;
byte *scene_lut_p;
@@ -372,15 +376,25 @@ int Scene::getBGMaskType(const Point &testPoint) {
return (_bgMask.buf[offset] >> 4) & 0x0f;
}
+bool Scene::validBGMaskPoint(const Point &testPoint) {
+ if (!_bgMask.loaded) {
+ error("Scene::validBGMaskPoint _bgMask not loaded");
+ }
+
+ return !((testPoint.x < 0) || (testPoint.x >= _bgMask.w) ||
+ (testPoint.y < 0) || (testPoint.y >= _bgMask.h));
+}
+
bool Scene::canWalk(const Point &testPoint) {
int maskType;
+
if (!_bgMask.loaded) {
return true;
}
- if ((testPoint.x < 0) || (testPoint.x >= _bgMask.w) ||
- (testPoint.y < 0) || (testPoint.y >= _bgMask.h)) {
+ if (!validBGMaskPoint(testPoint)) {
return true;
- }
+ }
+
maskType = getBGMaskType(testPoint);
return getDoorState(maskType) == 0;
}
@@ -487,6 +501,10 @@ int Scene::getDoorState(int doorNumber) {
return _sceneDoors[doorNumber];
}
+void Scene::initDoorsState() {
+ memcpy(_sceneDoors, initSceneDoors, SCENE_DOORS_MAX);
+}
+
int Scene::getInfo(SCENE_INFO *si) {
assert(_initialized);
assert(si != NULL);