2010-01-07 23:52:31 +02: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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "wage/wage.h"
|
2010-01-11 00:44:27 +02:00
|
|
|
#include "wage/entities.h"
|
2010-01-07 23:52:31 +02:00
|
|
|
#include "wage/design.h"
|
|
|
|
|
2010-01-11 21:30:48 +02:00
|
|
|
#include "common/stream.h"
|
|
|
|
|
2010-01-07 23:52:31 +02:00
|
|
|
namespace Wage {
|
|
|
|
|
2010-01-11 21:30:48 +02:00
|
|
|
void Designed::setDesignBounds(Common::Rect *bounds) {
|
|
|
|
_designBounds = new Common::Rect(*bounds);
|
2010-01-07 23:52:31 +02:00
|
|
|
_design->setBounds(bounds);
|
|
|
|
}
|
2010-01-11 00:44:27 +02:00
|
|
|
|
2010-01-11 21:30:48 +02:00
|
|
|
Scene::Scene(String name, byte *data, int dataSize) {
|
|
|
|
_name = name;
|
|
|
|
_design = new Design(data, dataSize);
|
|
|
|
|
|
|
|
Common::MemoryReadStream in(data, dataSize);
|
|
|
|
|
|
|
|
in.skip(in.readUint16BE() - 2); // Skip design.
|
|
|
|
setDesignBounds(readRect(in));
|
|
|
|
_worldY = in.readSint16BE();
|
|
|
|
_worldX = in.readSint16BE();
|
|
|
|
_blocked[Scene::NORTH] = (in.readByte() != 0);
|
|
|
|
_blocked[Scene::SOUTH] = (in.readByte() != 0);
|
|
|
|
_blocked[Scene::EAST] = (in.readByte() != 0);
|
|
|
|
_blocked[Scene::WEST] = (in.readByte() != 0);
|
|
|
|
_soundFrequency = in.readSint16BE();
|
|
|
|
_soundType = in.readByte();
|
|
|
|
in.readByte(); // unknown
|
|
|
|
_messages[Scene::NORTH] = readPascalString(in);
|
|
|
|
_messages[Scene::SOUTH] = readPascalString(in);
|
|
|
|
_messages[Scene::EAST] = readPascalString(in);
|
|
|
|
_messages[Scene::WEST] = readPascalString(in);
|
|
|
|
_soundName = readPascalString(in);
|
2010-01-11 00:44:27 +02:00
|
|
|
}
|
|
|
|
|
2010-01-11 21:30:48 +02:00
|
|
|
Obj::Obj(String name, byte *data, int dataSize) : _currentOwner(NULL), _currentScene(NULL) {
|
|
|
|
_name = name;
|
|
|
|
_design = new Design(data, dataSize);
|
|
|
|
|
|
|
|
Common::MemoryReadStream in(data, dataSize);
|
|
|
|
|
|
|
|
in.skip(in.readSint16BE() - 2); // Skip design.
|
|
|
|
setDesignBounds(readRect(in));
|
|
|
|
|
|
|
|
int16 namePlural = in.readSint16BE();
|
|
|
|
|
|
|
|
if (namePlural == 256)
|
|
|
|
_namePlural = true; // TODO: other flags?
|
|
|
|
else if (namePlural == 0)
|
|
|
|
_namePlural = false;
|
|
|
|
else
|
|
|
|
error("Obj <%s> had weird namePlural set", name.c_str());
|
|
|
|
|
|
|
|
if (in.readSint16BE() != 0)
|
|
|
|
error("Obj <%s> had short set", name.c_str());
|
|
|
|
|
|
|
|
if (in.readByte() != 0)
|
|
|
|
error("Obj <%s> had byte set", name.c_str());
|
|
|
|
|
|
|
|
_accuracy = in.readByte();
|
|
|
|
_value = in.readByte();
|
|
|
|
_type = in.readSByte();
|
|
|
|
_damage = in.readByte();
|
|
|
|
_attackType = in.readSByte();
|
|
|
|
_numberOfUses = in.readSint16BE();
|
|
|
|
int16 returnTo = in.readSint16BE();
|
|
|
|
if (returnTo == 256) // TODO any other possibilities?
|
|
|
|
_returnToRandomScene = true;
|
|
|
|
else if (returnTo == 0)
|
|
|
|
_returnToRandomScene = false;
|
|
|
|
else
|
|
|
|
error("Obj <%s> had weird returnTo set", name.c_str());
|
|
|
|
|
|
|
|
_sceneOrOwner = readPascalString(in);
|
|
|
|
_clickMessage = readPascalString(in);
|
|
|
|
_operativeVerb = readPascalString(in);
|
|
|
|
_failureMessage = readPascalString(in);
|
|
|
|
_useMessage = readPascalString(in);
|
|
|
|
_sound = readPascalString(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
Chr::Chr(String name, byte *data, int dataSize) {
|
|
|
|
_name = name;
|
|
|
|
_design = new Design(data, dataSize);
|
|
|
|
|
|
|
|
Common::MemoryReadStream in(data, dataSize);
|
|
|
|
|
|
|
|
in.skip(in.readSint16BE() - 2); // Skip design.
|
|
|
|
setDesignBounds(readRect(in));
|
|
|
|
|
|
|
|
_physicalStrength = in.readByte();
|
|
|
|
_physicalHp = in.readByte();
|
|
|
|
_naturalArmor = in.readByte();
|
|
|
|
_physicalAccuracy = in.readByte();
|
|
|
|
|
|
|
|
_spiritualStength = in.readByte();
|
|
|
|
_spiritialHp = in.readByte();
|
|
|
|
_resistanceToMagic = in.readByte();
|
|
|
|
_spiritualAccuracy = in.readByte();
|
|
|
|
|
|
|
|
_runningSpeed = in.readByte();
|
|
|
|
_rejectsOffers = in.readByte();
|
|
|
|
_followsOpponent = in.readByte();
|
|
|
|
|
|
|
|
in.readSByte(); // TODO: ???
|
|
|
|
in.readSint32BE(); // TODO: ???
|
|
|
|
|
|
|
|
_weaponDamage1 = in.readByte();
|
|
|
|
_weaponDamage2 = in.readByte();
|
|
|
|
|
|
|
|
in.readSByte(); // TODO: ???
|
|
|
|
|
|
|
|
if (in.readSByte() == 1)
|
|
|
|
_playerCharacter = true;
|
|
|
|
_maximumCarriedObjects = in.readByte();
|
|
|
|
_returnTo = in.readSByte();
|
|
|
|
|
|
|
|
_winningWeapons = in.readByte();
|
|
|
|
_winningMagic = in.readByte();
|
|
|
|
_winningRun = in.readByte();
|
|
|
|
_winningOffer = in.readByte();
|
|
|
|
_losingWeapons = in.readByte();
|
|
|
|
_losingMagic = in.readByte();
|
|
|
|
_losingRun = in.readByte();
|
|
|
|
_losingOffer = in.readByte();
|
|
|
|
|
|
|
|
_gender = in.readSByte();
|
|
|
|
if (in.readSByte() == 1)
|
|
|
|
_nameProperNoun = true;
|
|
|
|
|
|
|
|
_initialScene = readPascalString(in);
|
|
|
|
_nativeWeapon1 = readPascalString(in);
|
|
|
|
_operativeVerb1 = readPascalString(in);
|
|
|
|
_nativeWeapon2 = readPascalString(in);
|
|
|
|
_operativeVerb2 = readPascalString(in);
|
|
|
|
|
|
|
|
_initialComment = readPascalString(in);
|
|
|
|
_scoresHitComment = readPascalString(in);
|
|
|
|
_receivesHitComment = readPascalString(in);
|
|
|
|
_makesOfferComment = readPascalString(in);
|
|
|
|
_rejectsOfferComment = readPascalString(in);
|
|
|
|
_acceptsOfferComment = readPascalString(in);
|
|
|
|
_dyingWords = readPascalString(in);
|
|
|
|
|
|
|
|
_initialSound = readPascalString(in);
|
|
|
|
_scoresHitSound = readPascalString(in);
|
|
|
|
_receivesHitSound = readPascalString(in);
|
|
|
|
_dyingSound = readPascalString(in);
|
|
|
|
|
|
|
|
_weaponSound1 = readPascalString(in);
|
|
|
|
_weaponSound2 = readPascalString(in);
|
|
|
|
}
|
2010-01-11 00:44:27 +02:00
|
|
|
|
2010-01-07 23:52:31 +02:00
|
|
|
} // End of namespace Wage
|