2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
2007-05-30 21:56:52 +00:00
|
|
|
* 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.
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
2006-02-11 12:44:16 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Object map / Object click-area module header file
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2007-02-19 17:30:43 +00:00
|
|
|
#ifndef SAGA_OBJECTMAP_H
|
|
|
|
#define SAGA_OBJECTMAP_H
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
#include "saga/stream.h"
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
namespace Saga {
|
|
|
|
|
2004-10-08 01:22:39 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
class HitZone {
|
|
|
|
private:
|
|
|
|
struct ClickArea {
|
|
|
|
int pointsCount;
|
|
|
|
Point *points;
|
|
|
|
};
|
2005-04-16 20:59:24 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
public:
|
2006-11-09 13:19:23 +00:00
|
|
|
HitZone(MemoryReadStreamEndian *readStream, int index, int sceneNumber);
|
2004-12-24 20:44:39 +00:00
|
|
|
~HitZone();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-01-18 15:01:21 +00:00
|
|
|
int getNameIndex() const {
|
|
|
|
return _nameIndex;
|
|
|
|
}
|
2004-12-24 20:44:39 +00:00
|
|
|
int getSceneNumber() const {
|
2005-01-18 15:01:21 +00:00
|
|
|
return _nameIndex;
|
2004-12-24 20:44:39 +00:00
|
|
|
}
|
2005-01-15 23:46:43 +00:00
|
|
|
int getActorsEntrance() const {
|
|
|
|
return _scriptNumber;
|
|
|
|
}
|
|
|
|
int getScriptNumber() const {
|
2004-12-24 20:44:39 +00:00
|
|
|
return _scriptNumber;
|
|
|
|
}
|
2005-01-15 20:12:49 +00:00
|
|
|
int getRightButtonVerb() const {
|
|
|
|
return _rightButtonVerb;
|
|
|
|
}
|
2005-01-15 23:46:43 +00:00
|
|
|
int getFlags() const {
|
|
|
|
return _flags;
|
|
|
|
}
|
2005-04-16 20:59:24 +00:00
|
|
|
void setFlag(HitZoneFlags flag) {
|
|
|
|
_flags |= flag;
|
|
|
|
}
|
|
|
|
void clearFlag(HitZoneFlags flag) {
|
|
|
|
_flags &= ~flag;
|
|
|
|
}
|
2005-01-15 23:46:43 +00:00
|
|
|
int getDirection() const {
|
|
|
|
return ((_flags >> 4) & 0xF);
|
|
|
|
}
|
2005-01-18 15:01:21 +00:00
|
|
|
uint16 getHitZoneId() const {
|
|
|
|
return objectIndexToId(kGameObjectHitZone, _index);
|
|
|
|
}
|
|
|
|
uint16 getStepZoneId() const {
|
|
|
|
return objectIndexToId(kGameObjectStepZone, _index);
|
|
|
|
}
|
|
|
|
bool getSpecialPoint(Point &specialPoint) const;
|
2005-07-30 21:11:48 +00:00
|
|
|
void draw(SagaEngine *vm, Surface *ds, int color);
|
2004-12-24 20:44:39 +00:00
|
|
|
bool hitTest(const Point &testPoint);
|
2005-04-16 20:59:24 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
private:
|
2005-07-30 21:11:48 +00:00
|
|
|
int _flags; // Saga::HitZoneFlags
|
2004-12-24 20:44:39 +00:00
|
|
|
int _clickAreasCount;
|
2005-01-15 20:12:49 +00:00
|
|
|
int _rightButtonVerb;
|
2005-01-18 15:01:21 +00:00
|
|
|
int _nameIndex;
|
2004-12-24 20:44:39 +00:00
|
|
|
int _scriptNumber;
|
2005-01-18 15:01:21 +00:00
|
|
|
int _index;
|
2004-10-08 01:22:39 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
ClickArea *_clickAreas;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
|
2005-01-18 11:55:31 +00:00
|
|
|
class ObjectMap {
|
|
|
|
public:
|
|
|
|
ObjectMap(SagaEngine *vm) : _vm(vm) {
|
|
|
|
_hitZoneList = NULL;
|
|
|
|
_hitZoneListCount = 0;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-18 11:55:31 +00:00
|
|
|
}
|
|
|
|
~ObjectMap(void) {
|
|
|
|
freeMem();
|
|
|
|
}
|
|
|
|
void load(const byte *resourcePointer, size_t resourceLength);
|
|
|
|
void freeMem(void);
|
|
|
|
|
2005-07-09 16:23:45 +00:00
|
|
|
void draw(Surface *drawSurface, const Point& testPoint, int color, int color2);
|
2005-01-18 11:55:31 +00:00
|
|
|
int hitTest(const Point& testPoint);
|
2005-04-16 20:59:24 +00:00
|
|
|
HitZone *getHitZone(int16 index) {
|
2005-01-18 11:55:31 +00:00
|
|
|
if ((index < 0) || (index >= _hitZoneListCount)) {
|
2007-06-03 22:00:18 +00:00
|
|
|
// HACK: If we get a wrong hitzone, return the last hitzone in the list
|
|
|
|
// Normally, we don't get wrong hitzones in ITE, however IHNM still seems
|
|
|
|
// to have problems with some, therefore just throw a warning for now and
|
|
|
|
// continue with a valid hitzone
|
|
|
|
warning("ObjectMap::getHitZone wrong index 0x%X, adjusting it to 0x%X", index, _hitZoneListCount - 1);
|
|
|
|
index = _hitZoneListCount - 1;
|
2005-01-18 11:55:31 +00:00
|
|
|
}
|
|
|
|
return _hitZoneList[index];
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
void cmdInfo(void);
|
2004-10-07 23:02:19 +00:00
|
|
|
|
2004-08-02 15:44:18 +00:00
|
|
|
private:
|
2004-10-07 23:02:19 +00:00
|
|
|
SagaEngine *_vm;
|
2005-01-18 11:55:31 +00:00
|
|
|
|
|
|
|
int _hitZoneListCount;
|
|
|
|
HitZone **_hitZoneList;
|
2004-08-02 15:44:18 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
} // End of namespace Saga
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
#endif
|