diff options
author | Ľubomír Remák | 2018-08-04 16:57:41 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-25 23:12:01 +0200 |
commit | a25715a29b0587ae6795eef63a575172e2cb971d (patch) | |
tree | b10acdeffd001f507209799498a6e9f90a585e06 /engines/mutationofjb | |
parent | 6ff609c51478c07a00018e57d8149f09d97677e7 (diff) | |
download | scummvm-rg350-a25715a29b0587ae6795eef63a575172e2cb971d.tar.gz scummvm-rg350-a25715a29b0587ae6795eef63a575172e2cb971d.tar.bz2 scummvm-rg350-a25715a29b0587ae6795eef63a575172e2cb971d.zip |
MUTATIONOFJB: Fix code formatting issues (with astyle).
Diffstat (limited to 'engines/mutationofjb')
48 files changed, 361 insertions, 309 deletions
diff --git a/engines/mutationofjb/animationdecoder.cpp b/engines/mutationofjb/animationdecoder.cpp index 81323858ee..712cb42c97 100644 --- a/engines/mutationofjb/animationdecoder.cpp +++ b/engines/mutationofjb/animationdecoder.cpp @@ -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 { diff --git a/engines/mutationofjb/assets.cpp b/engines/mutationofjb/assets.cpp index d532469e87..2adda51c09 100644 --- a/engines/mutationofjb/assets.cpp +++ b/engines/mutationofjb/assets.cpp @@ -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; } diff --git a/engines/mutationofjb/assets.h b/engines/mutationofjb/assets.h index 1d47641a03..2cd0612f20 100644 --- a/engines/mutationofjb/assets.h +++ b/engines/mutationofjb/assets.h @@ -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; diff --git a/engines/mutationofjb/commands/additemcommand.cpp b/engines/mutationofjb/commands/additemcommand.cpp index 1a670f7d27..67d3e13188 100644 --- a/engines/mutationofjb/commands/additemcommand.cpp +++ b/engines/mutationofjb/commands/additemcommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/callmacrocommand.cpp b/engines/mutationofjb/commands/callmacrocommand.cpp index 49b948c48d..01470f2ba1 100644 --- a/engines/mutationofjb/commands/callmacrocommand.cpp +++ b/engines/mutationofjb/commands/callmacrocommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/camefromcommand.cpp b/engines/mutationofjb/commands/camefromcommand.cpp index 0583187884..485e0c54c9 100644 --- a/engines/mutationofjb/commands/camefromcommand.cpp +++ b/engines/mutationofjb/commands/camefromcommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/changecommand.cpp b/engines/mutationofjb/commands/changecommand.cpp index 4eac41e619..5d6833b82c 100644 --- a/engines/mutationofjb/commands/changecommand.cpp +++ b/engines/mutationofjb/commands/changecommand.cpp @@ -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)"; } } diff --git a/engines/mutationofjb/commands/changecommand.h b/engines/mutationofjb/commands/changecommand.h index 6fa090ef6d..a88cdc11ef 100644 --- a/engines/mutationofjb/commands/changecommand.h +++ b/engines/mutationofjb/commands/changecommand.h @@ -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: diff --git a/engines/mutationofjb/commands/definestructcommand.cpp b/engines/mutationofjb/commands/definestructcommand.cpp index 93dbfc80bc..4ccf2e8631 100644 --- a/engines/mutationofjb/commands/definestructcommand.cpp +++ b/engines/mutationofjb/commands/definestructcommand.cpp @@ -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; diff --git a/engines/mutationofjb/commands/endblockcommand.cpp b/engines/mutationofjb/commands/endblockcommand.cpp index b883beed48..c7fbd41f00 100644 --- a/engines/mutationofjb/commands/endblockcommand.cpp +++ b/engines/mutationofjb/commands/endblockcommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/gotocommand.cpp b/engines/mutationofjb/commands/gotocommand.cpp index bc24e2c552..b8d15a7131 100644 --- a/engines/mutationofjb/commands/gotocommand.cpp +++ b/engines/mutationofjb/commands/gotocommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/ifcommand.cpp b/engines/mutationofjb/commands/ifcommand.cpp index b5f03fc9e4..06fb5ca4c6 100644 --- a/engines/mutationofjb/commands/ifcommand.cpp +++ b/engines/mutationofjb/commands/ifcommand.cpp @@ -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; } diff --git a/engines/mutationofjb/commands/ifcommand.h b/engines/mutationofjb/commands/ifcommand.h index b04d8a363d..04174d9ed6 100644 --- a/engines/mutationofjb/commands/ifcommand.h +++ b/engines/mutationofjb/commands/ifcommand.h @@ -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; diff --git a/engines/mutationofjb/commands/ifitemcommand.cpp b/engines/mutationofjb/commands/ifitemcommand.cpp index 7a58cee22d..d70add9207 100644 --- a/engines/mutationofjb/commands/ifitemcommand.cpp +++ b/engines/mutationofjb/commands/ifitemcommand.cpp @@ -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; } diff --git a/engines/mutationofjb/commands/ifitemcommand.h b/engines/mutationofjb/commands/ifitemcommand.h index df073b9fa4..86a5ad2684 100644 --- a/engines/mutationofjb/commands/ifitemcommand.h +++ b/engines/mutationofjb/commands/ifitemcommand.h @@ -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; diff --git a/engines/mutationofjb/commands/ifpiggycommand.cpp b/engines/mutationofjb/commands/ifpiggycommand.cpp index e30213ac68..e3107806ec 100644 --- a/engines/mutationofjb/commands/ifpiggycommand.cpp +++ b/engines/mutationofjb/commands/ifpiggycommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/labelcommand.cpp b/engines/mutationofjb/commands/labelcommand.cpp index de6de020ab..7593e52bb3 100644 --- a/engines/mutationofjb/commands/labelcommand.cpp +++ b/engines/mutationofjb/commands/labelcommand.cpp @@ -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; } diff --git a/engines/mutationofjb/commands/newroomcommand.cpp b/engines/mutationofjb/commands/newroomcommand.cpp index 818ef7d5ee..5aabc6705f 100644 --- a/engines/mutationofjb/commands/newroomcommand.cpp +++ b/engines/mutationofjb/commands/newroomcommand.cpp @@ -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(); } diff --git a/engines/mutationofjb/commands/randomcommand.cpp b/engines/mutationofjb/commands/randomcommand.cpp index b9cc303125..467f7888d3 100644 --- a/engines/mutationofjb/commands/randomcommand.cpp +++ b/engines/mutationofjb/commands/randomcommand.cpp @@ -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); } diff --git a/engines/mutationofjb/commands/removeallitemscommand.cpp b/engines/mutationofjb/commands/removeallitemscommand.cpp index d9ebe4534a..38e30ded47 100644 --- a/engines/mutationofjb/commands/removeallitemscommand.cpp +++ b/engines/mutationofjb/commands/removeallitemscommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/removeitemcommand.cpp b/engines/mutationofjb/commands/removeitemcommand.cpp index 48dbda9801..21d1123dc2 100644 --- a/engines/mutationofjb/commands/removeitemcommand.cpp +++ b/engines/mutationofjb/commands/removeitemcommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/renamecommand.cpp b/engines/mutationofjb/commands/renamecommand.cpp index 03a883261c..7bd526974a 100644 --- a/engines/mutationofjb/commands/renamecommand.cpp +++ b/engines/mutationofjb/commands/renamecommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/saycommand.cpp b/engines/mutationofjb/commands/saycommand.cpp index 0474a3e1ac..e63ceb198e 100644 --- a/engines/mutationofjb/commands/saycommand.cpp +++ b/engines/mutationofjb/commands/saycommand.cpp @@ -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 { diff --git a/engines/mutationofjb/commands/seqcommand.cpp b/engines/mutationofjb/commands/seqcommand.cpp index 02164dcff7..4836d0357f 100644 --- a/engines/mutationofjb/commands/seqcommand.cpp +++ b/engines/mutationofjb/commands/seqcommand.cpp @@ -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; } diff --git a/engines/mutationofjb/commands/seqcommand.h b/engines/mutationofjb/commands/seqcommand.h index 04731c2984..6c969e935f 100644 --- a/engines/mutationofjb/commands/seqcommand.h +++ b/engines/mutationofjb/commands/seqcommand.h @@ -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" diff --git a/engines/mutationofjb/commands/talkcommand.cpp b/engines/mutationofjb/commands/talkcommand.cpp index 6a3b204bb5..5c7eb8e863 100644 --- a/engines/mutationofjb/commands/talkcommand.cpp +++ b/engines/mutationofjb/commands/talkcommand.cpp @@ -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]); } diff --git a/engines/mutationofjb/conversationlinelist.h b/engines/mutationofjb/conversationlinelist.h index 0f8346f69a..4f208adf5c 100644 --- a/engines/mutationofjb/conversationlinelist.h +++ b/engines/mutationofjb/conversationlinelist.h @@ -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; diff --git a/engines/mutationofjb/debug.cpp b/engines/mutationofjb/debug.cpp index b4f00c9da3..f7b074a10b 100644 --- a/engines/mutationofjb/debug.cpp +++ b/engines/mutationofjb/debug.cpp @@ -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()); diff --git a/engines/mutationofjb/encryptedfile.cpp b/engines/mutationofjb/encryptedfile.cpp index 0796811dda..c02bcc7920 100644 --- a/engines/mutationofjb/encryptedfile.cpp +++ b/engines/mutationofjb/encryptedfile.cpp @@ -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) { diff --git a/engines/mutationofjb/game.cpp b/engines/mutationofjb/game.cpp index 7b500d38ec..2843ad943d 100644 --- a/engines/mutationofjb/game.cpp +++ b/engines/mutationofjb/game.cpp @@ -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); diff --git a/engines/mutationofjb/gamedata.cpp b/engines/mutationofjb/gamedata.cpp index 54335d1514..f25eff64d0 100644 --- a/engines/mutationofjb/gamedata.cpp +++ b/engines/mutationofjb/gamedata.cpp @@ -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)) { diff --git a/engines/mutationofjb/gamedata.h b/engines/mutationofjb/gamedata.h index fc755f7179..8783555fe5 100644 --- a/engines/mutationofjb/gamedata.h +++ b/engines/mutationofjb/gamedata.h @@ -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) : diff --git a/engines/mutationofjb/gui.cpp b/engines/mutationofjb/gui.cpp index 41ef94af25..6266ff0c75 100644 --- a/engines/mutationofjb/gui.cpp +++ b/engines/mutationofjb/gui.cpp @@ -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; } diff --git a/engines/mutationofjb/gui.h b/engines/mutationofjb/gui.h index 8919a9deb6..f644517ca9 100644 --- a/engines/mutationofjb/gui.h +++ b/engines/mutationofjb/gui.h @@ -65,7 +65,7 @@ public: virtual void onInventoryChanged() override; virtual void onButtonClicked(ButtonWidget *) override; - ConversationWidget& getConversationWidget(); + ConversationWidget &getConversationWidget(); private: bool loadInventoryGfx(); diff --git a/engines/mutationofjb/mutationofjb.cpp b/engines/mutationofjb/mutationofjb.cpp index cdaa03788b..23202555e6 100644 --- a/engines/mutationofjb/mutationofjb.cpp +++ b/engines/mutationofjb/mutationofjb.cpp @@ -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); diff --git a/engines/mutationofjb/script.cpp b/engines/mutationofjb/script.cpp index 3e93c47137..fb148c163f 100644 --- a/engines/mutationofjb/script.cpp +++ b/engines/mutationofjb/script.cpp @@ -103,7 +103,7 @@ bool ScriptParseContext::readLine(Common::String &line) { } return true; } - } while(!_stream.eos()); + } while (!_stream.eos()); return false; } diff --git a/engines/mutationofjb/script.h b/engines/mutationofjb/script.h index 28e0e98526..17e18102a3 100644 --- a/engines/mutationofjb/script.h +++ b/engines/mutationofjb/script.h @@ -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" diff --git a/engines/mutationofjb/tasks/conversationtask.cpp b/engines/mutationofjb/tasks/conversationtask.cpp index d4fab56dc3..8c07b32a69 100644 --- a/engines/mutationofjb/tasks/conversationtask.cpp +++ b/engines/mutationofjb/tasks/conversationtask.cpp @@ -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()); diff --git a/engines/mutationofjb/tasks/conversationtask.h b/engines/mutationofjb/tasks/conversationtask.h index e4bbdc3276..bdfa87533f 100644 --- a/engines/mutationofjb/tasks/conversationtask.h +++ b/engines/mutationofjb/tasks/conversationtask.h @@ -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; diff --git a/engines/mutationofjb/tasks/task.h b/engines/mutationofjb/tasks/task.h index 8c9c0e85b4..b14fc971aa 100644 --- a/engines/mutationofjb/tasks/task.h +++ b/engines/mutationofjb/tasks/task.h @@ -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; diff --git a/engines/mutationofjb/tasks/taskmanager.h b/engines/mutationofjb/tasks/taskmanager.h index 29e854a313..2f351c0bbf 100644 --- a/engines/mutationofjb/tasks/taskmanager.h +++ b/engines/mutationofjb/tasks/taskmanager.h @@ -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; diff --git a/engines/mutationofjb/util.cpp b/engines/mutationofjb/util.cpp index 72d2d0f7e1..2e3b0b3ad6 100644 --- a/engines/mutationofjb/util.cpp +++ b/engines/mutationofjb/util.cpp @@ -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; diff --git a/engines/mutationofjb/util.h b/engines/mutationofjb/util.h index ac1239ddf7..fe72794ce9 100644 --- a/engines/mutationofjb/util.h +++ b/engines/mutationofjb/util.h @@ -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); } diff --git a/engines/mutationofjb/widgets/buttonwidget.cpp b/engines/mutationofjb/widgets/buttonwidget.cpp index 9f9a401eb6..911cb7d7df 100644 --- a/engines/mutationofjb/widgets/buttonwidget.cpp +++ b/engines/mutationofjb/widgets/buttonwidget.cpp @@ -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(); diff --git a/engines/mutationofjb/widgets/conversationwidget.cpp b/engines/mutationofjb/widgets/conversationwidget.cpp index 24bb5e1d25..e0bbf6645f 100644 --- a/engines/mutationofjb/widgets/conversationwidget.cpp +++ b/engines/mutationofjb/widgets/conversationwidget.cpp @@ -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)) { diff --git a/engines/mutationofjb/widgets/conversationwidget.h b/engines/mutationofjb/widgets/conversationwidget.h index 51ea86ed02..abde70205b 100644 --- a/engines/mutationofjb/widgets/conversationwidget.h +++ b/engines/mutationofjb/widgets/conversationwidget.h @@ -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(); diff --git a/engines/mutationofjb/widgets/inventorywidget.cpp b/engines/mutationofjb/widgets/inventorywidget.cpp index d78ef10adc..96f35e4cb2 100644 --- a/engines/mutationofjb/widgets/inventorywidget.cpp +++ b/engines/mutationofjb/widgets/inventorywidget.cpp @@ -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) {} diff --git a/engines/mutationofjb/widgets/inventorywidget.h b/engines/mutationofjb/widgets/inventorywidget.h index f0bc4baeee..8d6205e1ef 100644 --- a/engines/mutationofjb/widgets/inventorywidget.h +++ b/engines/mutationofjb/widgets/inventorywidget.h @@ -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; }; } |