diff options
Diffstat (limited to 'engines')
33 files changed, 349 insertions, 440 deletions
diff --git a/engines/neverhood/collisionman.cpp b/engines/neverhood/collisionman.cpp deleted file mode 100644 index bafa1e3e82..0000000000 --- a/engines/neverhood/collisionman.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "neverhood/collisionman.h" - -namespace Neverhood { - -static HitRect defaultHitRect = {NRect(), 0x5000}; - -CollisionMan::CollisionMan(NeverhoodEngine *vm) - : _vm(vm), _hitRects(NULL) { -} - -CollisionMan::~CollisionMan() { -} - -void CollisionMan::setHitRects(uint32 id) { - setHitRects(_vm->_staticData->getHitRectList(id)); -} - -void CollisionMan::setHitRects(HitRectList *hitRects) { - _hitRects = hitRects; -} - -void CollisionMan::clearHitRects() { - _hitRects = NULL; -} - -HitRect *CollisionMan::findHitRectAtPos(int16 x, int16 y) { - if (_hitRects) - for (HitRectList::iterator it = _hitRects->begin(); it != _hitRects->end(); it++) - if ((*it).rect.contains(x, y)) - return &(*it); - return &defaultHitRect; -} - -void CollisionMan::addCollisionSprite(Sprite *sprite) { - int index = 0, insertIndex = -1; - for (Common::Array<Sprite*>::iterator iter = _collisionSprites.begin(); iter != _collisionSprites.end(); iter++) { - if ((*iter)->getPriority() > sprite->getPriority()) { - insertIndex = index; - break; - } - index++; - } - if (insertIndex >= 0) - _collisionSprites.insert_at(insertIndex, sprite); - else - _collisionSprites.push_back(sprite); -} - -void CollisionMan::removeCollisionSprite(Sprite *sprite) { - for (uint index = 0; index < _collisionSprites.size(); index++) { - if (_collisionSprites[index] == sprite) { - _collisionSprites.remove_at(index); - break; - } - } -} - -void CollisionMan::clearCollisionSprites() { - _collisionSprites.clear(); -} - -void CollisionMan::checkCollision(Sprite *sprite, uint16 flags, int messageNum, uint32 messageParam) { - for (Common::Array<Sprite*>::iterator iter = _collisionSprites.begin(); iter != _collisionSprites.end(); iter++) { - Sprite *collSprite = *iter; - if ((sprite->getFlags() & flags) && collSprite->checkCollision(sprite->getCollisionBounds())) { - sprite->sendMessage(collSprite, messageNum, messageParam); - } - } -} - -} // End of namespace Neverhood diff --git a/engines/neverhood/collisionman.h b/engines/neverhood/collisionman.h deleted file mode 100644 index 36bb2a56ad..0000000000 --- a/engines/neverhood/collisionman.h +++ /dev/null @@ -1,55 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef NEVERHOOD_COLLISIONMAN_H -#define NEVERHOOD_COLLISIONMAN_H - -#include "neverhood/neverhood.h" -#include "neverhood/sprite.h" -#include "neverhood/staticdata.h" - -namespace Neverhood { - -class CollisionMan { -public: - CollisionMan(NeverhoodEngine *vm); - ~CollisionMan(); - void setHitRects(uint32 id); - void setHitRects(HitRectList *hitRects); - void clearHitRects(); - HitRect *findHitRectAtPos(int16 x, int16 y); - void addCollisionSprite(Sprite *sprite); - void removeCollisionSprite(Sprite *sprite); - void clearCollisionSprites(); - void checkCollision(Sprite *sprite, uint16 flags, int messageNum, uint32 messageParam); - uint getCollisionSpritesCount() const { return _collisionSprites.size(); } - Sprite *getCollisionSprite(uint index) const { return _collisionSprites[index]; } -protected: - NeverhoodEngine *_vm; - HitRectList *_hitRects; - Common::Array<Sprite*> _collisionSprites; -}; - - -} // End of namespace Neverhood - -#endif /* NEVERHOOD_COLLISIONMAN_H */ diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index fbef6006d5..907e027bc3 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -316,7 +316,7 @@ void DiskplayerSlot::stop() { } DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int paletteIndex) - : Scene(vm, parentModule, true), _diskIndex(0), _appearCountdown(0), _tuneInCountdown(0), + : Scene(vm, parentModule), _diskIndex(0), _appearCountdown(0), _tuneInCountdown(0), _hasAllDisks(false), _dropKey(false), _inputDisabled(true), _updateStatus(kUSStopped) { int availableDisksCount = 0; @@ -325,7 +325,7 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int setPalette(kDiskplayerPaletteFileHashes[paletteIndex]); _ssPlayButton = insertSprite<DiskplayerPlayButton>(this); - _vm->_collisionMan->addCollisionSprite(_ssPlayButton); + addCollisionSprite(_ssPlayButton); _asKey = insertSprite<AsDiskplayerSceneKey>(); diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 39d38c322a..0dfd29b75a 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -21,8 +21,8 @@ */ #include "neverhood/klayman.h" -#include "neverhood/collisionman.h" #include "neverhood/resourceman.h" +#include "neverhood/scene.h" #include "neverhood/staticdata.h" namespace Neverhood { @@ -60,7 +60,7 @@ static const KlaymanIdleTableItem klaymanIdleTable1002[] = { // Klayman -Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority, int objectPriority, NRectArray *clipRects) +Klayman::Klayman(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, int surfacePriority, int objectPriority, NRectArray *clipRects) : AnimatedSprite(vm, objectPriority), _idleCounterMax(0), _idleCounter(0), _isMoveObjectRequested(false), _blinkCounterMax(0), _isWalkingOpenDoorNotified(false), _countdown1(0), _tapesToInsert(0), _keysToInsert(0), /*_field118(0), */_status2(0), _acceptInput(true), _attachedSprite(NULL), _isWalking(false), _status3(1), _parentScene(parentScene), _isSneaking(false), _isLargeStep(false), @@ -744,12 +744,12 @@ void Klayman::suSneaking() { _deltaX = 0; if (_destX != _x) { - HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y); + HitRect *hitRectPrev = _parentScene->findHitRectAtPos(_x, _y); _x += xdiff; if (_pathPoints) { walkAlongPathPoints(); } else { - HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y); + HitRect *hitRectNext = _parentScene->findHitRectAtPos(_x, _y); if (hitRectNext->type == 0x5002) { _y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (hitRectNext->rect.x2 - _x) / 2); } else if (hitRectNext->type == 0x5003) { @@ -925,12 +925,12 @@ void Klayman::suWalkingTestExit() { (_status3 == 3 && xdiff < 150 && _currFrameIndex >= 6)) { sendMessage(this, 0x1019, 0); } else { - HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y); + HitRect *hitRectPrev = _parentScene->findHitRectAtPos(_x, _y); _x += xdelta; if (_pathPoints) { walkAlongPathPoints(); } else { - HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y); + HitRect *hitRectNext = _parentScene->findHitRectAtPos(_x, _y); if (hitRectNext->type == 0x5002) { _y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (hitRectNext->rect.x2 - _x) / 2); } else if (hitRectNext->type == 0x5003) { @@ -1408,12 +1408,12 @@ void Klayman::suLargeStep() { _deltaX = 0; if (_x != _destX) { - HitRect *hitRectPrev = _vm->_collisionMan->findHitRectAtPos(_x, _y); + HitRect *hitRectPrev = _parentScene->findHitRectAtPos(_x, _y); _x += xdiff; if (_pathPoints) { walkAlongPathPoints(); } else { - HitRect *hitRectNext = _vm->_collisionMan->findHitRectAtPos(_x, _y); + HitRect *hitRectNext = _parentScene->findHitRectAtPos(_x, _y); if (hitRectNext->type == 0x5002) { _y = MAX<int16>(hitRectNext->rect.y1, hitRectNext->rect.y2 - (hitRectNext->rect.x2 - _x) / 2); } else if (hitRectNext->type == 0x5003) { @@ -2868,13 +2868,13 @@ uint32 Klayman::hmJumpAndFall(int messageNum, const MessageParam ¶m, Entity void Klayman::suFallDown() { AnimatedSprite::updateDeltaXY(); - HitRect *hitRect = _vm->_collisionMan->findHitRectAtPos(_x, _y + 10); + HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10); if (hitRect->type == 0x5001) { _y = hitRect->rect.y1; updateBounds(); sendMessage(this, 0x1019, 0); } - _vm->_collisionMan->checkCollision(this, 0xFFFF, 0x4810, 0); + _parentScene->checkCollision(this, 0xFFFF, 0x4810, 0); } void Klayman::stJumpToRingVenusFlyTrap() { @@ -3028,7 +3028,7 @@ void Klayman::evMoveVenusFlyTrapDone() { void Klayman::suFallSkipJump() { updateDeltaXY(); - HitRect *hitRect = _vm->_collisionMan->findHitRectAtPos(_x, _y + 10); + HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10); if (hitRect->type == 0x5001) { _y = hitRect->rect.y1; updateBounds(); @@ -3348,7 +3348,7 @@ void Klayman::stPeekInsideBlink() { // KmScene1001 -KmScene1001::KmScene1001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1001::KmScene1001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { } @@ -3426,7 +3426,7 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1002 -KmScene1002::KmScene1002(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1002::KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { setKlaymanIdleTable1(); @@ -3548,7 +3548,7 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1004 -KmScene1004::KmScene1004(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1004::KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { _dataResource.load(0x01900A04); @@ -3614,7 +3614,7 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene1109::KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1109::KmScene1109(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -3682,7 +3682,7 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1201 -KmScene1201::KmScene1201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1201::KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { setKlaymanIdleTable(klaymanTable4, ARRAYSIZE(klaymanTable4)); @@ -3753,7 +3753,7 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene1303::KmScene1303(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1303::KmScene1303(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -3774,7 +3774,7 @@ uint32 KmScene1303::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene1304::KmScene1304(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1304::KmScene1304(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -3828,7 +3828,7 @@ uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene1305::KmScene1305(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1305::KmScene1305(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -3854,7 +3854,7 @@ uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene1306::KmScene1306(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1306::KmScene1306(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { } @@ -3980,7 +3980,7 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene1308::KmScene1308(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1308::KmScene1308(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -4056,7 +4056,7 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1401 -KmScene1401::KmScene1401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1401::KmScene1401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -4131,7 +4131,7 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1402 -KmScene1402::KmScene1402(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1402::KmScene1402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { SetFilterY(&Sprite::defFilterY); @@ -4176,7 +4176,7 @@ uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1403 -KmScene1403::KmScene1403(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1403::KmScene1403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { setKlaymanIdleTable(klaymanTable4, ARRAYSIZE(klaymanTable4)); @@ -4236,7 +4236,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1404 -KmScene1404::KmScene1404(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1404::KmScene1404(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -4314,7 +4314,7 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene1608::KmScene1608(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1608::KmScene1608(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { } @@ -4405,7 +4405,7 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { // KmScene1705 -KmScene1705::KmScene1705(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1705::KmScene1705(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -4498,7 +4498,7 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene1901::KmScene1901(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene1901::KmScene1901(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -4537,7 +4537,7 @@ uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2001::KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2001::KmScene2001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -4603,7 +4603,7 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2101::KmScene2101(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2101::KmScene2101(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty @@ -4689,7 +4689,7 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2201::KmScene2201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) +KmScene2201::KmScene2201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) : Klayman(vm, parentScene, x, y, 1000, 1000) { _surface->setClipRects(clipRects, clipRectsCount); @@ -4763,7 +4763,7 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2203::KmScene2203(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2203::KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -4835,7 +4835,7 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2205::KmScene2205(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2205::KmScene2205(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -4883,7 +4883,7 @@ uint32 KmScene2205::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2206::KmScene2206(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2206::KmScene2206(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { _walkResumeFrameIncr = 1; @@ -4989,7 +4989,7 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2207::KmScene2207(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2207::KmScene2207(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5053,7 +5053,7 @@ uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2242::KmScene2242(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2242::KmScene2242(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5123,7 +5123,7 @@ uint32 KmScene2242::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmHallOfRecords::KmHallOfRecords(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmHallOfRecords::KmHallOfRecords(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5177,7 +5177,7 @@ uint32 KmHallOfRecords::xHandleMessage(int messageNum, const MessageParam ¶m return 0; } -KmScene2247::KmScene2247(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2247::KmScene2247(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5231,7 +5231,7 @@ uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2401::KmScene2401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2401::KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5314,7 +5314,7 @@ uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2402::KmScene2402(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2402::KmScene2402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5386,7 +5386,7 @@ uint32 KmScene2402::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2403::KmScene2403(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2403::KmScene2403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5472,7 +5472,7 @@ uint32 KmScene2403::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2406::KmScene2406(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) +KmScene2406::KmScene2406(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) : Klayman(vm, parentScene, x, y, 1000, 1000) { _surface->setClipRects(clipRects, clipRectsCount); @@ -5565,7 +5565,7 @@ uint32 KmScene2406::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2501::KmScene2501(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2501::KmScene2501(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5616,7 +5616,7 @@ uint32 KmScene2501::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2732::KmScene2732(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2732::KmScene2732(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5633,7 +5633,7 @@ uint32 KmScene2732::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2801::KmScene2801(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2801::KmScene2801(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5705,7 +5705,7 @@ uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2803::KmScene2803(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) +KmScene2803::KmScene2803(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) : Klayman(vm, parentScene, x, y, 1000, 1000) { _surface->setClipRects(clipRects, clipRectsCount); @@ -5769,7 +5769,7 @@ uint32 KmScene2803::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2803Small::KmScene2803Small(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2803Small::KmScene2803Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { _dataResource.load(0x81120132); @@ -5822,7 +5822,7 @@ uint32 KmScene2803Small::xHandleMessage(int messageNum, const MessageParam ¶ return 0; } -KmScene2805::KmScene2805(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2805::KmScene2805(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -5879,7 +5879,7 @@ uint32 KmScene2805::xHandleMessage(int messageNum, const MessageParam ¶m) { return messageResult; } -KmScene2806::KmScene2806(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, +KmScene2806::KmScene2806(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, bool flag, NRect *clipRects, uint clipRectsCount) : Klayman(vm, parentScene, x, y, 1000, 1000) { @@ -5940,7 +5940,7 @@ uint32 KmScene2806::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2809::KmScene2809(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, +KmScene2809::KmScene2809(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, bool flag, NRect *clipRects, uint clipRectsCount) : Klayman(vm, parentScene, x, y, 1000, 1000) { @@ -6001,7 +6001,7 @@ uint32 KmScene2809::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2810Small::KmScene2810Small(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2810Small::KmScene2810Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } @@ -6051,7 +6051,7 @@ uint32 KmScene2810Small::xHandleMessage(int messageNum, const MessageParam ¶ return 0; } -KmScene2810::KmScene2810(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, uint clipRectsCount) +KmScene2810::KmScene2810(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, uint clipRectsCount) : Klayman(vm, parentScene, x, y, 1000, 1000) { _surface->setClipRects(clipRects, clipRectsCount); @@ -6146,7 +6146,7 @@ uint32 KmScene2810::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2812::KmScene2812(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) +KmScene2812::KmScene2812(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klayman(vm, parentScene, x, y, 1000, 1000) { // Empty } diff --git a/engines/neverhood/klayman.h b/engines/neverhood/klayman.h index 3b08108e3a..99fccebc0a 100644 --- a/engines/neverhood/klayman.h +++ b/engines/neverhood/klayman.h @@ -34,6 +34,7 @@ namespace Neverhood { // TODO Also the methods should probably rearranged and be grouped together more consistently class Klayman; +class Scene; const uint32 kKlaymanSpeedUpHash = 0x004A2148; @@ -48,7 +49,7 @@ struct KlaymanIdleTableItem { class Klayman : public AnimatedSprite { public: - Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int surfacePriority = 1000, int objectPriority = 1000, NRectArray *clipRects = NULL); + Klayman(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, int surfacePriority = 1000, int objectPriority = 1000, NRectArray *clipRects = NULL); void update(); @@ -385,7 +386,7 @@ public: void stWaitLeverDown(); protected: - Entity *_parentScene; + Scene *_parentScene; Sprite *_attachedSprite; int _ladderStatus; bool _isWalking; @@ -456,14 +457,14 @@ protected: class KmScene1001 : public Klayman { public: - KmScene1001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1002 : public Klayman { public: - KmScene1002(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: void xUpdate(); uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -471,140 +472,140 @@ protected: class KmScene1004 : public Klayman { public: - KmScene1004(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1109 : public Klayman { public: - KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1109(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1201 : public Klayman { public: - KmScene1201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1303 : public Klayman { public: - KmScene1303(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1303(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1304 : public Klayman { public: - KmScene1304(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1304(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1305 : public Klayman { public: - KmScene1305(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1305(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1306 : public Klayman { public: - KmScene1306(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1306(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1308 : public Klayman { public: - KmScene1308(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1308(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1401 : public Klayman { public: - KmScene1401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1402 : public Klayman { public: - KmScene1402(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1403 : public Klayman { public: - KmScene1403(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1404 : public Klayman { public: - KmScene1404(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1404(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1608 : public Klayman { public: - KmScene1608(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1608(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1705 : public Klayman { public: - KmScene1705(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1705(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene1901 : public Klayman { public: - KmScene1901(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene1901(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2001 : public Klayman { public: - KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2101 : public Klayman { public: - KmScene2101(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2101(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2201 : public Klayman { public: - KmScene2201(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); + KmScene2201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2203 : public Klayman { public: - KmScene2203(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2205 : public Klayman { public: - KmScene2205(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2205(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: void xUpdate(); uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -612,7 +613,7 @@ protected: class KmScene2206 : public Klayman { public: - KmScene2206(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2206(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); ~KmScene2206(); protected: void xUpdate(); @@ -621,14 +622,14 @@ protected: class KmScene2207 : public Klayman { public: - KmScene2207(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2207(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2242 : public Klayman { public: - KmScene2242(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2242(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: void xUpdate(); uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -636,7 +637,7 @@ protected: class KmHallOfRecords : public Klayman { public: - KmHallOfRecords(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmHallOfRecords(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: void xUpdate(); uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -644,7 +645,7 @@ protected: class KmScene2247 : public Klayman { public: - KmScene2247(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2247(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: void xUpdate(); uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -652,77 +653,77 @@ protected: class KmScene2401 : public Klayman { public: - KmScene2401(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2402 : public Klayman { public: - KmScene2402(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2403 : public Klayman { public: - KmScene2403(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2403(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2406 : public Klayman { public: - KmScene2406(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); + KmScene2406(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2501 : public Klayman { public: - KmScene2501(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2501(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2732 : public Klayman { public: - KmScene2732(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2732(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2801 : public Klayman { public: - KmScene2801(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2801(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2803 : public Klayman { public: - KmScene2803(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); + KmScene2803(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2803Small : public Klayman { public: - KmScene2803Small(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2803Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2805 : public Klayman { public: - KmScene2805(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2805(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2806 : public Klayman { public: - KmScene2806(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, + KmScene2806(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, bool flag, NRect *clipRects, uint clipRectsCount); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -730,7 +731,7 @@ protected: class KmScene2809 : public Klayman { public: - KmScene2809(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, + KmScene2809(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, bool flag, NRect *clipRects, uint clipRectsCount); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -738,14 +739,14 @@ protected: class KmScene2810Small : public Klayman { public: - KmScene2810Small(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2810Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; class KmScene2810 : public Klayman { public: - KmScene2810(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, + KmScene2810(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, uint clipRectsCount); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); @@ -753,7 +754,7 @@ protected: class KmScene2812 : public Klayman { public: - KmScene2812(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y); + KmScene2812(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 521c0e0c72..a1489fc78b 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -212,7 +212,7 @@ uint32 MenuButton::handleMessage(int messageNum, const MessageParam ¶m, Enti } MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { static const uint32 kMenuButtonFileHashes[] = { 0x36C62120, @@ -251,7 +251,7 @@ MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) for (uint buttonIndex = 0; buttonIndex < 9; ++buttonIndex) { Sprite *menuButton = insertSprite<MenuButton>(this, buttonIndex, kMenuButtonFileHashes[buttonIndex], kMenuButtonCollisionBounds[buttonIndex]); - _vm->_collisionMan->addCollisionSprite(menuButton); + addCollisionSprite(menuButton); } SetUpdateHandler(&Scene::update); @@ -298,7 +298,7 @@ static const uint32 kCreditsSceneFileHashes[] = { }; CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAbort) - : Scene(vm, parentModule, true), _canAbort(canAbort), _screenIndex(0), _ticksDuration(0), + : Scene(vm, parentModule), _canAbort(canAbort), _screenIndex(0), _ticksDuration(0), _countdown(216) { SetUpdateHandler(&CreditsScene::update); @@ -368,7 +368,7 @@ uint32 CreditsScene::handleMessage(int messageNum, const MessageParam ¶m, En } WidgetScene::WidgetScene(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _currWidget(NULL) { + : Scene(vm, parentModule), _currWidget(NULL) { } NPoint WidgetScene::getMousePos() { @@ -466,7 +466,7 @@ TextLabelWidget::TextLabelWidget(NeverhoodEngine *vm, int16 x, int16 y, int16 it void TextLabelWidget::addSprite() { _parentScene->addSprite(this); - _vm->_collisionMan->addCollisionSprite(this); + _parentScene->addCollisionSprite(this); } int16 TextLabelWidget::getWidth() { @@ -544,7 +544,7 @@ void TextEditWidget::addSprite() { createSurface(_baseSurfacePriority, _spriteResource.getDimensions().width, _spriteResource.getDimensions().height); refreshPosition(); _parentScene->addSprite(this); - _vm->_collisionMan->addCollisionSprite(this); + _parentScene->addCollisionSprite(this); _surface->setVisible(true); _textLabelWidget = new TextLabelWidget(_vm, _rect.x1, _rect.y1 + (_rect.y2 - _rect.y1 + 1 - _textSurface->getCharHeight()) / 2, 0, _parentScene, _baseObjectPriority + 1, _baseSurfacePriority + 1, @@ -708,7 +708,7 @@ void SavegameListBox::addSprite() { createSurface(_baseSurfacePriority, _spriteResource.getDimensions().width, _spriteResource.getDimensions().height); refreshPosition(); _parentScene->addSprite(this); - _vm->_collisionMan->addCollisionSprite(this); + _parentScene->addCollisionSprite(this); _surface->setVisible(true); buildItems(); _firstVisibleItem = 0; @@ -826,7 +826,7 @@ SaveGameMenu::SaveGameMenu(NeverhoodEngine *vm, Module *parentModule, StringArra for (uint buttonIndex = 0; buttonIndex < 6; ++buttonIndex) { Sprite *menuButton = insertSprite<MenuButton>(this, buttonIndex, kSaveGameMenuButtonFileHashes[buttonIndex], kSaveGameMenuButtonCollisionBounds[buttonIndex]); - _vm->_collisionMan->addCollisionSprite(menuButton); + addCollisionSprite(menuButton); } diff --git a/engines/neverhood/module.h b/engines/neverhood/module.h index 576a5a4b78..b91b9deff6 100644 --- a/engines/neverhood/module.h +++ b/engines/neverhood/module.h @@ -27,7 +27,6 @@ #include "neverhood/neverhood.h" #include "neverhood/background.h" -#include "neverhood/collisionman.h" #include "neverhood/entity.h" #include "neverhood/graphics.h" #include "neverhood/mouse.h" diff --git a/engines/neverhood/module.mk b/engines/neverhood/module.mk index b3deb6f339..d9486d9347 100644 --- a/engines/neverhood/module.mk +++ b/engines/neverhood/module.mk @@ -3,7 +3,6 @@ MODULE := engines/neverhood MODULE_OBJS = \ background.o \ blbarchive.o \ - collisionman.o \ detection.o \ diskplayerscene.o \ entity.o \ diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index 6c5cc28065..7033cafdc9 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -335,7 +335,7 @@ uint32 SsCommonButtonSprite::handleMessage(int messageNum, const MessageParam &p } Scene1001::Scene1001(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _asDoor(NULL), _asWindow(NULL) { + : Scene(vm, parentModule), _asDoor(NULL), _asWindow(NULL) { Sprite *tempSprite; @@ -1156,7 +1156,7 @@ uint32 AsScene1002KlaymanPeekHand::handleMessage(int messageNum, const MessagePa } Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isKlaymanFloor(false), _isClimbingLadder(false) { + : Scene(vm, parentModule), _isKlaymanFloor(false), _isClimbingLadder(false) { NRect tempClipRect; Sprite *tempSprite; @@ -1243,7 +1243,7 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) _asDoorSpy = insertSprite<AsScene1002DoorSpy>(tempClipRect, this, _asDoor, tempSprite); _ssPressButton = insertSprite<SsCommonPressButton>(this, 0x00412692, 0x140B60BE, 800, 0); _asVenusFlyTrap = insertSprite<AsScene1002VenusFlyTrap>(this, _klayman, false); - _vm->_collisionMan->addCollisionSprite(_asVenusFlyTrap); + addCollisionSprite(_asVenusFlyTrap); sendEntityMessage(_klayman, 0x2007, _asVenusFlyTrap); @@ -1389,7 +1389,7 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit // StaticScene StaticScene::StaticScene(NeverhoodEngine *vm, Module *parentModule, uint32 backgroundFileHash, uint32 cursorFileHash) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&StaticScene::handleMessage); @@ -1442,7 +1442,7 @@ uint32 AsScene1004TrashCan::handleMessage(int messageNum, const MessageParam &pa } Scene1004::Scene1004(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _paletteAreaStatus(-1) { + : Scene(vm, parentModule), _paletteAreaStatus(-1) { Sprite *tempSprite; @@ -1542,7 +1542,7 @@ void Scene1004::updatePaletteArea() { // Scene1005 Scene1005::Scene1005(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene1005::handleMessage); diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp index 4b8a8ba75f..c39845e44b 100644 --- a/engines/neverhood/module1100.cpp +++ b/engines/neverhood/module1100.cpp @@ -429,7 +429,7 @@ uint32 SsScene1105OpenButton::handleMessage(int messageNum, const MessageParam & } Scene1105::Scene1105(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _countdown(0), _isPanelOpen(false), _isActionButtonClicked(false), _doMoveTeddy(false), + : Scene(vm, parentModule), _countdown(0), _isPanelOpen(false), _isActionButtonClicked(false), _doMoveTeddy(false), _isClosePanelDone(false), _leaveResult(0), _backgroundIndex(0) { Sprite *ssOpenButton; @@ -444,7 +444,7 @@ Scene1105::Scene1105(NeverhoodEngine *vm, Module *parentModule) _asTeddyBear = insertSprite<AsScene1105TeddyBear>(this); ssOpenButton = insertSprite<SsScene1105OpenButton>(this); - _vm->_collisionMan->addCollisionSprite(ssOpenButton); + addCollisionSprite(ssOpenButton); insertPuzzleMouse(0x10006208, 20, 620); loadSound(0, 0x48442057); @@ -555,19 +555,19 @@ void Scene1105::createObjects() { _ssSymbolDice[2] = insertSprite<SsScene1105SymbolDie>(2, 485, 304); _ssSymbol1UpButton = insertSprite<SsScene1105Button>(this, 0x08002860, NRect(146, 362, 192, 403)); - _vm->_collisionMan->addCollisionSprite(_ssSymbol1UpButton); + addCollisionSprite(_ssSymbol1UpButton); _ssSymbol1DownButton = insertSprite<SsScene1105Button>(this, 0x42012460, NRect(147, 404, 191, 442)); - _vm->_collisionMan->addCollisionSprite(_ssSymbol1DownButton); + addCollisionSprite(_ssSymbol1DownButton); _ssSymbol2UpButton = insertSprite<SsScene1105Button>(this, 0x100030A0, NRect(308, 361, 355, 402)); - _vm->_collisionMan->addCollisionSprite(_ssSymbol2UpButton); + addCollisionSprite(_ssSymbol2UpButton); _ssSymbol2DownButton = insertSprite<SsScene1105Button>(this, 0x840228A0, NRect(306, 406, 352, 445)); - _vm->_collisionMan->addCollisionSprite(_ssSymbol2DownButton); + addCollisionSprite(_ssSymbol2DownButton); _ssSymbol3UpButton = insertSprite<SsScene1105Button>(this, 0x20000120, NRect(476, 358, 509, 394)); - _vm->_collisionMan->addCollisionSprite(_ssSymbol3UpButton); + addCollisionSprite(_ssSymbol3UpButton); _ssSymbol3DownButton = insertSprite<SsScene1105Button>(this, 0x08043121, NRect(463, 401, 508, 438)); - _vm->_collisionMan->addCollisionSprite(_ssSymbol3DownButton); + addCollisionSprite(_ssSymbol3DownButton); _ssActionButton = insertSprite<SsScene1105Button>(this, 0x8248AD35, NRect(280, 170, 354, 245)); - _vm->_collisionMan->addCollisionSprite(_ssActionButton); + addCollisionSprite(_ssActionButton); _isPanelOpen = true; @@ -646,7 +646,7 @@ void Scene1105::update() { } Scene1109::Scene1109(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, which) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene1109::handleMessage); diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index 11e29fda7a..844d07f771 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -653,7 +653,7 @@ void AsScene1201LeftDoor::stCloseDoor() { } Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _creatureExploded(false), _asMatch(NULL), _asTntMan(NULL), + : Scene(vm, parentModule), _creatureExploded(false), _asMatch(NULL), _asTntMan(NULL), _asCreature(NULL), _asTntManRope(NULL), _asLeftDoor(NULL), _asRightDoor(NULL), _asTape(NULL) { int16 topY1, topY2, topY3, topY4; @@ -674,7 +674,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) insertScreenMouse(0x9A2C0409); _asTape = insertSprite<AsScene1201Tape>(this, 3, 1100, 243, 340, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); tempSprite = insertStaticSprite(0x03C82530, 100); topY1 = tempSprite->getY() + tempSprite->getDrawRect().height; @@ -752,7 +752,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) _asTntMan = insertSprite<AsScene1201TntMan>(this, _asTntManRope, which == 1); _asTntMan->setClipRect(x1, 0, x2, 480); _asTntMan->setRepl(64, 0); - _vm->_collisionMan->addCollisionSprite(_asTntMan); + addCollisionSprite(_asTntMan); tempSprite = insertSprite<AsScene1201TntManFlame>(_asTntMan); tempSprite->setClipRect(x1, 0, x2, 480); } @@ -826,7 +826,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_MATCH_STATUS) < 3) { _asMatch = insertSprite<AsScene1201Match>(this); - _vm->_collisionMan->addCollisionSprite(_asMatch); + addCollisionSprite(_asMatch); } if (getGlobalVar(V_CREATURE_ANGRY) && getGlobalVar(V_CREATURE_EXPLODED) == 0) { @@ -998,7 +998,7 @@ void AsScene1202TntItem::stChangePositionDone() { } Scene1202::Scene1202(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _paletteResource(vm), + : Scene(vm, parentModule), _paletteResource(vm), _soundToggle(true), _isPuzzleSolved(false), _counter(0), _clickedIndex(-1) { SetMessageHandler(&Scene1202::handleMessage); @@ -1015,7 +1015,7 @@ Scene1202::Scene1202(NeverhoodEngine *vm, Module *parentModule) for (int tntIndex = 0; tntIndex < 18; tntIndex++) { _asTntItems[tntIndex] = insertSprite<AsScene1202TntItem>(this, tntIndex); - _vm->_collisionMan->addCollisionSprite(_asTntItems[tntIndex]); + addCollisionSprite(_asTntItems[tntIndex]); } insertStaticSprite(0x8E8419C1, 1100); diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index 989ada535d..a0a1167748 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -419,7 +419,7 @@ void SsScene1302Fence::suMoveUp() { } Scene1302::Scene1302(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene1302::handleMessage); @@ -456,7 +456,7 @@ Scene1302::Scene1302(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->setClipRect(0, 0, _sprite3->getDrawRect().x2(), 480); _asVenusFlyTrap = insertSprite<AsScene1002VenusFlyTrap>(this, _klayman, true); - _vm->_collisionMan->addCollisionSprite(_asVenusFlyTrap); + addCollisionSprite(_asVenusFlyTrap); sendEntityMessage(_klayman, 0x2007, _asVenusFlyTrap); @@ -630,7 +630,7 @@ void AsScene1303Balloon::stPopBalloon() { } Scene1303::Scene1303(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene1303::handleMessage); @@ -641,7 +641,7 @@ Scene1303::Scene1303(NeverhoodEngine *vm, Module *parentModule) if (!getGlobalVar(V_BALLOON_POPPED)) { _asBalloon = insertSprite<AsScene1303Balloon>(this); - _vm->_collisionMan->addCollisionSprite(_asBalloon); + addCollisionSprite(_asBalloon); } _sprite1 = insertStaticSprite(0xA014216B, 1100); @@ -692,7 +692,7 @@ uint32 AsScene1304Needle::handleMessage(int messageNum, const MessageParam ¶ } Scene1304::Scene1304(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _asNeedle(NULL) { + : Scene(vm, parentModule), _asNeedle(NULL) { SetMessageHandler(&Scene1304::handleMessage); @@ -703,14 +703,14 @@ Scene1304::Scene1304(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_BALLOON_POPPED)) { _asKey = insertSprite<AsCommonKey>(this, 0, 1100, 278, 347); - _vm->_collisionMan->addCollisionSprite(_asKey); + addCollisionSprite(_asKey); } else { _asKey = insertSprite<AnimatedSprite>(0x80106018, 100, 279, 48); } if (!getGlobalVar(V_HAS_NEEDLE)) { _asNeedle = insertSprite<AsScene1304Needle>(this, 1100, 278, 347); - _vm->_collisionMan->addCollisionSprite(_asNeedle); + addCollisionSprite(_asNeedle); } _sprite1 = insertStaticSprite(0x0562E621, 1100); @@ -756,7 +756,7 @@ uint32 Scene1304::handleMessage(int messageNum, const MessageParam ¶m, Entit } Scene1305::Scene1305(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene1305::handleMessage); @@ -867,7 +867,7 @@ void AsScene1306Elevator::cbGoingDownEvent() { } Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0) setGlobalVar(V_KEY3_LOCATION, 4); @@ -880,7 +880,7 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_KEY3_LOCATION) == 4) { _asKey = insertSprite<AsCommonKey>(this, 2, 1100, 435, 445); - _vm->_collisionMan->addCollisionSprite(_asKey); + addCollisionSprite(_asKey); } _ssButton = insertSprite<SsCommonButtonSprite>(this, 0x404A36A0, 100, 0x440C1000); @@ -897,14 +897,14 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) insertKlayman<KmScene1306>(380, 440); setMessageList(0x004AFAD0); sendMessage(this, 0x2000, 0); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else if (which == 1) { // Klaymen teleporting in insertKlayman<KmScene1306>(136, 440); sendMessage(_klayman, 0x2000, 1); setMessageList(0x004AFAF0); sendMessage(this, 0x2000, 1); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else if (which == 2) { // Klaymen returning from diskplayer if (getGlobalVar(V_KLAYMAN_IS_DELTA_X)) { @@ -915,27 +915,27 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) } setMessageList(0x004AFBC8); sendMessage(this, 0x2000, 0); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else if (which == 3) { // Klaymen returning from window insertKlayman<KmScene1306>(534, 440); setMessageList(0x004AFC30); sendMessage(this, 0x2000, 0); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else if (which == 4) { // Klaymen teleporting out insertKlayman<KmScene1306>(136, 440); sendMessage(_klayman, 0x2000, 1); setMessageList(0x004AFC38); sendMessage(this, 0x2000, 1); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else if (which == 5) { // Klaymen returning from teleporter insertKlayman<KmScene1306>(136, 440); sendMessage(_klayman, 0x2000, 1); setMessageList(0x004AFB00); sendMessage(this, 0x2000, 1); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else { // Klaymen coming up in elevator insertKlayman<KmScene1306>(286, 408); @@ -1007,7 +1007,7 @@ uint32 Scene1306::handleMessage(int messageNum, const MessageParam ¶m, Entit setSurfacePriority(_asElevatorDoor->getSurface(), 90); setSurfacePriority(_sprite1->getSurface(), 80); sendMessage(this, 0x2000, 0); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); break; } return 0; @@ -1033,7 +1033,7 @@ uint32 Scene1306::handleMessage416EB0(int messageNum, const MessageParam ¶m, setSurfacePriority(_asElevatorDoor->getSurface(), 90); setSurfacePriority(_sprite1->getSurface(), 80); sendMessage(this, 0x2000, 0); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); break; } return 0; @@ -1222,7 +1222,7 @@ void AsScene1307Key::stInsert() { } Scene1307::Scene1307(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _countdown(0), _asCurrKey(NULL), + : Scene(vm, parentModule), _countdown(0), _asCurrKey(NULL), _isInsertingKey(false), _doLeaveScene(false), _isPuzzleSolved(false) { Sprite *tempSprite; @@ -1260,7 +1260,7 @@ Scene1307::Scene1307(NeverhoodEngine *vm, Module *parentModule) for (uint keyIndex = 0; keyIndex < 3; keyIndex++) { if (getSubVar(VA_IS_KEY_INSERTED, keyIndex)) { _asKeys[keyIndex] = insertSprite<AsScene1307Key>(this, keyIndex, _clipRects); - _vm->_collisionMan->addCollisionSprite(_asKeys[keyIndex]); + addCollisionSprite(_asKeys[keyIndex]); } else { _asKeys[keyIndex] = NULL; } @@ -1519,7 +1519,7 @@ uint32 AsScene1308Mouse::handleMessage(int messageNum, const MessageParam ¶m } Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isProjecting(false), _asProjector(NULL) { + : Scene(vm, parentModule), _isProjecting(false), _asProjector(NULL) { _vm->gameModule()->initKeySlotsPuzzle(); @@ -1530,7 +1530,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) insertScreenMouse(0x24206418); _asTape = insertSprite<AsScene1201Tape>(this, 17, 1100, 502, 445, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); if (getGlobalVar(V_MOUSE_SUCKED_IN)) { insertSprite<AsScene1308Mouse>(); @@ -1603,7 +1603,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_PROJECTOR_LOCATION) == 4) { _asProjector = insertSprite<AsCommonProjector>(this, _klayman, (Sprite*)NULL); - _vm->_collisionMan->addCollisionSprite(_asProjector); + addCollisionSprite(_asProjector); _asProjector->setClipRect(0, 0, 640, _sprite2->getDrawRect().y2()); _asProjector->setRepl(64, 0); } @@ -1697,7 +1697,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit } Scene1317::Scene1317(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene1317::handleMessage); _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, 0x08982841, true, false)); diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index 521981e995..5febe8f08d 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -627,7 +627,7 @@ void AsCommonProjector::stStartSuckedIn() { } Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _projectorBorderFlag(false), _ssFloorButton(NULL), _asProjector(NULL), + : Scene(vm, parentModule), _projectorBorderFlag(false), _ssFloorButton(NULL), _asProjector(NULL), _asPipe(NULL), _asMouse(NULL), _asCheese(NULL), _asBackDoor(NULL), _sprite1(NULL), _sprite2(NULL), _sprite3(NULL), _ssButton(NULL) { @@ -678,7 +678,7 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_PROJECTOR_LOCATION) == 2) { _asProjector = insertSprite<AsCommonProjector>(this, _klayman, _asPipe); - _vm->_collisionMan->addCollisionSprite(_asProjector); + addCollisionSprite(_asProjector); if (getGlobalVar(V_PROJECTOR_SLOT) == 6) { sendEntityMessage(_klayman, 0x1014, _asProjector); _klayman->setX(_asProjector->getX() + 100); @@ -840,7 +840,7 @@ void AsScene1402PuzzleBox::stMoveDownSolvedDone() { } Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isShaking(false), _asPuzzleBox(NULL), _asProjector(NULL) { + : Scene(vm, parentModule), _isShaking(false), _asPuzzleBox(NULL), _asProjector(NULL) { SetMessageHandler(&Scene1402::handleMessage); @@ -898,7 +898,7 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_PROJECTOR_LOCATION) == 1) { _asProjector = insertSprite<AsCommonProjector>(this, _klayman, (Sprite*)NULL); - _vm->_collisionMan->addCollisionSprite(_asProjector); + addCollisionSprite(_asProjector); if (getGlobalVar(V_PROJECTOR_SLOT) == 4) { sendEntityMessage(_klayman, 0x1014, _asProjector); _klayman->setX(_asProjector->getX() + 100); @@ -1220,7 +1220,7 @@ void AsScene1407Mouse::stArriveAtHole() { } Scene1407::Scene1407(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _puzzleSolvedCountdown(0), _resetButtonCountdown(0) { + : Scene(vm, parentModule), _puzzleSolvedCountdown(0), _resetButtonCountdown(0) { SetMessageHandler(&Scene1407::handleMessage); SetUpdateHandler(&Scene1407::update); @@ -1278,7 +1278,7 @@ uint32 Scene1407::handleMessage(int messageNum, const MessageParam ¶m, Entit // Scene1403 Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _asProjector(NULL), _isProjecting(false) { + : Scene(vm, parentModule), _asProjector(NULL), _isProjecting(false) { SetMessageHandler(&Scene1403::handleMessage); @@ -1292,10 +1292,10 @@ Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) _sprite2 = insertStaticSprite(0x04442520, 995); _sprite3 = insertStaticSprite(0x08742271, 995); _asTape1 = insertSprite<AsScene1201Tape>(this, 12, 1100, 201, 468, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape1); + addCollisionSprite(_asTape1); _asTape1->setRepl(64, 0); _asTape2 = insertSprite<AsScene1201Tape>(this, 16, 1100, 498, 468, 0x9048A093); - _vm->_collisionMan->addCollisionSprite(_asTape2); + addCollisionSprite(_asTape2); _asTape2->setRepl(64, 0); if (which < 0) { @@ -1311,7 +1311,7 @@ Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_PROJECTOR_LOCATION) == 4) { _asProjector = insertSprite<AsCommonProjector>(this, _klayman, (Sprite*)NULL); - _vm->_collisionMan->addCollisionSprite(_asProjector); + addCollisionSprite(_asProjector); if (getGlobalVar(V_PROJECTOR_SLOT) == 4) { sendEntityMessage(_klayman, 0x1014, _asProjector); _klayman->setX(_asProjector->getX() + 100); @@ -1382,7 +1382,7 @@ uint32 Scene1403::handleMessage(int messageNum, const MessageParam ¶m, Entit // Scene1404 Scene1404::Scene1404(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _asProjector(NULL), _asKey(NULL) { + : Scene(vm, parentModule), _asProjector(NULL), _asKey(NULL) { if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0) setGlobalVar(V_KEY3_LOCATION, 5); @@ -1397,12 +1397,12 @@ Scene1404::Scene1404(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_KEY3_LOCATION) == 5) { _asKey = insertSprite<AsCommonKey>(this, 2, 1100, 267, 411); - _vm->_collisionMan->addCollisionSprite(_asKey); + addCollisionSprite(_asKey); } _sprite1 = insertStaticSprite(0x1900A1F8, 1100); _asTape = insertSprite<AsScene1201Tape>(this, 14, 1100, 281, 411, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); if (which < 0) { // Restoring game @@ -1429,7 +1429,7 @@ Scene1404::Scene1404(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_PROJECTOR_LOCATION) == 3) { _asProjector = insertSprite<AsCommonProjector>(this, _klayman, (Sprite*)NULL); - _vm->_collisionMan->addCollisionSprite(_asProjector); + addCollisionSprite(_asProjector); if (getGlobalVar(V_PROJECTOR_SLOT) == 0) { sendEntityMessage(_klayman, 0x1014, _asProjector); _klayman->setX(_asProjector->getX() - 100); @@ -1552,7 +1552,7 @@ void AsScene1405Tile::hide() { } Scene1405::Scene1405(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _selectFirstTile(true), _tilesLeft(48), _countdown(0) { + : Scene(vm, parentModule), _selectFirstTile(true), _tilesLeft(48), _countdown(0) { _vm->gameModule()->initMemoryPuzzle(); @@ -1565,7 +1565,7 @@ Scene1405::Scene1405(NeverhoodEngine *vm, Module *parentModule) for (uint32 tileIndex = 0; tileIndex < 48; tileIndex++) { _tiles[tileIndex] = insertSprite<AsScene1405Tile>(this, tileIndex); - _vm->_collisionMan->addCollisionSprite(_tiles[tileIndex]); + addCollisionSprite(_tiles[tileIndex]); if (getSubVar(VA_IS_TILE_MATCH, tileIndex)) _tilesLeft--; } diff --git a/engines/neverhood/module1500.cpp b/engines/neverhood/module1500.cpp index 328bda39a4..c49e968dca 100644 --- a/engines/neverhood/module1500.cpp +++ b/engines/neverhood/module1500.cpp @@ -82,7 +82,7 @@ void Module1500::updateScene() { // Scene1501 Scene1501::Scene1501(NeverhoodEngine *vm, Module *parentModule, uint32 backgroundFileHash, uint32 soundFileHash, int countdown2, int countdown3) - : Scene(vm, parentModule, true), _countdown3(countdown3), _countdown2(countdown2), _countdown1(0), _skip(false) { + : Scene(vm, parentModule), _countdown3(countdown3), _countdown2(countdown2), _countdown1(0), _skip(false) { SetUpdateHandler(&Scene1501::update); SetMessageHandler(&Scene1501::handleMessage); diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp index b40d580c4e..a2f06e1197 100644 --- a/engines/neverhood/module1600.cpp +++ b/engines/neverhood/module1600.cpp @@ -989,14 +989,14 @@ void AsCommonCarConnector::update() { } Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _asCar(NULL), _countdown1(0) { + : Scene(vm, parentModule), _asCar(NULL), _countdown1(0) { setGlobalVar(V_CAR_DELTA_X, 1); SetMessageHandler(&Scene1608::hmLowerFloor); _asKey = insertSprite<AsCommonKey>(this, 1, 1100, 198, 220); - _vm->_collisionMan->addCollisionSprite(_asKey); + addCollisionSprite(_asKey); if (which < 0) { // Restoring game @@ -1014,7 +1014,7 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(0x10080E01); setPalette(0x10080E01); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _klayman->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480); SetUpdateHandler(&Scene1608::upLowerFloor); insertScreenMouse(0x80E05108); @@ -1031,7 +1031,7 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(0x10080E01); setPalette(0x10080E01); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); insertScreenMouse(0x80E05108); _sprite1 = insertStaticSprite(0x7D0404E8, 1100); _klayman->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480); @@ -1072,7 +1072,7 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) _asIdleCarLower->setClipRect(_clipRect1); _asIdleCarFull->setClipRect(_clipRect1); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); insertSprite<AsCommonCarConnector>(_asCar)->setClipRect(_clipRect1); _klaymanInCar = false; _carClipFlag = false; @@ -1114,7 +1114,7 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) _asIdleCarLower->setClipRect(_clipRect1); _asIdleCarFull->setClipRect(_clipRect1); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); - // ... _vm->_collisionMan->addCollisionSprite(_asTape); + // ... addCollisionSprite(_asTape); insertSprite<AsCommonCarConnector>(_asCar)->setClipRect(_clipRect1); _klaymanInCar = true; _carClipFlag = true; @@ -1303,7 +1303,7 @@ void Scene1608::updateKlaymanCliprect() { } Scene1609::Scene1609(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _countdown1(1), _currentSymbolIndex(0), _symbolPosition(0), _changeCurrentSymbol(true), _isSolved(false) { + : Scene(vm, parentModule), _countdown1(1), _currentSymbolIndex(0), _symbolPosition(0), _changeCurrentSymbol(true), _isSolved(false) { _vm->gameModule()->initCodeSymbolsPuzzle(); _noisySymbolIndex = getGlobalVar(V_NOISY_SYMBOL_INDEX); @@ -1319,7 +1319,7 @@ Scene1609::Scene1609(NeverhoodEngine *vm, Module *parentModule) _asSymbols[symbolPosition] = insertSprite<AsScene3011Symbol>(symbolPosition, false); _ssButton = insertSprite<SsScene3011Button>(this, true); - _vm->_collisionMan->addCollisionSprite(_ssButton); + addCollisionSprite(_ssButton); loadSound(0, 0x68E25540); } diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index cf2fe63984..39bc49ba45 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -177,7 +177,7 @@ uint32 SsScene1705Tape::handleMessage(int messageNum, const MessageParam ¶m, } Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _paletteArea(1) { + : Scene(vm, parentModule), _paletteArea(1) { Sprite *tempSprite; @@ -200,7 +200,7 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) insertSprite<SsScene1705WallSymbol>(kScene1705FileHashes[getSubVar(VA_GOOD_CANNON_SYMBOLS_2, 2)], 2); _sprite = insertStaticSprite(0x31313A22, 1100); _ssTape = insertSprite<SsScene1705Tape>(this, 15, 1100, 238, 439, 0x02363852); - _vm->_collisionMan->addCollisionSprite(_ssTape); + addCollisionSprite(_ssTape); if (which < 0) { // Restoring game diff --git a/engines/neverhood/module1900.cpp b/engines/neverhood/module1900.cpp index 2557121c41..629cfd9b39 100644 --- a/engines/neverhood/module1900.cpp +++ b/engines/neverhood/module1900.cpp @@ -87,7 +87,7 @@ void Module1900::updateScene() { // Scene1901 Scene1901::Scene1901(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; @@ -358,8 +358,8 @@ void AsScene1907Symbol::stFallOffHitGround() { playSound(1); sendMessage(_parentScene, 0x1022, 1000 + _newPositionIndex); Entity::_priority = 1000 - _newPositionIndex; - _vm->_collisionMan->removeCollisionSprite(this); - _vm->_collisionMan->addCollisionSprite(this); + _parentScene->removeCollisionSprite(this); + _parentScene->addCollisionSprite(this); SetSpriteUpdate(&AsScene1907Symbol::suFallOffHitGround); NextState(&AsScene1907Symbol::cbFallOffHitGroundEvent); _newStickFrameIndex = 0; @@ -516,7 +516,7 @@ void AsScene1907WaterHint::hide() { } Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _currMovingSymbolIndex(0), _pluggedInCount(0), + : Scene(vm, parentModule), _currMovingSymbolIndex(0), _pluggedInCount(0), _moveDownCountdown(0), _moveUpCountdown(0), _countdown3(0), _hasPlugInFailed(false) { setBackground(0x20628E05); @@ -527,11 +527,11 @@ Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) for (int i = 0; i < 9; i++) { _asSymbols[i] = insertSprite<AsScene1907Symbol>(this, i, getRandomPositionIndex()); - _vm->_collisionMan->addCollisionSprite(_asSymbols[i]); + addCollisionSprite(_asSymbols[i]); } _ssUpDownButton = insertSprite<SsScene1907UpDownButton>(this, _asSymbols[8]); - _vm->_collisionMan->addCollisionSprite(_ssUpDownButton); + addCollisionSprite(_ssUpDownButton); _asWaterHint = insertSprite<AsScene1907WaterHint>(); diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp index 643bec4d49..f08b620030 100644 --- a/engines/neverhood/module2000.cpp +++ b/engines/neverhood/module2000.cpp @@ -95,7 +95,7 @@ void Module2000::updateScene() { // Scene2001 Scene2001::Scene2001(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; diff --git a/engines/neverhood/module2100.cpp b/engines/neverhood/module2100.cpp index 12b10b43e2..423f93c325 100644 --- a/engines/neverhood/module2100.cpp +++ b/engines/neverhood/module2100.cpp @@ -194,7 +194,7 @@ uint32 SsCommonFloorButton::handleMessage(int messageNum, const MessageParam &pa } Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; @@ -209,9 +209,9 @@ Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertStaticSprite(0x78492010, 1100); _ssFloorButton = insertSprite<SsCommonFloorButton>(this, 0x72427010, 0x32423010, 200, 0); _asTape1 = insertSprite<AsScene1201Tape>(this, 18, 1100, 412, 443, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape1); + addCollisionSprite(_asTape1); _asTape2 = insertSprite<AsScene1201Tape>(this, 11, 1100, 441, 443, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape2); + addCollisionSprite(_asTape2); if (which < 0) { insertKlayman<KmScene2101>(380, 438); diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index dc77a5ea08..889af37852 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -535,7 +535,7 @@ SsScene2201PuzzleCube::SsScene2201PuzzleCube(NeverhoodEngine *vm, uint32 positio } Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isSoundPlaying(false) { + : Scene(vm, parentModule), _isSoundPlaying(false) { Sprite *tempSprite; @@ -551,7 +551,7 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) insertScreenMouse(0x0820C408); _asTape = insertSprite<AsScene1201Tape>(this, 7, 1100, 459, 432, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _ssDoorButton = insertSprite<SsCommonPressButton>(this, 0xE4A43E29, 0xE4A43E29, 100, 0); for (uint32 cubeIndex = 0; cubeIndex < 9; cubeIndex++) @@ -870,7 +870,7 @@ void SsScene2202PuzzleCube::stopMoving() { } Scene2202::Scene2202(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isSolved(false), _leaveScene(false), _isCubeMoving(false), + : Scene(vm, parentModule), _isSolved(false), _leaveScene(false), _isCubeMoving(false), _ssMovingCube(NULL), _ssDoneMovingCube(NULL) { _vm->gameModule()->initCubeSymbolsPuzzle(); @@ -887,7 +887,7 @@ Scene2202::Scene2202(NeverhoodEngine *vm, Module *parentModule, int which) int16 cubeSymbol = (int16)getSubVar(VA_CUBE_POSITIONS, cubePosition); if (cubeSymbol >= 0) { Sprite *puzzleCubeSprite = insertSprite<SsScene2202PuzzleCube>(this, cubePosition, cubeSymbol); - _vm->_collisionMan->addCollisionSprite(puzzleCubeSprite); + addCollisionSprite(puzzleCubeSprite); } } @@ -1085,7 +1085,7 @@ void AsScene2203Door::closeDoor() { } Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0) setGlobalVar(V_KEY3_LOCATION, 1); @@ -1100,11 +1100,11 @@ Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_KEY3_LOCATION) == 1) { _asKey = insertSprite<AsCommonKey>(this, 2, 1100, 282, 432); - _vm->_collisionMan->addCollisionSprite(_asKey); + addCollisionSprite(_asKey); } _asTape = insertSprite<AsScene1201Tape>(this, 1, 1100, 435, 432, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _asLeftDoor = insertSprite<AsScene2203Door>(this, 0); _asRightDoor = insertSprite<AsScene2203Door>(this, 1); _ssSmallLeftDoor = insertStaticSprite(0x542CC072, 1100); @@ -1113,8 +1113,8 @@ Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) _rightDoorClipRect.set(0, 0, _ssSmallRightDoor->getDrawRect().x2(), 480); sendEntityMessage(_asLeftDoor, 0x2000, _asRightDoor); sendEntityMessage(_asRightDoor, 0x2000, _asLeftDoor); - _vm->_collisionMan->addCollisionSprite(_asLeftDoor); - _vm->_collisionMan->addCollisionSprite(_asRightDoor); + addCollisionSprite(_asLeftDoor); + addCollisionSprite(_asRightDoor); if (which < 0) { // Restoring game @@ -1215,7 +1215,7 @@ uint32 SsScene2205DoorFrame::handleMessage(int messageNum, const MessageParam &p } Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene2205::handleMessage); SetUpdateHandler(&Scene2205::update); @@ -1451,7 +1451,7 @@ uint32 SsScene2206TestTube::handleMessage(int messageNum, const MessageParam &pa } Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { uint32 fileHash; @@ -1491,7 +1491,7 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) _palette->addBasePalette(fileHash, 0, 256, 0); if (!getGlobalVar(V_LIGHTS_ON)) _palette->addPalette(0x0263D144, 0, 65, 0); - _vm->_collisionMan->addCollisionSprite(_ssTestTube); + addCollisionSprite(_ssTestTube); if (which < 0) { // Restoring game @@ -1926,7 +1926,7 @@ SsScene2207Symbol::SsScene2207Symbol(NeverhoodEngine *vm, uint32 fileHash, int i } Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true), _klaymanAtElevator(true), _elevatorSurfacePriority(0) { + : Scene(vm, parentModule), _klaymanAtElevator(true), _elevatorSurfacePriority(0) { _vm->gameModule()->initCannonSymbolsPuzzle(); @@ -1949,9 +1949,9 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule) _ssMaskPart2 = insertStaticSprite(0x688F62A5, 1100); _ssMaskPart3 = insertStaticSprite(0x0043B038, 1100); _asTape = insertSprite<AsScene1201Tape>(this, 4, 1100, 277, 428, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _asLever = insertSprite<AsScene2207Lever>(this, 527, 333, 0); - _vm->_collisionMan->addCollisionSprite(_asLever); + addCollisionSprite(_asLever); _asWallRobotAnimation = insertSprite<AsScene2207WallRobotAnimation>(this); _asWallCannonAnimation = insertSprite<AsScene2207WallCannonAnimation>(); _asWallRobotAnimation->setVisible(false); @@ -2110,7 +2110,7 @@ static const uint32 kScene2208FileHashes2[] = { }; Scene2208::Scene2208(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _textResource(vm) { + : Scene(vm, parentModule), _textResource(vm) { SpriteResource spriteResource(_vm); const char *textStart, *textEnd; @@ -2288,7 +2288,7 @@ static const uint32 kScene2242MessageListIds1[] = { }; Scene2242::Scene2242(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isKlaymanInLight(false) { + : Scene(vm, parentModule), _isKlaymanInLight(false) { SetMessageHandler(&Scene2242::handleMessage); SetUpdateHandler(&Scene2242::update); @@ -2309,7 +2309,7 @@ Scene2242::Scene2242(NeverhoodEngine *vm, Module *parentModule, int which) } _asTape = insertSprite<AsScene1201Tape>(this, 10, 1100, 464, 435, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); if (which < 0) { // Restoring game @@ -2407,7 +2407,7 @@ static const uint32 kHallOfRecordsSceneMessageListIds1[] = { }; HallOfRecordsScene::HallOfRecordsScene(NeverhoodEngine *vm, Module *parentModule, int which, uint32 hallOfRecordsInfoId) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { _hallOfRecordsInfo = _vm->_staticData->getHallOfRecordsInfoItem(hallOfRecordsInfoId); @@ -2498,7 +2498,7 @@ static const uint32 kScene2247MessageListIds1[] = { }; Scene2247::Scene2247(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene2247::handleMessage); SetUpdateHandler(&Scene::update); diff --git a/engines/neverhood/module2400.cpp b/engines/neverhood/module2400.cpp index ed9e23155d..6c007c47d6 100644 --- a/engines/neverhood/module2400.cpp +++ b/engines/neverhood/module2400.cpp @@ -368,7 +368,7 @@ void AsScene2401Door::stDoorOpenFinished() { } Scene2401::Scene2401(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _countdown1(0), _countdown2(0), _unkFlag(false), + : Scene(vm, parentModule), _countdown1(0), _countdown2(0), _unkFlag(false), _soundToggle(false), _asWaterSpitIndex(0) { _vm->gameModule()->initWaterPipesPuzzle(); @@ -684,7 +684,7 @@ uint32 AsScene2402TV::hmJoke(int messageNum, const MessageParam ¶m, Entity * } Scene2402::Scene2402(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _countdown(0), _soundToggle(false) { + : Scene(vm, parentModule), _countdown(0), _soundToggle(false) { Sprite *tempSprite; @@ -696,7 +696,7 @@ Scene2402::Scene2402(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x81660220); insertScreenMouse(0x6022481E); _asTape = insertSprite<AsScene1201Tape>(this, 9, 1100, 286, 409, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _ssButton = insertSprite<SsCommonButtonSprite>(this, 0x15288120, 100, 0); if (which < 0) { @@ -786,7 +786,7 @@ void Scene2402::playPipeSound(uint32 fileHash) { } Scene2403::Scene2403(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite1, *tempSprite2, *tempSprite3; @@ -796,7 +796,7 @@ Scene2403::Scene2403(NeverhoodEngine *vm, Module *parentModule, int which) _palette->addPalette(0x414364B0, 0, 65, 0); insertScreenMouse(0x506080C8); _asTape = insertSprite<AsScene1201Tape>(this, 2, 1100, 480, 454, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _asLightCord = insertSprite<AsScene2803LightCord>(this, 0xA1095A10, 0x836D3813, 368, 200); _asLightCord->setClipRect(0, 25, 640, 480); @@ -879,7 +879,7 @@ uint32 Scene2403::handleMessage(int messageNum, const MessageParam ¶m, Entit } Scene2406::Scene2406(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite1, *tempSprite2; @@ -893,11 +893,11 @@ Scene2406::Scene2406(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_KEY3_LOCATION) == 2) { _asKey = insertSprite<AsCommonKey>(this, 2, 1100, 560, 409); - _vm->_collisionMan->addCollisionSprite(_asKey); + addCollisionSprite(_asKey); } _asTape = insertSprite<AsScene1201Tape>(this, 5, 1100, 456, 409, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); tempSprite2 = insertStaticSprite(0x19625293, 1100); _clipRects[0].x1 = 0; _clipRects[0].y1 = 0; diff --git a/engines/neverhood/module2500.cpp b/engines/neverhood/module2500.cpp index 3fc508a4a6..4aefbfb8a9 100644 --- a/engines/neverhood/module2500.cpp +++ b/engines/neverhood/module2500.cpp @@ -220,7 +220,7 @@ void Module2500::createScene2704(int which, uint32 sceneInfoId, int16 value, con } Scene2501::Scene2501(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { _sceneInfos[0] = _vm->_staticData->getSceneInfo2700(0x004B2628); _sceneInfos[1] = _vm->_staticData->getSceneInfo2700(0x004B264C); @@ -535,14 +535,14 @@ uint32 SsScene2504Button::handleMessage(int messageNum, const MessageParam ¶ } Scene2504::Scene2504(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *ssButton; setBackground(0x90791B80); setPalette(0x90791B80); ssButton = insertSprite<SsScene2504Button>(); - _vm->_collisionMan->addCollisionSprite(ssButton); + addCollisionSprite(ssButton); insertPuzzleMouse(0x91B8490F, 20, 620); SetMessageHandler(&Scene2504::handleMessage); SetUpdateHandler(&Scene::update); diff --git a/engines/neverhood/module2600.cpp b/engines/neverhood/module2600.cpp index 91132c030a..04a91475a1 100644 --- a/engines/neverhood/module2600.cpp +++ b/engines/neverhood/module2600.cpp @@ -308,7 +308,7 @@ uint32 AsScene2609Water::handleMessage(int messageNum, const MessageParam ¶m } Scene2609::Scene2609(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isBusy(false) { + : Scene(vm, parentModule), _isBusy(false) { SetUpdateHandler(&Scene::update); SetMessageHandler(&Scene2609::handleMessage); @@ -317,7 +317,7 @@ Scene2609::Scene2609(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x51409A16); _asWater = insertSprite<AsScene2609Water>(); _ssButton = insertSprite<SsScene2609Button>(this); - _vm->_collisionMan->addCollisionSprite(_ssButton); + addCollisionSprite(_ssButton); insertPuzzleMouse(0x09A1251C, 20, 620); insertStaticSprite(0x02138002, 1200); insertStaticSprite(0x825E2827, 1200); diff --git a/engines/neverhood/module2700.cpp b/engines/neverhood/module2700.cpp index b22da94048..d4f46ea2ca 100644 --- a/engines/neverhood/module2700.cpp +++ b/engines/neverhood/module2700.cpp @@ -614,7 +614,7 @@ void AsCommonCarTrackShadow::update() { } Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; @@ -720,7 +720,7 @@ static const uint32 kScene2702Infos[2][3] = { Scene2702::Scene2702(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _isInLight(true), _newTrackIndex(-1), _count(3) { + : Scene(vm, parentModule), _isInLight(true), _newTrackIndex(-1), _count(3) { for (int i = 0; i < 2; i++) for (int j = 0; j < 3; j++) @@ -882,7 +882,7 @@ void Scene2702::changeTrack() { } Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint32 sceneInfoId) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SceneInfo2700 *sceneInfo = _vm->_staticData->getSceneInfo2700(sceneInfoId); @@ -996,7 +996,7 @@ uint32 Scene2703::handleMessage(int messageNum, const MessageParam ¶m, Entit Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint32 sceneInfoId, int16 value, const uint32 *staticSprites, const NRect *clipRect) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SceneInfo2700 *sceneInfo = _vm->_staticData->getSceneInfo2700(sceneInfoId); @@ -1101,7 +1101,7 @@ static const struct { const char *pointListName; int which1, which2; } kSceneInf }; Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _newTrackIndex(-1) { + : Scene(vm, parentModule), _newTrackIndex(-1) { SetMessageHandler(&Scene2706::handleMessage); @@ -1218,7 +1218,7 @@ void Scene2706::changeTrack() { } Scene2732::Scene2732(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index 25360ac9d5..7c7c097696 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -426,7 +426,7 @@ void Module2800::updateMusic(bool halfVolume) { } Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *_sprite1; Sprite *_sprite2; @@ -470,7 +470,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->setClipRect(_sprite1->getDrawRect().x, 0, _sprite2->getDrawRect().x2(), 480); insertScreenMouse(0x0066201C); _asTape = insertSprite<AsScene1201Tape>(this, 8, 1100, 302, 437, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else if (getGlobalVar(V_RADIO_ROOM_RIGHT_DOOR)) { setRectList(0x004B6CD0); setBackground(0x11E00684); @@ -481,7 +481,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->setClipRect(0, 0, _sprite2->getDrawRect().x2(), 480); insertScreenMouse(0x00680116); _asTape = insertSprite<SsScene1705Tape>(this, 8, 1100, 302, 437, 0x01142428); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else { setRectList(0x004B6CF0); setBackground(0x030006E6); @@ -492,7 +492,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) _klayman->setClipRect(0, 0, _sprite2->getDrawRect().x2(), 480); insertScreenMouse(0x006E2038); _asTape = insertSprite<AsScene1201Tape>(this, 8, 1100, 302, 437, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } addEntity(_palette); @@ -533,7 +533,7 @@ uint32 Scene2801::handleMessage(int messageNum, const MessageParam ¶m, Entit } Scene2802::Scene2802(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _currTuneStatus(0), _countdown1(0), _countdown2(0) { + : Scene(vm, parentModule), _currTuneStatus(0), _countdown1(0), _countdown2(0) { SetMessageHandler(&Scene2802::handleMessage); SetUpdateHandler(&Scene2802::update); @@ -841,7 +841,7 @@ void AsScene2803Rope::stHide() { } Scene2803::Scene2803(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _paletteArea(0) { + : Scene(vm, parentModule), _paletteArea(0) { static const uint32 kScene2803FileHashes1[] = { 0, @@ -1108,7 +1108,7 @@ void Scene2803::updatePaletteArea() { } Scene2803Small::Scene2803Small(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _paletteArea(0) { + : Scene(vm, parentModule), _paletteArea(0) { static const uint32 kScene2803SmallFileHashes1[] = { 0, 0x081000F1, 0x08100171, 0x08100271 @@ -1731,7 +1731,7 @@ uint32 AsScene2804BeamTarget::handleMessage(int messageNum, const MessageParam & } Scene2804::Scene2804(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _countdown1(0), _countdown2(0), _countdown3(0), + : Scene(vm, parentModule), _countdown1(0), _countdown2(0), _countdown3(0), _beamStatus(0), _isSolved(false), _isWorking(false) { initCrystalColors(); @@ -1759,7 +1759,7 @@ Scene2804::Scene2804(NeverhoodEngine *vm, Module *parentModule, int which) } _ssRedButton = insertSprite<SsScene2804RedButton>(this); - _vm->_collisionMan->addCollisionSprite(_ssRedButton); + addCollisionSprite(_ssRedButton); for (uint crystalIndex = 0; crystalIndex < 5; crystalIndex++) { AsScene2804CrystalWaves *asCrystalWaves = NULL; @@ -1767,7 +1767,7 @@ Scene2804::Scene2804(NeverhoodEngine *vm, Module *parentModule, int which) asCrystalWaves = insertSprite<AsScene2804CrystalWaves>(crystalIndex); _asCrystals[crystalIndex] = insertSprite<AsScene2804Crystal>(asCrystalWaves, crystalIndex); _ssCrystalButtons[crystalIndex] = insertSprite<SsScene2804CrystalButton>(this, _asCrystals[crystalIndex], crystalIndex); - _vm->_collisionMan->addCollisionSprite(_ssCrystalButtons[crystalIndex]); + addCollisionSprite(_ssCrystalButtons[crystalIndex]); } } @@ -1882,7 +1882,7 @@ void Scene2804::initCrystalColors() { } Scene2805::Scene2805(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene2805::handleMessage); @@ -1968,7 +1968,7 @@ uint32 AsScene2806Spew::handleMessage(int messageNum, const MessageParam ¶m, } Scene2806::Scene2806(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; @@ -2089,7 +2089,7 @@ void Scene2806::findClosestPoint() { } Scene2807::Scene2807(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { SetMessageHandler(&Scene2807::handleMessage); @@ -2422,7 +2422,7 @@ void AsScene2808LightEffect::update() { } Scene2808::Scene2808(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _countdown(0), _testTubeSetNum(which), _leaveResult(0), _isFlowing(false) { + : Scene(vm, parentModule), _countdown(0), _testTubeSetNum(which), _leaveResult(0), _isFlowing(false) { Sprite *asHandle; @@ -2438,16 +2438,16 @@ Scene2808::Scene2808(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(kScene2808FileHashes1[which]); asHandle = insertSprite<AsScene2808Handle>(this, which); - _vm->_collisionMan->addCollisionSprite(asHandle); + addCollisionSprite(asHandle); _asFlow = insertSprite<AsScene2808Flow>(this, which); insertSprite<AsScene2808LightEffect>(which); for (int testTubeIndex = 0; testTubeIndex < 3; testTubeIndex++) { SsScene2808Dispenser *ssDispenser = insertSprite<SsScene2808Dispenser>(this, which, testTubeIndex); - _vm->_collisionMan->addCollisionSprite(ssDispenser); + addCollisionSprite(ssDispenser); _asTestTubes[testTubeIndex] = insertSprite<AsScene2808TestTube>(which, testTubeIndex, ssDispenser); - _vm->_collisionMan->addCollisionSprite(_asTestTubes[testTubeIndex]); + addCollisionSprite(_asTestTubes[testTubeIndex]); } insertScreenMouse(kScene2808FileHashes2[which]); @@ -2556,7 +2556,7 @@ uint32 AsScene2809Spew::handleMessage(int messageNum, const MessageParam ¶m, } Scene2809::Scene2809(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; @@ -2703,7 +2703,7 @@ uint32 AsScene2810Rope::handleMessage(int messageNum, const MessageParam ¶m, } Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true) { + : Scene(vm, parentModule) { Sprite *tempSprite; @@ -2727,10 +2727,10 @@ Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_KLAYMAN_SMALL)) { _asTape = insertSprite<AsScene1201Tape>(this, 0, 900, 245, 429, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else { _asTape = insertSprite<AsScene1201Tape>(this, 0, 1100, 245, 429, 0x9148A011); - _vm->_collisionMan->addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } _sprite1 = insertStaticSprite(0x430001C4, 1200); @@ -2752,7 +2752,7 @@ Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004AE438); setRectList(0x004AE810); _isRopingDown = false; - _vm->_collisionMan->removeCollisionSprite(_asTape); + removeCollisionSprite(_asTape); } else { insertKlayman<KmScene2810>(300, 424, _clipRects, 2); setMessageList(0x004AE438); @@ -2796,7 +2796,7 @@ Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004AE6D8); setRectList(0x004AE810); _isRopingDown = false; - _vm->_collisionMan->removeCollisionSprite(_asTape); + removeCollisionSprite(_asTape); } else { insertKlaymanLadder(); if (getGlobalVar(V_LADDER_DOWN_ACTION)) { @@ -2819,7 +2819,7 @@ Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004AE428); setRectList(0x004AE810); _isRopingDown = false; - _vm->_collisionMan->removeCollisionSprite(_asTape); + removeCollisionSprite(_asTape); } else { insertKlayman<KmScene2810>(450, 424, _clipRects, 2); setMessageList(0x004AE418); @@ -2838,7 +2838,7 @@ Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004AE410); setRectList(0x004AE810); _isRopingDown = false; - _vm->_collisionMan->removeCollisionSprite(_asTape); + removeCollisionSprite(_asTape); } } @@ -3019,7 +3019,7 @@ uint32 AsScene2812TrapDoor::handleMessage(int messageNum, const MessageParam &pa } Scene2812::Scene2812(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _paletteArea(0) { + : Scene(vm, parentModule), _paletteArea(0) { if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0) setGlobalVar(V_KEY3_LOCATION, 3); @@ -3039,11 +3039,11 @@ Scene2812::Scene2812(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(V_KEY3_LOCATION) == 3) { _asKey = insertSprite<AsCommonKey>(this, 2, 1100, 474, 437); - _vm->_collisionMan->addCollisionSprite(_asKey); + addCollisionSprite(_asKey); } _ssTape = insertSprite<SsScene1705Tape>(this, 6, 1100, 513, 437, 0xA1361863); - _vm->_collisionMan->addCollisionSprite(_ssTape); + addCollisionSprite(_ssTape); _asWinch = insertSprite<AsScene2812Winch>(); _asTrapDoor = insertSprite<AsScene2812TrapDoor>(); @@ -3173,7 +3173,7 @@ void Scene2812::updatePaletteArea(bool instantly) { } Scene2822::Scene2822(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _countdown(0), _scrollIndex(0) { + : Scene(vm, parentModule), _countdown(0), _scrollIndex(0) { SetMessageHandler(&Scene2822::handleMessage); SetUpdateHandler(&Scene2822::update); diff --git a/engines/neverhood/module2900.cpp b/engines/neverhood/module2900.cpp index 551d6cbce7..b5a6ab2c88 100644 --- a/engines/neverhood/module2900.cpp +++ b/engines/neverhood/module2900.cpp @@ -347,7 +347,7 @@ uint32 SsScene2901BigButton::handleMessage(int messageNum, const MessageParam &p } Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _currLocationButtonNum(which), _selectedButtonNum(which), + : Scene(vm, parentModule), _currLocationButtonNum(which), _selectedButtonNum(which), _currWhirlButtonNum(0), _prevWhirlButtonNum(0), _countdown1(1), _skipCountdown(0), _blinkOn(0) { _isButton2Broken = getGlobalVar(V_ENTRANCE_OPEN) != 0; @@ -365,7 +365,7 @@ Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which) for (uint i = 0; i < 6; ++i) { if (i != 2 || !_isButton2Broken) { _ssLocationButtons[i] = insertSprite<SsScene2901LocationButton>(this, _currLocationButtonNum, i); - _vm->_collisionMan->addCollisionSprite(_ssLocationButtons[i]); + addCollisionSprite(_ssLocationButtons[i]); _ssLocationButtonLights[i] = insertSprite<SsScene2901LocationButtonLight>(_currLocationButtonNum, i); } } @@ -374,7 +374,7 @@ Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which) insertSprite<SsScene2901BrokenButton>(_currLocationButtonNum); _ssBigButton = insertSprite<SsScene2901BigButton>(this, _currLocationButtonNum); - _vm->_collisionMan->addCollisionSprite(_ssBigButton); + addCollisionSprite(_ssBigButton); insertPuzzleMouse(kScene2901FileHashes2[_currLocationButtonNum], 20, 620); diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index 6767aa56ea..6bf95e3c9a 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -712,9 +712,9 @@ AsScene3009Symbol::AsScene3009Symbol(NeverhoodEngine *vm, Scene3009 *parentScene SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene3009Symbol::handleMessage); _ssArrowPrev = _parentScene->insertSprite<SsScene3009SymbolArrow>(this, _symbolPosition * 2 + 0); - _vm->_collisionMan->addCollisionSprite(_ssArrowPrev); + _parentScene->addCollisionSprite(_ssArrowPrev); _ssArrowNext = _parentScene->insertSprite<SsScene3009SymbolArrow>(this, _symbolPosition * 2 + 1); - _vm->_collisionMan->addCollisionSprite(_ssArrowNext); + _parentScene->addCollisionSprite(_ssArrowNext); } uint32 AsScene3009Symbol::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -752,7 +752,7 @@ void AsScene3009Symbol::hide() { } Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _keepVideo(false), _moveCannonLeftFirst(false), + : Scene(vm, parentModule), _keepVideo(false), _moveCannonLeftFirst(false), _isTurning(false), _lockSymbolsPart1Countdown(1), _lockSymbolsPart2Countdown(1) { _cannonTargetStatus = getGlobalVar(V_CANNON_TARGET_STATUS); @@ -769,13 +769,13 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) insertPuzzleMouse(0x04208D08, 20, 620); _ssFireCannonButton = insertSprite<SsScene3009FireCannonButton>(this); - _vm->_collisionMan->addCollisionSprite(_ssFireCannonButton); + addCollisionSprite(_ssFireCannonButton); _asVerticalIndicator = insertSprite<AsScene3009VerticalIndicator>(this, _cannonTargetStatus); - _vm->_collisionMan->addCollisionSprite(_asVerticalIndicator); + addCollisionSprite(_asVerticalIndicator); _asHorizontalIndicator = insertSprite<AsScene3009HorizontalIndicator>(this, _cannonTargetStatus); - _vm->_collisionMan->addCollisionSprite(_asHorizontalIndicator); + addCollisionSprite(_asHorizontalIndicator); if (_cannonTargetStatus != kCTSNull && _cannonTargetStatus != kCTSRightRobotNoTarget && _cannonTargetStatus != kCTSRightRobotIsTarget && _cannonTargetStatus != kCTSRightNoRobot) { _keepVideo = true; @@ -1220,7 +1220,7 @@ void AsScene3010DeadBolt::stDisabledMessage() { } Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _countdown(0), _doorUnlocked(false), _checkUnlocked(false) { + : Scene(vm, parentModule), _countdown(0), _doorUnlocked(false), _checkUnlocked(false) { int initCountdown = 0; @@ -1235,7 +1235,7 @@ Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which) for (int i = 0; i < 3; i++) { _asDeadBolts[i] = insertSprite<AsScene3010DeadBolt>(this, i, which == 1);//CHECKME _ssDeadBoltButtons[i] = insertSprite<SsScene3010DeadBoltButton>(this, i, initCountdown, which == 1);//CHECKME - _vm->_collisionMan->addCollisionSprite(_ssDeadBoltButtons[i]); + addCollisionSprite(_ssDeadBoltButtons[i]); if (getSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[i])) initCountdown++; _boltUnlocking[i] = false; @@ -1448,7 +1448,7 @@ void AsScene3011Symbol::change(int symbolIndex, bool isNoisy) { } Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule, true), _updateStatus(0), _buttonClicked(false), _currentSymbolIndex(0) { + : Scene(vm, parentModule), _updateStatus(0), _buttonClicked(false), _currentSymbolIndex(0) { _vm->gameModule()->initCodeSymbolsPuzzle(); _noisySymbolIndex = getGlobalVar(V_NOISY_SYMBOL_INDEX); @@ -1466,7 +1466,7 @@ Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) _asSymbols[symbolIndex] = insertSprite<AsScene3011Symbol>(symbolIndex, true); _ssButton = insertSprite<SsScene3011Button>(this, true); - _vm->_collisionMan->addCollisionSprite(_ssButton); + addCollisionSprite(_ssButton); } diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp index ffaa802a21..d802322858 100644 --- a/engines/neverhood/navigationscene.cpp +++ b/engines/neverhood/navigationscene.cpp @@ -26,7 +26,7 @@ namespace Neverhood { NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint32 navigationListId, int navigationIndex, const byte *itemsTypes) - : Scene(vm, parentModule, true), _itemsTypes(itemsTypes), _navigationIndex(navigationIndex), _smackerDone(false), + : Scene(vm, parentModule), _itemsTypes(itemsTypes), _navigationIndex(navigationIndex), _smackerDone(false), _isWalkingForward(false), _isTurning(false), _smackerFileHash(0), _interactive(true), _leaveSceneAfter(false) { _navigationList = _vm->_staticData->getNavigationList(navigationListId); diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 4ee801bff4..c0c6185ec9 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -28,7 +28,6 @@ #include "engines/util.h" #include "neverhood/neverhood.h" #include "neverhood/blbarchive.h" -#include "neverhood/collisionman.h" #include "neverhood/gamemodule.h" #include "neverhood/gamevars.h" #include "neverhood/graphics.h" @@ -92,7 +91,6 @@ Common::Error NeverhoodEngine::run() { _soundMan = new SoundMan(this); _audioResourceMan = new AudioResourceMan(this); - _collisionMan = new CollisionMan(this); _gameModule = new GameModule(this); // TODO Check if this can actually be false... @@ -116,7 +114,6 @@ Common::Error NeverhoodEngine::run() { mainLoop(); delete _gameModule; - delete _collisionMan; delete _soundMan; delete _audioResourceMan; diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index ef0f16c41a..3653127f91 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -40,7 +40,6 @@ enum NeverhoodGameFeatures { struct NeverhoodGameDescription; -class CollisionMan; class GameModule; class GameVars; class ResourceMan; @@ -85,7 +84,6 @@ public: ResourceMan *_res; GameModule *_gameModule; StaticData *_staticData; - CollisionMan *_collisionMan; SoundMan *_soundMan; AudioResourceMan *_audioResourceMan; diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index 3f0c92f233..e34f9334ec 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -21,12 +21,11 @@ */ #include "neverhood/scene.h" -#include "neverhood/collisionman.h" namespace Neverhood { -Scene::Scene(NeverhoodEngine *vm, Module *parentModule, bool clearHitRects) - : Entity(vm, 0), _parentModule(parentModule), _dataResource(vm) { +Scene::Scene(NeverhoodEngine *vm, Module *parentModule) + : Entity(vm, 0), _parentModule(parentModule), _dataResource(vm), _hitRects(NULL) { _isKlaymanBusy = false; _doConvertMessages = false; @@ -40,10 +39,8 @@ Scene::Scene(NeverhoodEngine *vm, Module *parentModule, bool clearHitRects) _mouseCursor = NULL; _palette = NULL; _background = NULL; - if (clearHitRects) { - _vm->_collisionMan->clearHitRects(); - _vm->_collisionMan->clearCollisionSprites(); - } + clearHitRects(); + clearCollisionSprites(); _vm->_screen->setFps(24); _vm->_screen->setSmackerDecoder(NULL); _canAcceptInput = true; @@ -160,7 +157,7 @@ void Scene::setSpriteSurfacePriority(Sprite *sprite, int priority) { } void Scene::deleteSprite(Sprite **sprite) { - _vm->_collisionMan->removeCollisionSprite(*sprite); + removeCollisionSprite(*sprite); removeSurface((*sprite)->getSurface()); removeEntity(*sprite); delete *sprite; @@ -187,7 +184,11 @@ void Scene::setPalette(uint32 fileHash) { } void Scene::setHitRects(uint32 id) { - _vm->_collisionMan->setHitRects(id); + setHitRects(_vm->_staticData->getHitRectList(id)); +} + +void Scene::setHitRects(HitRectList *hitRects) { + _hitRects = hitRects; } Sprite *Scene::insertStaticSprite(uint32 fileHash, int surfacePriority) { @@ -317,8 +318,8 @@ uint32 Scene::handleMessage(int messageNum, const MessageParam ¶m, Entity *s } bool Scene::queryPositionSprite(int16 mouseX, int16 mouseY) { - for (uint i = 0; i < _vm->_collisionMan->getCollisionSpritesCount(); i++) { - Sprite *sprite = _vm->_collisionMan->getCollisionSprite(i); + for (uint i = 0; i < _collisionSprites.size(); i++) { + Sprite *sprite = _collisionSprites[i]; if (sprite->hasMessageHandler() && sprite->isPointInside(mouseX, mouseY) && sendPointMessage(sprite, 0x1011, _mouseClickPos) != 0) { return true; @@ -471,7 +472,7 @@ void Scene::loadHitRectList() { HitRectList *hitRectList = _dataResource.getHitRectList(); if (hitRectList) { _hitRectList = *hitRectList; - _vm->_collisionMan->setHitRects(&_hitRectList); + setHitRects(&_hitRectList); } } @@ -510,4 +511,54 @@ uint16 Scene::convertMessageNum(uint32 messageNum) { return 0x1000; } +void Scene::clearHitRects() { + _hitRects = NULL; +} + +HitRect *Scene::findHitRectAtPos(int16 x, int16 y) { + static HitRect kDefaultHitRect = {NRect(), 0x5000}; + if (_hitRects) + for (HitRectList::iterator it = _hitRects->begin(); it != _hitRects->end(); it++) + if ((*it).rect.contains(x, y)) + return &(*it); + return &kDefaultHitRect; +} + +void Scene::addCollisionSprite(Sprite *sprite) { + int index = 0, insertIndex = -1; + for (Common::Array<Sprite*>::iterator iter = _collisionSprites.begin(); iter != _collisionSprites.end(); iter++) { + if ((*iter)->getPriority() > sprite->getPriority()) { + insertIndex = index; + break; + } + index++; + } + if (insertIndex >= 0) + _collisionSprites.insert_at(insertIndex, sprite); + else + _collisionSprites.push_back(sprite); +} + +void Scene::removeCollisionSprite(Sprite *sprite) { + for (uint index = 0; index < _collisionSprites.size(); index++) { + if (_collisionSprites[index] == sprite) { + _collisionSprites.remove_at(index); + break; + } + } +} + +void Scene::clearCollisionSprites() { + _collisionSprites.clear(); +} + +void Scene::checkCollision(Sprite *sprite, uint16 flags, int messageNum, uint32 messageParam) { + for (Common::Array<Sprite*>::iterator iter = _collisionSprites.begin(); iter != _collisionSprites.end(); iter++) { + Sprite *collSprite = *iter; + if ((sprite->getFlags() & flags) && collSprite->checkCollision(sprite->getCollisionBounds())) { + sprite->sendMessage(collSprite, messageNum, messageParam); + } + } +} + } // End of namespace Neverhood diff --git a/engines/neverhood/scene.h b/engines/neverhood/scene.h index a9e1674325..cb345674f0 100644 --- a/engines/neverhood/scene.h +++ b/engines/neverhood/scene.h @@ -39,7 +39,7 @@ namespace Neverhood { class Scene : public Entity { public: - Scene(NeverhoodEngine *vm, Module *parentModule, bool clearHitRects); + Scene(NeverhoodEngine *vm, Module *parentModule); virtual ~Scene(); virtual void draw(); void addEntity(Entity *entity); @@ -67,6 +67,10 @@ public: SmackerPlayer *addSmackerPlayer(SmackerPlayer *smackerPlayer); void update(); void leaveScene(uint32 result); + HitRect *findHitRectAtPos(int16 x, int16 y); + void addCollisionSprite(Sprite *sprite); + void removeCollisionSprite(Sprite *sprite); + void checkCollision(Sprite *sprite, uint16 flags, int messageNum, uint32 messageParam); // Some crazy templated functions to make the logic code smaller/simpler (imo!) // insertKlayman template<class T> @@ -187,6 +191,9 @@ protected: HitRectList _hitRectList; + HitRectList *_hitRects; + Common::Array<Sprite*> _collisionSprites; + void (Entity::*_savedUpdateHandlerCb)(); uint32 (Entity::*_savedMessageHandlerCb)(int messageNum, const MessageParam ¶m, Entity *sender); int _messageValue; @@ -205,6 +212,11 @@ protected: void cancelMessageList(); void loadDataResource(uint32 fileHash); uint16 convertMessageNum(uint32 messageNum); + + void setHitRects(HitRectList *hitRects); + void clearHitRects(); + void clearCollisionSprites(); + }; } // End of namespace Neverhood diff --git a/engines/neverhood/smackerscene.cpp b/engines/neverhood/smackerscene.cpp index a08aad4cee..7470acbdad 100644 --- a/engines/neverhood/smackerscene.cpp +++ b/engines/neverhood/smackerscene.cpp @@ -25,7 +25,7 @@ namespace Neverhood { SmackerScene::SmackerScene(NeverhoodEngine *vm, Module *parentModule, bool doubleSurface, bool flag1, bool canAbort) - : Scene(vm, parentModule, true), _doubleSurface(doubleSurface), _flag1(flag1), _canAbort(canAbort), _videoPlayedBefore(false), + : Scene(vm, parentModule), _doubleSurface(doubleSurface), _flag1(flag1), _canAbort(canAbort), _videoPlayedBefore(false), _fileHashListIndex(-1), _fileHashList(NULL), _playNextVideoFlag(false) { debug("SmackerScene::SmackerScene(%d, %d, %d)", doubleSurface, flag1, canAbort); |