2003-09-28 15:50:47 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2003 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "queen/logic.h"
|
|
|
|
|
2003-09-29 22:30:02 +00:00
|
|
|
QueenLogic::QueenLogic(QueenResource *resource) : _resource(resource) {
|
2003-09-29 22:27:08 +00:00
|
|
|
_jas = _resource->loadFile("QUEEN.JAS", 20);
|
2003-09-28 15:50:47 +00:00
|
|
|
|
|
|
|
initialise();
|
|
|
|
}
|
|
|
|
|
|
|
|
QueenLogic::~QueenLogic() {
|
|
|
|
free (_jas);
|
|
|
|
//free(_graphicData);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QueenLogic::initialise() {
|
2003-09-29 01:48:13 +00:00
|
|
|
uint16 i;
|
2003-09-28 15:50:47 +00:00
|
|
|
uint8 *ptr = _jas;
|
|
|
|
|
|
|
|
//_display->loadFont();
|
|
|
|
|
|
|
|
_numRooms = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
_numNames = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
_numObjects = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
_numDescriptions = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
|
|
|
|
|
|
|
|
//Object data
|
2003-10-02 06:38:58 +00:00
|
|
|
_objectData = new int16[_numObjects + 1][8];
|
2003-09-28 19:57:01 +00:00
|
|
|
|
2003-09-28 15:50:47 +00:00
|
|
|
//clear first object
|
|
|
|
for (uint16 j = 0; j < 8; j++)
|
|
|
|
_objectData[0][j] = 0;
|
|
|
|
|
2003-09-29 01:48:13 +00:00
|
|
|
for (i = 1; i < (_numObjects + 1); i++)
|
2003-09-28 15:50:47 +00:00
|
|
|
for (uint16 j = 0; j < 8; j++) {
|
2003-10-02 06:38:58 +00:00
|
|
|
_objectData[i][j] = (int16)READ_BE_UINT16(ptr);
|
2003-09-28 15:50:47 +00:00
|
|
|
ptr += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Room data
|
2003-09-28 19:57:01 +00:00
|
|
|
_roomData = new uint16[_numRooms + 2];
|
2003-09-29 01:48:13 +00:00
|
|
|
for (i = 1; i < (_numRooms + 2); i++) {
|
2003-09-28 15:50:47 +00:00
|
|
|
_roomData[i] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
_roomData[_numRooms + 1] = _numObjects;
|
|
|
|
|
|
|
|
//SFX Name
|
2003-09-28 19:57:01 +00:00
|
|
|
_sfxName = new uint16[_numRooms + 1];
|
2003-09-29 01:48:13 +00:00
|
|
|
for (i = 0; i < (_numRooms + 1); i++) {
|
2003-09-28 15:50:47 +00:00
|
|
|
_sfxName[i] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Item information
|
|
|
|
_numItems = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
|
2003-09-28 19:57:01 +00:00
|
|
|
_itemData = new uint16[_numItems + 1][5];
|
|
|
|
|
2003-09-29 01:48:13 +00:00
|
|
|
for (i = 1; i < (_numItems + 1); i++) {
|
2003-09-28 15:50:47 +00:00
|
|
|
_itemData[i][0] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
for (uint16 j = 1; j < 5; j++) {
|
|
|
|
_itemData[i][j] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Graphic Image Data
|
|
|
|
|
|
|
|
_numGraphics = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
|
2003-09-28 19:57:01 +00:00
|
|
|
_graphicData = new uint16[_numGraphics + 1][5];
|
2003-09-28 15:50:47 +00:00
|
|
|
|
2003-09-29 01:48:13 +00:00
|
|
|
for (i = 1; i < _numGraphics; i++)
|
2003-09-28 15:50:47 +00:00
|
|
|
for (uint16 j = 0; j < 5; j++) {
|
|
|
|
_graphicData[i][j] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
}
|
|
|
|
|
2003-09-28 19:57:01 +00:00
|
|
|
_objMax = new uint16[_numRooms + 1];
|
|
|
|
_areaMax = new uint16[_numRooms + 1];
|
|
|
|
_area = new uint16[_numRooms + 1][11][8];
|
2003-09-28 15:50:47 +00:00
|
|
|
/*
|
|
|
|
for (uint16 i = 1; i < (_numRooms + 1); i++) {
|
|
|
|
_objMax[i] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
_areaMax[i] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
|
|
|
|
for (uint16 j = 1; j < (_areaMax[i] + 1); j++)
|
|
|
|
for (uint16 k = 0; k < 8; k++) {
|
|
|
|
_area[i][j][k] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-09-28 19:57:01 +00:00
|
|
|
_objectBox = new uint16[_numObjects + 1][4];
|
2003-09-28 15:50:47 +00:00
|
|
|
for (uint16 i = 1; i < (_numObjects + 1); i++)
|
|
|
|
for (uint16 j = 0; j < 4; j++) {
|
|
|
|
_objectBox[i][j] = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2003-10-02 08:49:38 +00:00
|
|
|
_numWalkOffs = 0;
|
2003-09-28 15:50:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 QueenLogic::currentRoom() {
|
|
|
|
return _currentRoom;
|
|
|
|
}
|
|
|
|
|
2003-10-02 06:38:58 +00:00
|
|
|
void QueenLogic::currentRoom(uint16 room) {
|
2003-10-02 08:49:38 +00:00
|
|
|
_currentRoom = room;
|
2003-10-02 06:38:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int16* QueenLogic::objectData(int index) {
|
2003-10-02 08:49:38 +00:00
|
|
|
return _objectData[index];
|
2003-10-02 06:38:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 QueenLogic::roomData(int room) {
|
2003-10-02 08:49:38 +00:00
|
|
|
return _roomData[room];
|
2003-10-02 06:38:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 QueenLogic::objMax(int room) {
|
2003-10-02 08:49:38 +00:00
|
|
|
return _objMax[room];
|
2003-10-02 06:38:58 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 08:49:38 +00:00
|
|
|
uint16 QueenLogic::walkOffCount() {
|
|
|
|
return _numWalkOffs;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16 *QueenLogic::walkOffData(int index) {
|
|
|
|
return _walkOffData[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|