diff options
author | johndoe123 | 2011-07-05 14:46:10 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:30:58 +0200 |
commit | 6b71d177925ff21787fb792dc05ac048eadbbca3 (patch) | |
tree | 3cfa9d6d2528902b8a7d27da76df64c06b0a8f9f /engines/neverhood | |
parent | ae4ef4e66dc69a9d60b44261596860fcc4518de9 (diff) | |
download | scummvm-rg350-6b71d177925ff21787fb792dc05ac048eadbbca3.tar.gz scummvm-rg350-6b71d177925ff21787fb792dc05ac048eadbbca3.tar.bz2 scummvm-rg350-6b71d177925ff21787fb792dc05ac048eadbbca3.zip |
NEVERHOOD: Start with the CollisionMan class
Diffstat (limited to 'engines/neverhood')
-rw-r--r-- | engines/neverhood/collisionman.cpp | 67 | ||||
-rw-r--r-- | engines/neverhood/collisionman.h | 53 | ||||
-rw-r--r-- | engines/neverhood/module.mk | 1 | ||||
-rw-r--r-- | engines/neverhood/neverhood.cpp | 4 | ||||
-rw-r--r-- | engines/neverhood/neverhood.h | 2 |
5 files changed, 127 insertions, 0 deletions
diff --git a/engines/neverhood/collisionman.cpp b/engines/neverhood/collisionman.cpp new file mode 100644 index 0000000000..cc40a47f1e --- /dev/null +++ b/engines/neverhood/collisionman.cpp @@ -0,0 +1,67 @@ +/* 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 { + +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; +} + +HitRect *CollisionMan::findHitRectAtPos(int16 x, int16 y) { + // TODO + return NULL; +} + +void CollisionMan::addSprite(Sprite *sprite) { + _sprites.push_back(sprite); +} + +void CollisionMan::removeSprite(Sprite *sprite) { + // TODO +} + +void CollisionMan::clearSprites() { + _sprites.clear(); +} + +void CollisionMan::save() { + // TODO +} + +void CollisionMan::restore() { + // TODO +} + +} // End of namespace Neverhood diff --git a/engines/neverhood/collisionman.h b/engines/neverhood/collisionman.h new file mode 100644 index 0000000000..cfa248ab4b --- /dev/null +++ b/engines/neverhood/collisionman.h @@ -0,0 +1,53 @@ +/* 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); + HitRect *findHitRectAtPos(int16 x, int16 y); + void addSprite(Sprite *sprite); + void removeSprite(Sprite *sprite); + void clearSprites(); + void save(); + void restore(); +protected: + NeverhoodEngine *_vm; + HitRectList *_hitRects; + Common::Array<Sprite*> _sprites; +}; + + +} // End of namespace Neverhood + +#endif /* NEVERHOOD_COLLISIONMAN_H */ diff --git a/engines/neverhood/module.mk b/engines/neverhood/module.mk index 8a25e25bab..f139268c36 100644 --- a/engines/neverhood/module.mk +++ b/engines/neverhood/module.mk @@ -3,6 +3,7 @@ MODULE := engines/neverhood MODULE_OBJS = \ background.o \ blbarchive.o \ + collisionman.o \ detection.o \ entity.o \ gamemodule.o \ diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 24033f0fd1..8b74b6620e 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -28,6 +28,7 @@ #include "engines/util.h" #include "neverhood/neverhood.h" #include "neverhood/blbarchive.h" +#include "neverhood/collisionman.h" #include "neverhood/gamemodule.h" #include "neverhood/graphics.h" #include "neverhood/resourceman.h" @@ -128,6 +129,7 @@ Common::Error NeverhoodEngine::run() { } #endif + _collisionMan = new CollisionMan(this); _gameModule = new GameModule(this); // Preliminary main loop, needs some more work but works for testing @@ -180,6 +182,8 @@ Common::Error NeverhoodEngine::run() { } delete _gameModule; + delete _collisionMan; + delete _res; delete _screen; diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index b2ba5f7ff0..4a07d6a1be 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -39,6 +39,7 @@ enum NeverhoodGameFeatures { struct NeverhoodGameDescription; +class CollisionMan; class GameModule; class ResourceMan; class Screen; @@ -76,6 +77,7 @@ public: ResourceMan *_res; GameModule *_gameModule; StaticData *_staticData; + CollisionMan *_collisionMan; public: |