2007-05-30 21:56:52 +00:00
|
|
|
/* 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.
|
2004-01-08 14:10:32 +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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-01-08 14:10:32 +00:00
|
|
|
* 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-01-08 14:10:32 +00:00
|
|
|
*
|
2006-02-11 10:07:12 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-01-08 14:10:32 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-11-12 17:47:16 +00:00
|
|
|
#ifndef QUEEN_GRID_H
|
|
|
|
#define QUEEN_GRID_H
|
2004-01-08 14:10:32 +00:00
|
|
|
|
|
|
|
#include "common/util.h"
|
|
|
|
#include "queen/structs.h"
|
|
|
|
|
|
|
|
namespace Queen {
|
|
|
|
|
|
|
|
enum GridScreen {
|
|
|
|
GS_ROOM = 0,
|
|
|
|
GS_PANEL = 1,
|
|
|
|
GS_COUNT = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
class QueenEngine;
|
|
|
|
|
|
|
|
class Grid {
|
|
|
|
public:
|
|
|
|
|
|
|
|
Grid(QueenEngine *vm);
|
2004-10-17 19:00:09 +00:00
|
|
|
~Grid();
|
2004-01-08 14:10:32 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! read areas data from specified stream
|
2004-01-08 14:10:32 +00:00
|
|
|
void readDataFrom(uint16 numObjects, uint16 numRooms, byte *&ptr);
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! defines a new zone
|
2004-01-08 14:10:32 +00:00
|
|
|
void setZone(GridScreen screen, uint16 zoneNum, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! defines a new zone
|
2004-01-08 14:10:32 +00:00
|
|
|
void setZone(GridScreen screen, uint16 zoneNum, const Box &box);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! find the zone number containing the specified point
|
2004-01-08 14:10:32 +00:00
|
|
|
uint16 findZoneForPos(GridScreen screen, uint16 x, uint16 y) const;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! find the area number containing the specified point
|
2004-01-08 14:10:32 +00:00
|
|
|
uint16 findAreaForPos(GridScreen screen, uint16 x, uint16 y) const;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! clear the zones for current room
|
2004-01-08 14:10:32 +00:00
|
|
|
void clear(GridScreen screen);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! setup objects zones for the specified room
|
2004-01-08 14:10:32 +00:00
|
|
|
void setupNewRoom(uint16 room, uint16 firstRoomObjNum);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! setup panel zones
|
2004-01-08 14:10:32 +00:00
|
|
|
void setupPanel();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! draw the zones for current room (debug only)
|
2004-01-08 14:10:32 +00:00
|
|
|
void drawZones();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! retuns a reference to the specified zone
|
2004-01-08 14:10:32 +00:00
|
|
|
const Box *zone(GridScreen screen, uint16 index) const;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! get the verb for the specified cursor position
|
2004-01-08 14:10:32 +00:00
|
|
|
Verb findVerbUnderCursor(int16 cursorx, int16 cursory) const;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! get the object for the specified cursor position
|
2004-01-08 14:10:32 +00:00
|
|
|
uint16 findObjectUnderCursor(int16 cursorx, int16 cursory) const;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! get the object for the specified zone number
|
2004-01-08 14:10:32 +00:00
|
|
|
uint16 findObjectNumber(uint16 zoneNum) const;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! get scale for the specified position
|
2004-01-08 14:10:32 +00:00
|
|
|
uint16 findScale(uint16 x, uint16 y) const;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! returns a reference to the specfied room area
|
2004-01-08 14:10:32 +00:00
|
|
|
Area *area(int room, int num) const { return &_area[room][num]; }
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! returns the number of areas in this room
|
2004-01-08 14:10:32 +00:00
|
|
|
uint16 areaMax(int room) const { return _areaMax[room]; }
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! returns the number of objects in this room
|
2005-07-30 21:11:48 +00:00
|
|
|
uint16 objMax(int room) const { return _objMax[room]; }
|
2004-01-08 14:10:32 +00:00
|
|
|
|
2004-01-12 13:40:02 +00:00
|
|
|
void saveState(byte *&ptr);
|
|
|
|
void loadState(uint32 ver, byte *&ptr);
|
|
|
|
|
2004-01-08 14:10:32 +00:00
|
|
|
enum {
|
2004-01-09 13:36:37 +00:00
|
|
|
MAX_ZONES_NUMBER = 32,
|
|
|
|
MAX_AREAS_NUMBER = 11
|
2004-01-08 14:10:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
struct ZoneSlot {
|
|
|
|
bool valid;
|
|
|
|
Box box;
|
|
|
|
};
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! current room zones
|
2004-01-09 13:36:37 +00:00
|
|
|
ZoneSlot _zones[GS_COUNT][MAX_ZONES_NUMBER];
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! number of objects for each room
|
2004-01-08 14:10:32 +00:00
|
|
|
int16 *_objMax;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! number of areas for each room
|
2004-01-08 14:10:32 +00:00
|
|
|
int16 *_areaMax;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! areas for each room
|
2004-01-09 13:36:37 +00:00
|
|
|
Area (*_area)[MAX_AREAS_NUMBER];
|
2004-01-08 14:10:32 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! total number of room areas
|
2004-01-12 13:40:02 +00:00
|
|
|
uint16 _numRoomAreas;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! box/zone for each objects
|
2004-01-08 14:10:32 +00:00
|
|
|
Box *_objectBox;
|
|
|
|
|
|
|
|
QueenEngine *_vm;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // End of namespace Queen
|
|
|
|
|
|
|
|
#endif
|