2018-02-22 23:47:16 +01: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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MUTATIONOFJB_SCRIPT_H
|
|
|
|
#define MUTATIONOFJB_SCRIPT_H
|
|
|
|
|
|
|
|
#include "common/array.h"
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
class SeekableReadStream;
|
|
|
|
class String;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MutationOfJB {
|
|
|
|
|
2018-02-25 04:14:32 +01:00
|
|
|
class Command;
|
2018-02-22 23:47:16 +01:00
|
|
|
class ConditionalCommand;
|
2018-03-09 22:42:20 +01:00
|
|
|
typedef Common::Array<Command *> Commands;
|
2018-02-22 23:47:16 +01:00
|
|
|
|
2018-03-01 23:35:24 +01:00
|
|
|
|
|
|
|
struct ActionInfo {
|
|
|
|
enum Action {
|
|
|
|
Walk,
|
|
|
|
Talk,
|
|
|
|
Look,
|
|
|
|
Use
|
|
|
|
};
|
|
|
|
|
|
|
|
Action _action;
|
|
|
|
Common::String _object1Name;
|
|
|
|
Common::String _object2Name;
|
|
|
|
bool _walkTo;
|
|
|
|
Command *_command;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef Common::Array<ActionInfo> ActionInfos;
|
|
|
|
|
2018-02-22 23:47:16 +01:00
|
|
|
class ScriptParseContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ScriptParseContext(Common::SeekableReadStream &stream);
|
|
|
|
bool readLine(Common::String &line);
|
|
|
|
void addConditionalCommand(ConditionalCommand *command, char tag);
|
2018-02-25 04:14:32 +01:00
|
|
|
void addLookSection(const Common::String & item, bool walkTo);
|
2018-02-22 23:47:16 +01:00
|
|
|
|
|
|
|
Common::SeekableReadStream &_stream;
|
2018-02-25 04:14:32 +01:00
|
|
|
Command *_currentCommand;
|
|
|
|
Command *_lastCommand;
|
2018-02-22 23:47:16 +01:00
|
|
|
|
|
|
|
struct ConditionalCommandInfo {
|
2018-02-25 04:14:32 +01:00
|
|
|
ConditionalCommand *_command;
|
|
|
|
char _tag;
|
|
|
|
};
|
|
|
|
typedef Common::Array<ConditionalCommandInfo> ConditionalCommandInfos;
|
|
|
|
|
|
|
|
ConditionalCommandInfos _pendingCondCommands;
|
|
|
|
|
2018-03-01 23:35:24 +01:00
|
|
|
ActionInfos _lookActionInfos;
|
|
|
|
ActionInfos _walkActionInfos;
|
|
|
|
ActionInfos _talkActionInfos;
|
|
|
|
ActionInfos _useActionInfos;
|
2018-02-25 04:14:32 +01:00
|
|
|
|
|
|
|
private:
|
2018-02-22 23:47:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class Script {
|
|
|
|
public:
|
|
|
|
bool loadFromStream(Common::SeekableReadStream &stream);
|
2018-02-25 04:14:32 +01:00
|
|
|
~Script();
|
2018-03-01 23:35:24 +01:00
|
|
|
|
|
|
|
const ActionInfos &getLookActionInfos() const;
|
|
|
|
const ActionInfos &getWalkActionInfos() const;
|
|
|
|
const ActionInfos &getTalkActionInfos() const;
|
|
|
|
const ActionInfos &getUseActionInfos() const;
|
|
|
|
|
2018-02-22 23:47:16 +01:00
|
|
|
private:
|
2018-02-25 04:14:32 +01:00
|
|
|
void destroy();
|
|
|
|
Commands _allCommands;
|
2018-03-01 23:35:24 +01:00
|
|
|
ActionInfos _lookActionInfos;
|
|
|
|
ActionInfos _walkActionInfos;
|
|
|
|
ActionInfos _talkActionInfos;
|
|
|
|
ActionInfos _useActionInfos;
|
2018-02-22 23:47:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|