2014-12-27 11:21:30 +01:00
|
|
|
/* ResidualVM - A 3D game interpreter
|
|
|
|
*
|
|
|
|
* ResidualVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the AUTHORS
|
|
|
|
* 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 "engines/stark/resources/command.h"
|
|
|
|
#include "engines/stark/debug.h"
|
2014-12-27 12:34:01 +01:00
|
|
|
#include "engines/stark/resourcereference.h"
|
|
|
|
#include "engines/stark/xrcreader.h"
|
2014-12-27 11:21:30 +01:00
|
|
|
|
|
|
|
namespace Stark {
|
|
|
|
|
|
|
|
Command::~Command() {
|
|
|
|
}
|
|
|
|
|
|
|
|
Command::Command(Resource *parent, byte subType, uint16 index, const Common::String &name) :
|
|
|
|
Resource(parent, subType, index, name) {
|
2015-01-04 15:03:09 +01:00
|
|
|
_type = TYPE;
|
2014-12-27 11:21:30 +01:00
|
|
|
}
|
|
|
|
|
2015-01-06 21:31:16 +01:00
|
|
|
Command *Command::execute(uint32 callMode, Script *script) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-12-27 11:21:30 +01:00
|
|
|
void Command::readData(XRCReadStream *stream) {
|
|
|
|
uint32 count = stream->readUint32LE();
|
|
|
|
for (uint i = 0; i < count; i++) {
|
|
|
|
Argument argument;
|
|
|
|
argument.type = stream->readUint32LE();
|
|
|
|
|
|
|
|
switch (argument.type) {
|
|
|
|
case Argument::kTypeInteger1:
|
|
|
|
case Argument::kTypeInteger2:
|
|
|
|
argument.intValue = stream->readUint32LE();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Argument::kTypeResourceReference:
|
|
|
|
argument.referenceValue = stream->readResourceReference();
|
|
|
|
break;
|
|
|
|
case Argument::kTypeString:
|
|
|
|
argument.stringValue = stream->readString();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("Unknown argument type %d", argument.type);
|
|
|
|
}
|
|
|
|
|
|
|
|
_arguments.push_back(argument);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Command::printData() {
|
|
|
|
for (uint i = 0; i < _arguments.size(); i++) {
|
|
|
|
switch (_arguments[i].type) {
|
|
|
|
case Argument::kTypeInteger1:
|
|
|
|
case Argument::kTypeInteger2:
|
|
|
|
debug("%d: %d", i, _arguments[i].intValue);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Argument::kTypeResourceReference: {
|
2014-12-27 12:43:16 +01:00
|
|
|
debug("%d: %s", i, _arguments[i].referenceValue.describe().c_str());
|
2014-12-27 11:21:30 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Argument::kTypeString:
|
|
|
|
debug("%d: %s", i, _arguments[i].stringValue.c_str());
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("Unknown argument type %d", _arguments[i].type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Stark
|