MUTATIONOFJB: Fix code formatting issues (with astyle).
This commit is contained in:
parent
6ff609c514
commit
a25715a29b
48 changed files with 361 additions and 309 deletions
|
@ -114,7 +114,7 @@ void AnimationDecoder::loadPalette(Common::SeekableReadStream &file) {
|
|||
copyCount = PALETTE_COLORS;
|
||||
}
|
||||
|
||||
while(packets--) {
|
||||
while (packets--) {
|
||||
file.read(_palette + skipCount * 3, copyCount * 3);
|
||||
|
||||
for (int j = skipCount * 3; j < (skipCount + copyCount) * 3; ++j) {
|
||||
|
@ -145,7 +145,7 @@ void AnimationDecoder::loadFullFrame(EncryptedFile &file, uint32 size) {
|
|||
// RLE - Copy color n times.
|
||||
uint8 color = file.readByte();
|
||||
readBytes++;
|
||||
while(n--) {
|
||||
while (n--) {
|
||||
*ptr++ = color;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -26,11 +26,11 @@ namespace MutationOfJB {
|
|||
|
||||
Assets::Assets(Game &game) : _game(game), _toSayList("tosay.ger"), _responseList("response.ger") {}
|
||||
|
||||
Font& Assets::getSystemFont() {
|
||||
Font &Assets::getSystemFont() {
|
||||
return _systemFont;
|
||||
}
|
||||
|
||||
Font& Assets::getSpeechFont() {
|
||||
Font &Assets::getSpeechFont() {
|
||||
return _speechFont;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,11 @@ class Assets {
|
|||
public:
|
||||
Assets(Game &game);
|
||||
|
||||
Font& getSystemFont();
|
||||
Font& getSpeechFont();
|
||||
Font &getSystemFont();
|
||||
Font &getSpeechFont();
|
||||
|
||||
ConversationLineList& getToSayList();
|
||||
ConversationLineList& getResponseList();
|
||||
ConversationLineList &getToSayList();
|
||||
ConversationLineList &getResponseList();
|
||||
|
||||
private:
|
||||
Game &_game;
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include "mutationofjb/gamedata.h"
|
||||
#include "mutationofjb/script.h"
|
||||
|
||||
/*
|
||||
"ADDITEM" " " <item>
|
||||
|
||||
Adds item to inventory.
|
||||
*/
|
||||
/** @file
|
||||
* "ADDITEM " <item>
|
||||
*
|
||||
* Adds item to inventory.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include "mutationofjb/game.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
/*
|
||||
"_" <name>
|
||||
|
||||
Calls macro with the specified name.
|
||||
*/
|
||||
/** @file
|
||||
* "_" <name>
|
||||
*
|
||||
* Calls macro with the specified name.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
#include "mutationofjb/script.h"
|
||||
#include "common/str.h"
|
||||
|
||||
/*
|
||||
"CAMEFROM" <sceneId>
|
||||
|
||||
This command tests whether last scene (the scene player came from) is sceneId.
|
||||
If true, the execution continues after this command.
|
||||
Otherwise the execution continues after first '#' found.
|
||||
*/
|
||||
/** @file
|
||||
* "CAMEFROM" <sceneId>
|
||||
*
|
||||
* This command tests whether last scene (the scene player came from) is sceneId.
|
||||
* If true, the execution continues after this command.
|
||||
* Otherwise the execution continues after first '#' found.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -27,15 +27,21 @@
|
|||
|
||||
namespace MutationOfJB {
|
||||
|
||||
// CHANGEe rr ss ii val
|
||||
// <e> 1B Entity to change register for.
|
||||
// D door
|
||||
// O object
|
||||
// S static
|
||||
// <rr> 2B Register name.
|
||||
// <ss> 2B Scene ID.
|
||||
// <ii> 2B Entity ID.
|
||||
// <val> VL Value.
|
||||
/** @file
|
||||
* "CHANGE" <entity> " " <register> " " <sceneId> " " <entityId> " " <value>
|
||||
*
|
||||
* Changes entity register value for specified scene.
|
||||
* <entity> 1B Entity to change register for.
|
||||
* Possible values:
|
||||
* 'D' - door
|
||||
* 'O' - object
|
||||
* 'S' - static
|
||||
* '' - scene
|
||||
* <register> 2B Register name.
|
||||
* <sceneId> 2B Scene ID.
|
||||
* <entityid> 2B Entity ID.
|
||||
* <value> *B Value (variable length).
|
||||
*/
|
||||
|
||||
bool ChangeCommandParser::parseValueString(const Common::String &valueString, bool changeEntity, uint8 &sceneId, uint8 &entityId, ChangeCommand::ChangeRegister ®, ChangeCommand::ChangeOperation &op, ChangeCommandValue &ccv) {
|
||||
if (changeEntity) {
|
||||
|
@ -102,7 +108,7 @@ bool ChangeCommandParser::parseValueString(const Common::String &valueString, bo
|
|||
ccv._byteVal = parseInteger(val, op);
|
||||
} else if (valueString.hasPrefix("FR")) {
|
||||
reg = ChangeCommand::FR;
|
||||
ccv._byteVal = parseInteger(val, op);
|
||||
ccv._byteVal = parseInteger(val, op);
|
||||
} else if (valueString.hasPrefix("NA")) {
|
||||
reg = ChangeCommand::NA;
|
||||
ccv._byteVal = parseInteger(val, op);
|
||||
|
@ -234,32 +240,58 @@ int ChangeCommandParser::parseInteger(const char *val, ChangeCommand::ChangeOper
|
|||
|
||||
const char *ChangeCommand::getRegisterAsString() const {
|
||||
switch (_register) {
|
||||
case NM: return "NM";
|
||||
case LT: return "LT";
|
||||
case SX: return "SX";
|
||||
case SY: return "SY";
|
||||
case XX: return "XX";
|
||||
case YY: return "YY";
|
||||
case XL: return "XL";
|
||||
case YL: return "YL";
|
||||
case WX: return "WX";
|
||||
case WY: return "WY";
|
||||
case SP: return "SP";
|
||||
case AC: return "AC";
|
||||
case FA: return "FA";
|
||||
case FR: return "FR";
|
||||
case NA: return "NA";
|
||||
case FS: return "FS";
|
||||
case CA: return "CA";
|
||||
case DS: return "DS";
|
||||
case DL: return "DL";
|
||||
case ND: return "ND";
|
||||
case NO: return "NO";
|
||||
case NS: return "NS";
|
||||
case PF: return "PF";
|
||||
case PL: return "PL";
|
||||
case PD: return "PD";
|
||||
default: return "(unknown)";
|
||||
case NM:
|
||||
return "NM";
|
||||
case LT:
|
||||
return "LT";
|
||||
case SX:
|
||||
return "SX";
|
||||
case SY:
|
||||
return "SY";
|
||||
case XX:
|
||||
return "XX";
|
||||
case YY:
|
||||
return "YY";
|
||||
case XL:
|
||||
return "XL";
|
||||
case YL:
|
||||
return "YL";
|
||||
case WX:
|
||||
return "WX";
|
||||
case WY:
|
||||
return "WY";
|
||||
case SP:
|
||||
return "SP";
|
||||
case AC:
|
||||
return "AC";
|
||||
case FA:
|
||||
return "FA";
|
||||
case FR:
|
||||
return "FR";
|
||||
case NA:
|
||||
return "NA";
|
||||
case FS:
|
||||
return "FS";
|
||||
case CA:
|
||||
return "CA";
|
||||
case DS:
|
||||
return "DS";
|
||||
case DL:
|
||||
return "DL";
|
||||
case ND:
|
||||
return "ND";
|
||||
case NO:
|
||||
return "NO";
|
||||
case NS:
|
||||
return "NS";
|
||||
case PF:
|
||||
return "PF";
|
||||
case PL:
|
||||
return "PL";
|
||||
case PD:
|
||||
return "PD";
|
||||
default:
|
||||
return "(unknown)";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
YL, // Height
|
||||
WX, // Walk to X
|
||||
WY, // Walk to Y
|
||||
SP, //
|
||||
SP, //
|
||||
AC, // Active
|
||||
FA, // First animation
|
||||
FR,
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
SubtractValue
|
||||
};
|
||||
|
||||
ChangeCommand(uint8 sceneId, uint8 entityId, ChangeRegister reg, ChangeOperation op, const ChangeCommandValue& val) :
|
||||
ChangeCommand(uint8 sceneId, uint8 entityId, ChangeRegister reg, ChangeOperation op, const ChangeCommandValue &val) :
|
||||
_sceneId(sceneId), _entityId(entityId), _register(reg), _operation(op), _value(val)
|
||||
{}
|
||||
protected:
|
||||
|
|
|
@ -50,7 +50,7 @@ bool DefineStructCommandParser::parse(const Common::String &line, ScriptParseCon
|
|||
continue;
|
||||
}
|
||||
|
||||
const char* linePtr = convLineStr.c_str();
|
||||
const char *linePtr = convLineStr.c_str();
|
||||
|
||||
ConversationInfo::Line convLine;
|
||||
|
||||
|
|
|
@ -27,29 +27,29 @@
|
|||
#include "common/debug.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
/*
|
||||
("#L " | "-L ") <object>
|
||||
("#W " | "-W ") <object>
|
||||
("#T " | "-T ") <object>
|
||||
("#P " | "-P ") <object1>
|
||||
("#U " | "-U ") <object1> [<object2>]
|
||||
("#ELSE" | "-ELSE") [<tag>]
|
||||
"#MACRO " <name>
|
||||
"#EXTRA" <name>
|
||||
|
||||
If a line starts with '#', '=', '-', it is treated as the end of a section.
|
||||
However, at the same time it can also start a new section depending on what follows.
|
||||
|
||||
#L (look), #W (walk), #T (talk), #U (use) sections are executed
|
||||
when the user starts corresponding action on the object or in case of "use" up to two objects.
|
||||
The difference between '#' and '-' version is whether the player walks towards the object ('#') or not ('-').
|
||||
|
||||
#ELSE is used by conditional commands (see comments for IfCommand and others).
|
||||
|
||||
#MACRO starts a new macro. Global script can call macros from local script and vice versa.
|
||||
|
||||
#EXTRA defines an "extra" section. This is called from dialog responses ("TALK TO HIM" command).
|
||||
*/
|
||||
/** @file
|
||||
* ("#L " | "-L ") <object>
|
||||
* ("#W " | "-W ") <object>
|
||||
* ("#T " | "-T ") <object>
|
||||
* ("#P " | "-P ") <object1>
|
||||
* ("#U " | "-U ") <object1> [<object2>]
|
||||
* ("#ELSE" | "-ELSE") [<tag>]
|
||||
* "#MACRO " <name>
|
||||
* "#EXTRA" <name>
|
||||
*
|
||||
* If a line starts with '#', '=', '-', it is treated as the end of a section.
|
||||
* However, at the same time it can also start a new section depending on what follows.
|
||||
*
|
||||
* #L (look), #W (walk), #T (talk), #U (use) sections are executed
|
||||
* when the user starts corresponding action on the object or in case of "use" up to two objects.
|
||||
* The difference between '#' and '-' version is whether the player walks towards the object ('#') or not ('-').
|
||||
*
|
||||
* #ELSE is used by conditional commands (see comments for IfCommand and others).
|
||||
*
|
||||
* #MACRO starts a new macro. Global script can call macros from local script and vice versa.
|
||||
*
|
||||
* #EXTRA defines an "extra" section. This is called from dialog responses ("TALK TO HIM" command).
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include "mutationofjb/gamedata.h"
|
||||
#include "mutationofjb/script.h"
|
||||
|
||||
/*
|
||||
"GOTO " <label>
|
||||
|
||||
Jumps to a label.
|
||||
*/
|
||||
/** @file
|
||||
* "GOTO " <label>
|
||||
*
|
||||
* Jumps to a label.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -26,24 +26,24 @@
|
|||
#include "common/str.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
/*
|
||||
"IF" <tag> <sceneId> <objectId> <value> ["!"]
|
||||
|
||||
IF command compares the value of the WX pseudo-register of the object in the specified scene.
|
||||
If the values match, execution continues to the next line.
|
||||
Otherwise execution continues after first "#ELSE" or "=ELSE" with the same <tag>.
|
||||
The logic can be reversed with exclamation mark at the end.
|
||||
|
||||
<tag> is always 1 character long, <sceneId> and <objectId> 2 characters long.
|
||||
|
||||
Please note that this does not work like you are used to from saner languages.
|
||||
IF does not have any blocks. It only searches for first #ELSE, so you can have stuff like:
|
||||
IF something
|
||||
IF something else
|
||||
#ELSE
|
||||
...
|
||||
This is effectively logical AND.
|
||||
*/
|
||||
/** @file
|
||||
* "IF" <tag> <sceneId> <objectId> <value> ["!"]
|
||||
*
|
||||
* IF command compares the value of the WX pseudo-register of the object in the specified scene.
|
||||
* If the values match, execution continues to the next line.
|
||||
* Otherwise execution continues after first "#ELSE" or "=ELSE" with the same <tag>.
|
||||
* The logic can be reversed with exclamation mark at the end.
|
||||
*
|
||||
* <tag> is always 1 character long, <sceneId> and <objectId> 2 characters long.
|
||||
*
|
||||
* Please note that this does not work like you are used to from saner languages.
|
||||
* IF does not have any blocks. It only searches for first #ELSE, so you can have stuff like:
|
||||
* IF something
|
||||
* IF something else
|
||||
* #ELSE
|
||||
* ...
|
||||
* This is effectively logical AND.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
@ -58,7 +58,7 @@ bool IfCommandParser::parse(const Common::String &line, ScriptParseContext &, Co
|
|||
if (line.size() < 10) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!line.hasPrefix("IF")) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
class IfCommand : public ConditionalCommand {
|
||||
public:
|
||||
IfCommand(uint8 sceneId, uint8 objectId, uint16 value, bool negative);
|
||||
|
||||
|
||||
virtual ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
|
||||
virtual Common::String debugString() const;
|
||||
|
||||
|
|
|
@ -27,22 +27,22 @@
|
|||
#include "common/str.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
/*
|
||||
"IFITEM" <item> ["!"]
|
||||
|
||||
IFITEM command tests whether an item is in the inventory.
|
||||
If it is, execution continues to the next line.
|
||||
Otherwise execution continues after first "#ELSE" or "=ELSE".
|
||||
The logic can be reversed with exclamation mark at the end.
|
||||
|
||||
Please note that this does not work like you are used to from saner languages.
|
||||
IFITEM does not have any blocks. It only searches for first #ELSE, so you can have stuff like:
|
||||
IFITEM item1
|
||||
IFITEM item2
|
||||
#ELSE
|
||||
...
|
||||
This is effectively logical AND.
|
||||
*/
|
||||
/** @file
|
||||
* "IFITEM" <item> ["!"]
|
||||
*
|
||||
* IFITEM command tests whether an item is in the inventory.
|
||||
* If it is, execution continues to the next line.
|
||||
* Otherwise execution continues after first "#ELSE" or "=ELSE".
|
||||
* The logic can be reversed with exclamation mark at the end.
|
||||
*
|
||||
* Please note that this does not work like you are used to from saner languages.
|
||||
* IFITEM does not have any blocks. It only searches for first #ELSE, so you can have stuff like:
|
||||
* IFITEM item1
|
||||
* IFITEM item2
|
||||
* #ELSE
|
||||
* ...
|
||||
* This is effectively logical AND.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
@ -50,7 +50,7 @@ bool IfItemCommandParser::parse(const Common::String &line, ScriptParseContext &
|
|||
if (line.size() < 8) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!line.hasPrefix("IFITEM")) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
class IfItemCommand : public ConditionalCommand {
|
||||
public:
|
||||
IfItemCommand(const Common::String &item, bool negative);
|
||||
|
||||
|
||||
virtual ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
|
||||
virtual Common::String debugString() const;
|
||||
|
||||
|
|
|
@ -27,21 +27,21 @@
|
|||
#include "common/str.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
/*
|
||||
"IFPIGGY"
|
||||
|
||||
IFPIGGY command tests whether current loaded APK file (character animation) is "piggy.apk".
|
||||
If it is, execution continues to the next line.
|
||||
Otherwise execution continues after first "#ELSE" or "=ELSE".
|
||||
|
||||
Please note that this does not work like you are used to from saner languages.
|
||||
IFPIGGY does not have any blocks. It only searches for first #ELSE, so you can have stuff like:
|
||||
IFPIGGY
|
||||
IFITEM someitem
|
||||
#ELSE
|
||||
...
|
||||
This is effectively logical AND.
|
||||
*/
|
||||
/** @file
|
||||
* "IFPIGGY"
|
||||
*
|
||||
* IFPIGGY command tests whether current loaded APK file (character animation) is "piggy.apk".
|
||||
* If it is, execution continues to the next line.
|
||||
* Otherwise execution continues after first "#ELSE" or "=ELSE".
|
||||
*
|
||||
* Please note that this does not work like you are used to from saner languages.
|
||||
* IFPIGGY does not have any blocks. It only searches for first #ELSE, so you can have stuff like:
|
||||
* IFPIGGY
|
||||
* IFITEM someitem
|
||||
* #ELSE
|
||||
* ...
|
||||
* This is effectively logical AND.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include "mutationofjb/commands/gotocommand.h"
|
||||
#include "mutationofjb/script.h"
|
||||
|
||||
/*
|
||||
<label> ":"
|
||||
|
||||
Creates a label.
|
||||
*/
|
||||
/** @file
|
||||
* <label> ":"
|
||||
*
|
||||
* Creates a label.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
@ -59,8 +59,7 @@ bool LabelCommandParser::parse(const Common::String &line, ScriptParseContext &p
|
|||
return true;
|
||||
}
|
||||
|
||||
const Common::String &LabelCommand::getName() const
|
||||
{
|
||||
const Common::String &LabelCommand::getName() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,15 +26,15 @@
|
|||
#include "mutationofjb/gamedata.h"
|
||||
#include "common/str.h"
|
||||
|
||||
/*
|
||||
"NEWROOM " <sceneId> " " <x> " " <y> " " <frame>
|
||||
|
||||
NEWROOM changes the current scene. While doing that, it also executes STARTUP section for the new room.
|
||||
However, after that, the execution goes back to the old script to finish commands after NEWROOM.
|
||||
|
||||
All parameters are supposed to be 3 characters long.
|
||||
SceneId is the scene to load, x and y are the player's new position and frame is the player's new frame (orientation).
|
||||
*/
|
||||
/** @file
|
||||
* "NEWROOM " <sceneId> " " <x> " " <y> " " <frame>
|
||||
*
|
||||
* NEWROOM changes the current scene. While doing that, it also executes STARTUP section for the new room.
|
||||
* However, after that, the execution goes back to the old script to finish commands after NEWROOM.
|
||||
*
|
||||
* All parameters are supposed to be 3 characters long.
|
||||
* SceneId is the scene to load, x and y are the player's new position and frame is the player's new frame (orientation).
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
@ -62,7 +62,7 @@ Command::ExecuteResult NewRoomCommand::execute(ScriptExecutionContext &scriptExe
|
|||
if (!_innerExecCtx) {
|
||||
Script *newScript = game.changeSceneDelayScript(_sceneId, game.getGameData()._partB);
|
||||
_innerExecCtx = new ScriptExecutionContext(scriptExecCtx.getGame(), newScript);
|
||||
res =_innerExecCtx->startStartupSection();
|
||||
res = _innerExecCtx->startStartupSection();
|
||||
} else {
|
||||
res = _innerExecCtx->runActiveCommand();
|
||||
}
|
||||
|
|
|
@ -28,16 +28,16 @@
|
|||
#include "common/random.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
/*
|
||||
"RANDOM " <numChoices>
|
||||
|
||||
RANDOM command randomly picks one of the command blocks that
|
||||
follow it and jumps to its start.
|
||||
|
||||
These blocks start with "/" and end with "\". The end of a random
|
||||
block also ends the current section. The number of blocks must
|
||||
match numChoices.
|
||||
*/
|
||||
/** @file
|
||||
* "RANDOM " <numChoices>
|
||||
*
|
||||
* RANDOM command randomly picks one of the command blocks that
|
||||
* follow it and jumps to its start.
|
||||
*
|
||||
* These blocks start with "/" and end with "\". The end of a random
|
||||
* block also ends the current section. The number of blocks must
|
||||
* match numChoices.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
@ -86,8 +86,7 @@ void RandomBlockStartParser::transition(ScriptParseContext &parseCtx, Command *,
|
|||
|
||||
RandomCommand::RandomCommand(uint numChoices)
|
||||
: _numChoices(numChoices),
|
||||
_chosenNext(nullptr)
|
||||
{
|
||||
_chosenNext(nullptr) {
|
||||
_choices.reserve(numChoices);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include "mutationofjb/script.h"
|
||||
#include "mutationofjb/gamedata.h"
|
||||
|
||||
/*
|
||||
"DELALLITEMS"
|
||||
|
||||
Removes all items from inventory.
|
||||
*/
|
||||
/** @file
|
||||
* "DELALLITEMS"
|
||||
*
|
||||
* Removes all items from inventory.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include "mutationofjb/script.h"
|
||||
#include "mutationofjb/gamedata.h"
|
||||
|
||||
/*
|
||||
"DELITEM" " " <item>
|
||||
|
||||
Removes item from inventory.
|
||||
*/
|
||||
/** @file
|
||||
* "DELITEM" " " <item>
|
||||
*
|
||||
* Removes item from inventory.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@
|
|||
#include "mutationofjb/gamedata.h"
|
||||
#include "common/algorithm.h"
|
||||
|
||||
/*
|
||||
"REN " <oldName> " " <newName>
|
||||
Renames every door, static (in the current scene) and inventory item
|
||||
with the name oldName to newName.
|
||||
*/
|
||||
/** @file
|
||||
* "REN " <oldName> " " <newName>
|
||||
*
|
||||
* Renames every door, static (in the current scene) and inventory item
|
||||
* with the name oldName to newName.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
|
|
@ -32,27 +32,27 @@
|
|||
#include "common/debug.h"
|
||||
#include "common/debug-channels.h"
|
||||
|
||||
/*
|
||||
("SM" | "SLM" | "NM" | "NLM") " " <lineToSay> ["<" <voiceFile> | "<!"]
|
||||
<skipped> " " <lineToSay> ("<" <voiceFile> | "<!")
|
||||
|
||||
Say command comes in four variants: SM, SLM, NM and NLM.
|
||||
Note: In script files, they are usually written as *SM.
|
||||
The asterisk is ignored by the readLine function.
|
||||
|
||||
Each of them plays a voice file (if present) and/or shows a message
|
||||
(if voice file not present or subtitles are enabled).
|
||||
|
||||
The difference between versions starting with "S" and "N" is that
|
||||
the "N" version does not show talking animation.
|
||||
|
||||
The "L" versions are "blocking", i.e. they wait for the previous say command to finish.
|
||||
|
||||
If the line ends with "<!", it means the message continues to the next line.
|
||||
Next line usually has "SM" (or other variant) repeated, but it does not have to.
|
||||
Then we have the rest of the string to say (which is concatenated with the previous line)
|
||||
and possibly the voice file or "<!" again.
|
||||
*/
|
||||
/** @file
|
||||
* ("SM" | "SLM" | "NM" | "NLM") " " <lineToSay> ["<" <voiceFile> | "<!"]
|
||||
* <skipped> " " <lineToSay> ("<" <voiceFile> | "<!")
|
||||
*
|
||||
* Say command comes in four variants: SM, SLM, NM and NLM.
|
||||
* Note: In script files, they are usually written as *SM.
|
||||
* The asterisk is ignored by the readLine function.
|
||||
*
|
||||
* Each of them plays a voice file (if present) and/or shows a message
|
||||
* (if voice file not present or subtitles are enabled).
|
||||
*
|
||||
* The difference between versions starting with "S" and "N" is that
|
||||
* the "N" version does not show talking animation.
|
||||
*
|
||||
* The "L" versions are "blocking", i.e. they wait for the previous say command to finish.
|
||||
*
|
||||
* If the line ends with "<!", it means the message continues to the next line.
|
||||
* Next line usually has "SM" (or other variant) repeated, but it does not have to.
|
||||
* Then we have the rest of the string to say (which is concatenated with the previous line)
|
||||
* and possibly the voice file or "<!" again.
|
||||
*/
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
|
@ -113,7 +113,7 @@ bool SayCommandParser::parse(const Common::String &line, ScriptParseContext &par
|
|||
Common::String talkStr(currentLine.c_str() + startPos, endPos - startPos);
|
||||
|
||||
if (endPos != currentLine.size()) {
|
||||
const char * end = currentLine.c_str() + endPos + 1;
|
||||
const char *end = currentLine.c_str() + endPos + 1;
|
||||
if (end[0] == '!') {
|
||||
cont = true;
|
||||
} else {
|
||||
|
|
|
@ -34,8 +34,7 @@ void SeqCommandParser::transition(ScriptParseContext &, Command *oldCommand, Com
|
|||
static_cast<SeqCommand *>(oldCommand)->setNextCommand(newCommand);
|
||||
}
|
||||
|
||||
void SeqCommand::setNextCommand(Command *nextCommand)
|
||||
{
|
||||
void SeqCommand::setNextCommand(Command *nextCommand) {
|
||||
_nextCommand = nextCommand;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#ifndef MUTATIONOFJB_SEQCOMMAND_H
|
||||
#define MUTATIONOFJB_SEQCOMMAND_H
|
||||
#define MUTATIONOFJB_SEQCOMMAND_H
|
||||
|
||||
#include "mutationofjb/commands/command.h"
|
||||
#include "common/scummsys.h"
|
||||
|
|
|
@ -70,7 +70,7 @@ Command::ExecuteResult TalkCommand::execute(ScriptExecutionContext &scriptExeCtx
|
|||
}
|
||||
|
||||
Common::String TalkCommand::debugString() const {
|
||||
const char * modes[] = {"NORMAL", "RAY_AND_BUTTLEG", "CARNIVAL_TICKET_SELLER"};
|
||||
const char *modes[] = {"NORMAL", "RAY_AND_BUTTLEG", "CARNIVAL_TICKET_SELLER"};
|
||||
return Common::String::format("TALK %s", modes[(int) _mode]);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,15 @@ public:
|
|||
Common::String _text;
|
||||
Common::String _voiceFile;
|
||||
|
||||
bool isRepeating() const { return _text.firstChar() == '*'; }
|
||||
bool isFirstSpeaker() const { return _text.firstChar() == '~'; }
|
||||
bool isSecondSpeaker() const { return _text.firstChar() == '`'; }
|
||||
bool isRepeating() const {
|
||||
return _text.firstChar() == '*';
|
||||
}
|
||||
bool isFirstSpeaker() const {
|
||||
return _text.firstChar() == '~';
|
||||
}
|
||||
bool isSecondSpeaker() const {
|
||||
return _text.firstChar() == '`';
|
||||
}
|
||||
};
|
||||
|
||||
typedef Common::Array<Speech> Speeches;
|
||||
|
|
|
@ -42,7 +42,7 @@ static Common::String convertToASCII(const Common::String &str) {
|
|||
static const char conversionTable[] = {
|
||||
'C', 'u', 'e', 'd', 'a', 'D', 'T', 'c', 'e', 'E', 'L', 'I', 'l', 'l', 'A', 'A', /* 0x80-0x8F */
|
||||
'E', 'z', 'Z', 'o', 'o', 'O', 'u', 'U', 'y', 'O', 'U', 'S', 'L', 'Y', 'R', 't', /* 0x90-0x9F */
|
||||
'a', 'i', 'o', 'u', 'n', 'N', 'U', 'O', 's', 'r', 'r', 'R' /* 0xA0-0xAB */
|
||||
'a', 'i', 'o', 'u', 'n', 'N', 'U', 'O', 's', 'r', 'r', 'R' /* 0xA0-0xAB */
|
||||
};
|
||||
|
||||
Common::String ret = str;
|
||||
|
@ -151,9 +151,9 @@ void Console::showCommands(Command *command, int indentLevel) {
|
|||
debugPrintf("ELSE\n");
|
||||
showCommands(condCmd->getFalseCommand(), indentLevel + 1);
|
||||
command = nullptr;
|
||||
} else if (CallMacroCommand* const callMacroCmd = dynamic_cast<CallMacroCommand *>(command)) {
|
||||
} else if (CallMacroCommand *const callMacroCmd = dynamic_cast<CallMacroCommand *>(command)) {
|
||||
command = callMacroCmd->getReturnCommand();
|
||||
} else if (RandomCommand* const randomCmd = dynamic_cast<RandomCommand *>(command)) {
|
||||
} else if (RandomCommand *const randomCmd = dynamic_cast<RandomCommand *>(command)) {
|
||||
const RandomCommand::Choices &choices = randomCmd->getChoices();
|
||||
for (RandomCommand::Choices::size_type i = 0; i < choices.size(); ++i) {
|
||||
showIndent(indentLevel + 1);
|
||||
|
@ -450,7 +450,7 @@ Script *Console::getScriptFromArg(const char *arg) {
|
|||
}
|
||||
|
||||
bool Console::cmd_listinventory(int, const char **) {
|
||||
Inventory &inventory =_vm->getGame().getGameData().getInventory();
|
||||
Inventory &inventory = _vm->getGame().getGameData().getInventory();
|
||||
const Inventory::Items &items = inventory.getItems();
|
||||
for (Inventory::Items::const_iterator it = items.begin(); it != items.end(); ++it) {
|
||||
debugPrintf("%s\n", convertToASCII(*it).c_str());
|
||||
|
|
|
@ -23,34 +23,34 @@
|
|||
#include "encryptedfile.h"
|
||||
|
||||
static const uint8 XOR_TABLE[] = {
|
||||
0x41, 0x2b, 0x7a, 0x0c, 0xc8, 0xe5, 0x0c, 0xde, 0x45, 0xa8, 0x00, 0xad,
|
||||
0x70, 0xac, 0x23, 0xe0, 0x0c, 0xde, 0xac, 0x16, 0xa1, 0x1a, 0x70, 0x17,
|
||||
0x1b, 0x90, 0x34, 0x6e, 0x53, 0xfe, 0xdd, 0x3c, 0xef, 0x74, 0x75, 0x3e,
|
||||
0x2e, 0xb0, 0x3d, 0x2b, 0x74, 0x6d, 0x59, 0xde, 0xc6, 0x20, 0xb8, 0xf3,
|
||||
0x7d, 0xfa, 0x4d, 0xbd, 0xdb, 0x3c, 0xc5, 0xcb, 0x57, 0x13, 0x40, 0x6b,
|
||||
0xb8, 0xad, 0xb9, 0xc1, 0x6a, 0x37, 0x39, 0x80, 0x94, 0xd3, 0xdf, 0x4b,
|
||||
0xe4, 0xe4, 0x7a, 0x4c, 0x0f, 0x21, 0x27, 0x9a, 0x7e, 0x52, 0x35, 0x58,
|
||||
0xb4, 0xbc, 0x5a, 0xc9, 0x48, 0x7f, 0xcc, 0xb6, 0x97, 0x7b, 0xf1, 0xd5,
|
||||
0x88, 0x8c, 0xa9, 0x27, 0xf7, 0x20, 0x68, 0x65, 0xad, 0x6f, 0x9e, 0x07,
|
||||
0xf8, 0xf6, 0x2c, 0x65, 0x4a, 0xe9, 0xd8, 0x13, 0x6a, 0xb5, 0x14, 0x6f,
|
||||
0x29, 0xdc, 0x68, 0xf8, 0xa0, 0xb6, 0x73, 0x03, 0x69, 0xe3, 0x4f, 0xb6,
|
||||
0x59, 0x79, 0xae, 0x93, 0xad, 0x40, 0x27, 0xd0, 0xb5, 0x7a, 0x68, 0x5d,
|
||||
0x5e, 0x19, 0x53, 0x4f, 0x40, 0x56, 0x3d, 0x10, 0xf8, 0x0a, 0xc6, 0x90,
|
||||
0x06, 0x45, 0x13, 0x4a, 0x6a, 0xfe, 0x56, 0xeb, 0xbc, 0xd9, 0xee, 0xe0,
|
||||
0x85, 0x5e, 0x98, 0x23, 0xf9, 0x19, 0x60, 0xf9, 0x7e, 0x8d, 0x61, 0xa0,
|
||||
0x7c, 0xe1, 0x84, 0xf2, 0x7a, 0xb8, 0xbe, 0x8e, 0x81, 0x9e, 0x87, 0x20,
|
||||
0x32, 0xf3, 0x8c, 0xb4, 0x2c, 0x4d, 0xc8, 0x50, 0x9b, 0xa5, 0x9c, 0x27,
|
||||
0x02, 0xd6, 0x7f, 0x2a, 0xaf, 0x46, 0x65, 0xd0, 0x6a, 0xae, 0xfa, 0x53,
|
||||
0x37, 0x6c, 0x49, 0xb9, 0x4d, 0xcd, 0x6c, 0x6b, 0xa7, 0x2d, 0x66, 0x32,
|
||||
0xb4, 0xf5, 0x41, 0xd5, 0x18, 0xc4, 0xfd, 0xbe, 0x8a, 0x47, 0x11, 0x50,
|
||||
0x3d, 0x97, 0x64, 0xda, 0x5a, 0x27, 0x18, 0x60, 0x78, 0x80, 0x86, 0x8a,
|
||||
0x2a, 0x72, 0x40, 0x89
|
||||
0x41, 0x2b, 0x7a, 0x0c, 0xc8, 0xe5, 0x0c, 0xde, 0x45, 0xa8, 0x00, 0xad,
|
||||
0x70, 0xac, 0x23, 0xe0, 0x0c, 0xde, 0xac, 0x16, 0xa1, 0x1a, 0x70, 0x17,
|
||||
0x1b, 0x90, 0x34, 0x6e, 0x53, 0xfe, 0xdd, 0x3c, 0xef, 0x74, 0x75, 0x3e,
|
||||
0x2e, 0xb0, 0x3d, 0x2b, 0x74, 0x6d, 0x59, 0xde, 0xc6, 0x20, 0xb8, 0xf3,
|
||||
0x7d, 0xfa, 0x4d, 0xbd, 0xdb, 0x3c, 0xc5, 0xcb, 0x57, 0x13, 0x40, 0x6b,
|
||||
0xb8, 0xad, 0xb9, 0xc1, 0x6a, 0x37, 0x39, 0x80, 0x94, 0xd3, 0xdf, 0x4b,
|
||||
0xe4, 0xe4, 0x7a, 0x4c, 0x0f, 0x21, 0x27, 0x9a, 0x7e, 0x52, 0x35, 0x58,
|
||||
0xb4, 0xbc, 0x5a, 0xc9, 0x48, 0x7f, 0xcc, 0xb6, 0x97, 0x7b, 0xf1, 0xd5,
|
||||
0x88, 0x8c, 0xa9, 0x27, 0xf7, 0x20, 0x68, 0x65, 0xad, 0x6f, 0x9e, 0x07,
|
||||
0xf8, 0xf6, 0x2c, 0x65, 0x4a, 0xe9, 0xd8, 0x13, 0x6a, 0xb5, 0x14, 0x6f,
|
||||
0x29, 0xdc, 0x68, 0xf8, 0xa0, 0xb6, 0x73, 0x03, 0x69, 0xe3, 0x4f, 0xb6,
|
||||
0x59, 0x79, 0xae, 0x93, 0xad, 0x40, 0x27, 0xd0, 0xb5, 0x7a, 0x68, 0x5d,
|
||||
0x5e, 0x19, 0x53, 0x4f, 0x40, 0x56, 0x3d, 0x10, 0xf8, 0x0a, 0xc6, 0x90,
|
||||
0x06, 0x45, 0x13, 0x4a, 0x6a, 0xfe, 0x56, 0xeb, 0xbc, 0xd9, 0xee, 0xe0,
|
||||
0x85, 0x5e, 0x98, 0x23, 0xf9, 0x19, 0x60, 0xf9, 0x7e, 0x8d, 0x61, 0xa0,
|
||||
0x7c, 0xe1, 0x84, 0xf2, 0x7a, 0xb8, 0xbe, 0x8e, 0x81, 0x9e, 0x87, 0x20,
|
||||
0x32, 0xf3, 0x8c, 0xb4, 0x2c, 0x4d, 0xc8, 0x50, 0x9b, 0xa5, 0x9c, 0x27,
|
||||
0x02, 0xd6, 0x7f, 0x2a, 0xaf, 0x46, 0x65, 0xd0, 0x6a, 0xae, 0xfa, 0x53,
|
||||
0x37, 0x6c, 0x49, 0xb9, 0x4d, 0xcd, 0x6c, 0x6b, 0xa7, 0x2d, 0x66, 0x32,
|
||||
0xb4, 0xf5, 0x41, 0xd5, 0x18, 0xc4, 0xfd, 0xbe, 0x8a, 0x47, 0x11, 0x50,
|
||||
0x3d, 0x97, 0x64, 0xda, 0x5a, 0x27, 0x18, 0x60, 0x78, 0x80, 0x86, 0x8a,
|
||||
0x2a, 0x72, 0x40, 0x89
|
||||
};
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
uint32 EncryptedFile::read(void *dataPtr, uint32 dataSize) {
|
||||
uint8 xorPos = pos() % 256;
|
||||
uint8 xorPos = static_cast<uint8>(pos() % ARRAYSIZE(XOR_TABLE));
|
||||
const uint32 readBytes = Common::File::read(dataPtr, dataSize);
|
||||
|
||||
for (uint32 i = 0; i < readBytes; ++i) {
|
||||
|
|
|
@ -39,13 +39,13 @@ namespace MutationOfJB {
|
|||
|
||||
Game::Game(MutationOfJBEngine *vm)
|
||||
: _vm(vm),
|
||||
_randomSource("mutationofjb"),
|
||||
_delayedLocalScript(nullptr),
|
||||
_gui(*this, _vm->getScreen()),
|
||||
_currentAction(ActionInfo::Walk),
|
||||
_scriptExecCtx(*this),
|
||||
_taskManager(*this),
|
||||
_assets(*this) {
|
||||
_randomSource("mutationofjb"),
|
||||
_delayedLocalScript(nullptr),
|
||||
_gui(*this, _vm->getScreen()),
|
||||
_currentAction(ActionInfo::Walk),
|
||||
_scriptExecCtx(*this),
|
||||
_taskManager(*this),
|
||||
_assets(*this) {
|
||||
|
||||
_gameData = new GameData;
|
||||
loadGameData(false);
|
||||
|
|
|
@ -245,11 +245,10 @@ bool Scene::isChoiceExhausted(uint8 context, uint8 choiceIndex, uint8 choiceList
|
|||
|
||||
GameData::GameData()
|
||||
: _currentScene(0),
|
||||
_lastScene(0),
|
||||
_partB(false),
|
||||
_inventory(),
|
||||
_color(WHITE)
|
||||
{}
|
||||
_lastScene(0),
|
||||
_partB(false),
|
||||
_inventory(),
|
||||
_color(WHITE) {}
|
||||
|
||||
Scene *GameData::getScene(uint8 sceneId) {
|
||||
if (sceneId == 0 || sceneId > ARRAYSIZE(_scenes)) {
|
||||
|
|
|
@ -235,9 +235,15 @@ struct ExhaustedChoice {
|
|||
*/
|
||||
uint8 _encodedData;
|
||||
|
||||
uint8 getContext() const { return (_encodedData >> 7) & 0x1; }
|
||||
uint8 getChoiceIndex() const { return (_encodedData >> 4) & 0x7; }
|
||||
uint8 getChoiceListIndex() const { return _encodedData & 0xF; }
|
||||
uint8 getContext() const {
|
||||
return (_encodedData >> 7) & 0x1;
|
||||
}
|
||||
uint8 getChoiceIndex() const {
|
||||
return (_encodedData >> 4) & 0x7;
|
||||
}
|
||||
uint8 getChoiceListIndex() const {
|
||||
return _encodedData & 0xF;
|
||||
}
|
||||
|
||||
ExhaustedChoice() : _encodedData(0) {}
|
||||
ExhaustedChoice(uint8 context, uint8 choiceIndex, uint8 choiceListIndex) :
|
||||
|
|
|
@ -64,7 +64,7 @@ enum {
|
|||
|
||||
Gui::Gui(Game &game, Graphics::Screen *screen)
|
||||
: _game(game),
|
||||
_screen(screen) {}
|
||||
_screen(screen) {}
|
||||
|
||||
Gui::~Gui() {
|
||||
for (Common::Array<Widget *>::iterator it = _widgets.begin(); it != _widgets.end(); ++it) {
|
||||
|
@ -122,7 +122,7 @@ bool Gui::init() {
|
|||
}
|
||||
|
||||
const Common::Rect conversationRect(CONVERSATION_X, CONVERSATION_Y, CONVERSATION_X + CONVERSATION_WIDTH, CONVERSATION_Y + CONVERSATION_HEIGHT);
|
||||
const Graphics::Surface conversationSurface =_hudSurfaces[2].getSubArea(conversationRect);
|
||||
const Graphics::Surface conversationSurface = _hudSurfaces[2].getSubArea(conversationRect);
|
||||
_conversationWidget = new ConversationWidget(*this, conversationRect, conversationSurface);
|
||||
_conversationWidget->setVisible(false);
|
||||
_widgets.push_back(_conversationWidget);
|
||||
|
@ -154,7 +154,7 @@ void Gui::update() {
|
|||
}
|
||||
}
|
||||
|
||||
ConversationWidget& Gui::getConversationWidget() {
|
||||
ConversationWidget &Gui::getConversationWidget() {
|
||||
return *_conversationWidget;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
virtual void onInventoryChanged() override;
|
||||
virtual void onButtonClicked(ButtonWidget *) override;
|
||||
|
||||
ConversationWidget& getConversationWidget();
|
||||
ConversationWidget &getConversationWidget();
|
||||
|
||||
private:
|
||||
bool loadInventoryGfx();
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
namespace MutationOfJB {
|
||||
|
||||
MutationOfJBEngine::MutationOfJBEngine(OSystem *syst)
|
||||
: Engine(syst),
|
||||
_console(nullptr),
|
||||
_screen(nullptr),
|
||||
_mapObjectId(0),
|
||||
_cursorState(CURSOR_IDLE) {
|
||||
: Engine(syst),
|
||||
_console(nullptr),
|
||||
_screen(nullptr),
|
||||
_mapObjectId(0),
|
||||
_cursorState(CURSOR_IDLE) {
|
||||
debug("MutationOfJBEngine::MutationOfJBEngine");
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ void MutationOfJBEngine::handleMapScene(const Common::Event &event) {
|
|||
const int16 y = event.mouse.y;
|
||||
|
||||
int index = 0;
|
||||
if (Bitmap *const bitmap = scene->findBitmap(x, y, &index)) {
|
||||
if (Bitmap *const bitmap = scene->findBitmap(x, y, &index)) {
|
||||
Static *const stat = scene->getStatic(index);
|
||||
if (stat && stat->_active == 1) {
|
||||
_game->startActionSection(ActionInfo::Walk, stat->_name);
|
||||
|
@ -188,7 +188,7 @@ void MutationOfJBEngine::handleMapScene(const Common::Event &event) {
|
|||
|
||||
int index = 0;
|
||||
bool found = false;
|
||||
if (Bitmap *const bitmap = scene->findBitmap(x, y, &index)) {
|
||||
if (Bitmap *const bitmap = scene->findBitmap(x, y, &index)) {
|
||||
Static *const stat = scene->getStatic(index);
|
||||
if (stat && stat->_active == 1) {
|
||||
Object *const object = scene->getObject(index);
|
||||
|
|
|
@ -103,7 +103,7 @@ bool ScriptParseContext::readLine(Common::String &line) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
} while(!_stream.eos());
|
||||
} while (!_stream.eos());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#ifndef MUTATIONOFJB_SCRIPT_H
|
||||
#define MUTATIONOFJB_SCRIPT_H
|
||||
#define MUTATIONOFJB_SCRIPT_H
|
||||
|
||||
#include "mutationofjb/commands/command.h"
|
||||
#include "common/array.h"
|
||||
|
|
|
@ -61,7 +61,7 @@ void ConversationTask::update() {
|
|||
finish();
|
||||
break;
|
||||
case SAYING_CHOICE: {
|
||||
const ConversationLineList& responseList = getTaskManager()->getGame().getAssets().getResponseList();
|
||||
const ConversationLineList &responseList = getTaskManager()->getGame().getAssets().getResponseList();
|
||||
const ConversationLineList::Line *const line = responseList.getLine(_currentItem->_response);
|
||||
|
||||
_substate = SAYING_RESPONSE;
|
||||
|
@ -72,8 +72,7 @@ void ConversationTask::update() {
|
|||
case SAYING_RESPONSE: {
|
||||
startExtra();
|
||||
|
||||
if (_substate != RUNNING_EXTRA)
|
||||
{
|
||||
if (_substate != RUNNING_EXTRA) {
|
||||
gotoNextLine();
|
||||
}
|
||||
break;
|
||||
|
@ -99,7 +98,7 @@ void ConversationTask::onChoiceClicked(ConversationWidget *convWidget, int, uint
|
|||
const ConversationInfo::Item &item = getCurrentLine()->_items[data];
|
||||
convWidget->clearChoices();
|
||||
|
||||
const ConversationLineList& toSayList = getTaskManager()->getGame().getAssets().getToSayList();
|
||||
const ConversationLineList &toSayList = getTaskManager()->getGame().getAssets().getToSayList();
|
||||
const ConversationLineList::Line *line = toSayList.getLine(item._choice);
|
||||
|
||||
_substate = SAYING_CHOICE;
|
||||
|
@ -157,7 +156,7 @@ void ConversationTask::showChoicesOrPick() {
|
|||
|
||||
if (itemsWithValidChoices.size() > 1) {
|
||||
ConversationWidget &widget = game.getGui().getConversationWidget();
|
||||
const ConversationLineList& toSayList = game.getAssets().getToSayList();
|
||||
const ConversationLineList &toSayList = game.getAssets().getToSayList();
|
||||
|
||||
for (Common::Array<uint32>::size_type i = 0; i < itemsWithValidChoices.size() && i < ConversationWidget::CONVERSATION_MAX_CHOICES; ++i) {
|
||||
const ConversationInfo::Item &item = currentLine->_items[itemsWithValidChoices[i]];
|
||||
|
@ -170,7 +169,7 @@ void ConversationTask::showChoicesOrPick() {
|
|||
|
||||
_haveChoices = true;
|
||||
} else if (itemsWithValidChoices.size() == 1 && _haveChoices) {
|
||||
const ConversationLineList& toSayList = game.getAssets().getToSayList();
|
||||
const ConversationLineList &toSayList = game.getAssets().getToSayList();
|
||||
const ConversationInfo::Item &item = currentLine->_items[itemsWithValidChoices.front()];
|
||||
const ConversationLineList::Line *const line = toSayList.getLine(item._choice);
|
||||
|
||||
|
@ -185,7 +184,7 @@ void ConversationTask::showChoicesOrPick() {
|
|||
|
||||
_haveChoices = true;
|
||||
} else if (!itemsWithValidResponses.empty() && _haveChoices) {
|
||||
const ConversationLineList& responseList = game.getAssets().getResponseList();
|
||||
const ConversationLineList &responseList = game.getAssets().getResponseList();
|
||||
const ConversationInfo::Item &item = currentLine->_items[itemsWithValidResponses.front()];
|
||||
const ConversationLineList::Line *const line = responseList.getLine(item._response);
|
||||
|
||||
|
@ -224,7 +223,7 @@ void ConversationTask::finish() {
|
|||
}
|
||||
|
||||
void ConversationTask::startExtra() {
|
||||
const ConversationLineList& responseList = getTaskManager()->getGame().getAssets().getResponseList();
|
||||
const ConversationLineList &responseList = getTaskManager()->getGame().getAssets().getResponseList();
|
||||
const ConversationLineList::Line *const line = responseList.getLine(_currentItem->_response);
|
||||
if (!line->_extra.empty()) {
|
||||
_innerExecCtx = new ScriptExecutionContext(getTaskManager()->getGame());
|
||||
|
|
|
@ -33,7 +33,7 @@ class ScriptExecutionContext;
|
|||
|
||||
class ConversationTask : public Task, public ConversationWidgetCallback {
|
||||
public:
|
||||
ConversationTask(uint8 sceneId, const ConversationInfo& convInfo, TalkCommand::Mode mode) : _sceneId(sceneId), _convInfo(convInfo), _mode(mode), _currentLineIndex(0), _currentItem(nullptr), _substate(IDLE), _haveChoices(false), _innerExecCtx(nullptr) {}
|
||||
ConversationTask(uint8 sceneId, const ConversationInfo &convInfo, TalkCommand::Mode mode) : _sceneId(sceneId), _convInfo(convInfo), _mode(mode), _currentLineIndex(0), _currentItem(nullptr), _substate(IDLE), _haveChoices(false), _innerExecCtx(nullptr) {}
|
||||
virtual ~ConversationTask() {}
|
||||
|
||||
virtual void start() override;
|
||||
|
|
|
@ -44,15 +44,26 @@ public:
|
|||
|
||||
virtual void start() = 0;
|
||||
virtual void update() = 0;
|
||||
virtual void stop() { assert(false); } // Assert by default - stopping might not be safe for all tasks.
|
||||
virtual void stop() {
|
||||
assert(false); // Assert by default - stopping might not be safe for all tasks.
|
||||
}
|
||||
|
||||
void setTaskManager(TaskManager *taskMan) { _taskManager = taskMan; }
|
||||
TaskManager *getTaskManager() { return _taskManager; }
|
||||
void setTaskManager(TaskManager *taskMan) {
|
||||
_taskManager = taskMan;
|
||||
}
|
||||
|
||||
State getState() const { return _state; }
|
||||
TaskManager *getTaskManager() {
|
||||
return _taskManager;
|
||||
}
|
||||
|
||||
State getState() const {
|
||||
return _state;
|
||||
}
|
||||
|
||||
protected:
|
||||
void setState(State state) { _state = state; }
|
||||
void setState(State state) {
|
||||
_state = state;
|
||||
}
|
||||
|
||||
private:
|
||||
TaskManager *_taskManager;
|
||||
|
|
|
@ -57,11 +57,13 @@ public:
|
|||
* However, if only a raw pointer is available (e.g. this),
|
||||
* the method can be used to obtain a SharedPtr.
|
||||
*/
|
||||
TaskPtr getTask(Task* task);
|
||||
TaskPtr getTask(Task *task);
|
||||
|
||||
void update();
|
||||
|
||||
Game &getGame() { return _game; }
|
||||
Game &getGame() {
|
||||
return _game;
|
||||
}
|
||||
|
||||
private:
|
||||
TaskPtrs _tasks;
|
||||
|
|
|
@ -37,9 +37,9 @@ void reportFileMissingError(const char *fileName) {
|
|||
|
||||
Common::String toUpperCP895(const Common::String &str) {
|
||||
static const byte conversionTable[] = {
|
||||
0x00, 0x9A, 0x90, 0x85, 0x8E, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00, 0x9C, 0x8A, 0x00, 0x00, /* 0x80-0x8F */
|
||||
0x00, 0x92, 0x00, 0xA7, 0x99, 0x00, 0xA6, 0x00, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, /* 0x90-0x9F */
|
||||
0x8F, 0x8B, 0x95, 0x97, 0xA5, 0x00, 0x00, 0x00, 0x9B, 0x9E, 0xAB, 0x00 /* 0xA0-0xAB */
|
||||
0x00, 0x9A, 0x90, 0x85, 0x8E, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00, 0x9C, 0x8A, 0x00, 0x00, /* 0x80-0x8F */
|
||||
0x00, 0x92, 0x00, 0xA7, 0x99, 0x00, 0xA6, 0x00, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, /* 0x90-0x9F */
|
||||
0x8F, 0x8B, 0x95, 0x97, 0xA5, 0x00, 0x00, 0x00, 0x9B, 0x9E, 0xAB, 0x00 /* 0xA0-0xAB */
|
||||
};
|
||||
|
||||
Common::String ret = str;
|
||||
|
|
|
@ -39,7 +39,7 @@ void reportFileMissingError(const char *fileName);
|
|||
Common::String toUpperCP895(const Common::String &str);
|
||||
|
||||
// Taken from ManagedSurface::clip.
|
||||
template <typename SurfaceType>
|
||||
template<typename SurfaceType>
|
||||
bool clipBounds(Common::Rect &srcBounds, Common::Rect &destBounds, SurfaceType &destSurf) {
|
||||
if (destBounds.left >= destSurf.w || destBounds.top >= destSurf.h ||
|
||||
destBounds.right <= 0 || destBounds.bottom <= 0)
|
||||
|
@ -69,7 +69,7 @@ bool clipBounds(Common::Rect &srcBounds, Common::Rect &destBounds, SurfaceType &
|
|||
return true;
|
||||
}
|
||||
|
||||
template <typename BlitOp>
|
||||
template<typename BlitOp>
|
||||
void blit_if(const Graphics::Surface &src, const Common::Rect &srcRect, Graphics::Surface &dest, const Common::Point &destPos, BlitOp blitOp) {
|
||||
Common::Rect srcBounds = srcRect;
|
||||
Common::Rect destBounds(destPos.x, destPos.y, destPos.x + srcRect.width(), destPos.y + srcRect.height());
|
||||
|
@ -96,7 +96,7 @@ void blit_if(const Graphics::Surface &src, const Common::Rect &srcRect, Graphics
|
|||
}
|
||||
}
|
||||
|
||||
template <typename BlitOp>
|
||||
template<typename BlitOp>
|
||||
void blit_if(const Graphics::Surface &src, const Common::Rect &srcRect, Graphics::ManagedSurface &dest, const Common::Point &destPos, BlitOp blitOp) {
|
||||
Common::Rect srcBounds = srcRect;
|
||||
Common::Rect destBounds(destPos.x, destPos.y, destPos.x + srcRect.width(), destPos.y + srcRect.height());
|
||||
|
@ -111,12 +111,12 @@ void blit_if(const Graphics::Surface &src, const Common::Rect &srcRect, Graphics
|
|||
blit_if(src, srcRect, destSurf, Common::Point(0, 0), blitOp);
|
||||
}
|
||||
|
||||
template <typename BlitOp>
|
||||
template<typename BlitOp>
|
||||
void blit_if(const Graphics::Surface &src, Graphics::Surface &dest, const Common::Point &destPos, BlitOp blitOp) {
|
||||
blit_if(src, Common::Rect(0, 0, src.w, src.h), dest, destPos, blitOp);
|
||||
}
|
||||
|
||||
template <typename BlitOp>
|
||||
template<typename BlitOp>
|
||||
void blit_if(const Graphics::Surface &src, Graphics::ManagedSurface &dest, const Common::Point &destPos, BlitOp blitOp) {
|
||||
blit_if(src, Common::Rect(0, 0, src.w, src.h), dest, destPos, blitOp);
|
||||
}
|
||||
|
|
|
@ -38,9 +38,8 @@ void ButtonWidget::setCallback(ButtonWidgetCallback *callback) {
|
|||
}
|
||||
|
||||
void ButtonWidget::handleEvent(const Common::Event &event) {
|
||||
switch(event.type) {
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
{
|
||||
switch (event.type) {
|
||||
case Common::EVENT_LBUTTONDOWN: {
|
||||
const int16 x = event.mouse.x;
|
||||
const int16 y = event.mouse.y;
|
||||
if (_area.contains(x, y)) {
|
||||
|
@ -49,8 +48,7 @@ void ButtonWidget::handleEvent(const Common::Event &event) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
{
|
||||
case Common::EVENT_LBUTTONUP: {
|
||||
if (_pressed) {
|
||||
_pressed = false;
|
||||
markDirty();
|
||||
|
|
|
@ -74,9 +74,8 @@ void ConversationWidget::_draw(Graphics::ManagedSurface &surface) {
|
|||
}
|
||||
|
||||
void ConversationWidget::handleEvent(const Common::Event &event) {
|
||||
switch(event.type) {
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
{
|
||||
switch (event.type) {
|
||||
case Common::EVENT_LBUTTONDOWN: {
|
||||
const int16 x = event.mouse.x;
|
||||
const int16 y = event.mouse.y;
|
||||
if (_area.contains(x, y)) {
|
||||
|
|
|
@ -41,7 +41,9 @@ public:
|
|||
enum { CONVERSATION_MAX_CHOICES = 4 };
|
||||
|
||||
ConversationWidget(Gui &gui, const Common::Rect &area, const Graphics::Surface &surface);
|
||||
void setCallback(ConversationWidgetCallback *callback) { _callback = callback; }
|
||||
void setCallback(ConversationWidgetCallback *callback) {
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
void setChoice(int choiceNo, const Common::String &str, uint32 data = 0);
|
||||
void clearChoices();
|
||||
|
|
|
@ -41,7 +41,7 @@ enum {
|
|||
INVENTORY_ITEMS_LINES = 5
|
||||
};
|
||||
|
||||
InventoryWidget::InventoryWidget(Gui &gui, Gui::InventoryMap &inventoryMap, const Common::Array<Graphics::Surface>& inventorySurfaces) :
|
||||
InventoryWidget::InventoryWidget(Gui &gui, Gui::InventoryMap &inventoryMap, const Common::Array<Graphics::Surface> &inventorySurfaces) :
|
||||
Widget(gui, Common::Rect(INVENTORY_START_X, INVENTORY_START_Y, INVENTORY_START_X + Inventory::VISIBLE_ITEMS * INVENTORY_ITEM_WIDTH, INVENTORY_START_Y + INVENTORY_ITEM_HEIGHT)),
|
||||
_inventoryMap(inventoryMap),
|
||||
_surfaces(inventorySurfaces) {}
|
||||
|
|
|
@ -34,13 +34,13 @@ namespace MutationOfJB {
|
|||
|
||||
class InventoryWidget : public Widget {
|
||||
public:
|
||||
InventoryWidget(Gui &gui, Gui::InventoryMap &inventoryMap, const Common::Array<Graphics::Surface>& inventorySurfaces);
|
||||
InventoryWidget(Gui &gui, Gui::InventoryMap &inventoryMap, const Common::Array<Graphics::Surface> &inventorySurfaces);
|
||||
virtual void _draw(Graphics::ManagedSurface &) override;
|
||||
|
||||
private:
|
||||
void drawInventoryItem(Graphics::ManagedSurface &surface, const Common::String &item, int pos);
|
||||
Gui::InventoryMap &_inventoryMap;
|
||||
const Common::Array<Graphics::Surface>& _surfaces;
|
||||
const Common::Array<Graphics::Surface> &_surfaces;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue