Permalink
Browse files

MUTATIONOFJB: Fix code formatting issues (with astyle).

  • Loading branch information...
LubomirR authored and sev- committed Aug 4, 2018
1 parent 6ff609c commit a25715a29b0587ae6795eef63a575172e2cb971d
Showing with 361 additions and 309 deletions.
  1. +2 −2 engines/mutationofjb/animationdecoder.cpp
  2. +2 −2 engines/mutationofjb/assets.cpp
  3. +4 −4 engines/mutationofjb/assets.h
  4. +5 −5 engines/mutationofjb/commands/additemcommand.cpp
  5. +5 −5 engines/mutationofjb/commands/callmacrocommand.cpp
  6. +7 −7 engines/mutationofjb/commands/camefromcommand.cpp
  7. +68 −36 engines/mutationofjb/commands/changecommand.cpp
  8. +2 −2 engines/mutationofjb/commands/changecommand.h
  9. +1 −1 engines/mutationofjb/commands/definestructcommand.cpp
  10. +23 −23 engines/mutationofjb/commands/endblockcommand.cpp
  11. +5 −5 engines/mutationofjb/commands/gotocommand.cpp
  12. +19 −19 engines/mutationofjb/commands/ifcommand.cpp
  13. +1 −1 engines/mutationofjb/commands/ifcommand.h
  14. +17 −17 engines/mutationofjb/commands/ifitemcommand.cpp
  15. +1 −1 engines/mutationofjb/commands/ifitemcommand.h
  16. +15 −15 engines/mutationofjb/commands/ifpiggycommand.cpp
  17. +6 −7 engines/mutationofjb/commands/labelcommand.cpp
  18. +10 −10 engines/mutationofjb/commands/newroomcommand.cpp
  19. +11 −12 engines/mutationofjb/commands/randomcommand.cpp
  20. +5 −5 engines/mutationofjb/commands/removeallitemscommand.cpp
  21. +5 −5 engines/mutationofjb/commands/removeitemcommand.cpp
  22. +6 −5 engines/mutationofjb/commands/renamecommand.cpp
  23. +22 −22 engines/mutationofjb/commands/saycommand.cpp
  24. +1 −2 engines/mutationofjb/commands/seqcommand.cpp
  25. +1 −1 engines/mutationofjb/commands/seqcommand.h
  26. +1 −1 engines/mutationofjb/commands/talkcommand.cpp
  27. +9 −3 engines/mutationofjb/conversationlinelist.h
  28. +4 −4 engines/mutationofjb/debug.cpp
  29. +23 −23 engines/mutationofjb/encryptedfile.cpp
  30. +7 −7 engines/mutationofjb/game.cpp
  31. +4 −5 engines/mutationofjb/gamedata.cpp
  32. +9 −3 engines/mutationofjb/gamedata.h
  33. +3 −3 engines/mutationofjb/gui.cpp
  34. +1 −1 engines/mutationofjb/gui.h
  35. +7 −7 engines/mutationofjb/mutationofjb.cpp
  36. +1 −1 engines/mutationofjb/script.cpp
  37. +1 −1 engines/mutationofjb/script.h
  38. +7 −8 engines/mutationofjb/tasks/conversationtask.cpp
  39. +1 −1 engines/mutationofjb/tasks/conversationtask.h
  40. +16 −5 engines/mutationofjb/tasks/task.h
  41. +4 −2 engines/mutationofjb/tasks/taskmanager.h
  42. +3 −3 engines/mutationofjb/util.cpp
  43. +5 −5 engines/mutationofjb/util.h
  44. +3 −5 engines/mutationofjb/widgets/buttonwidget.cpp
  45. +2 −3 engines/mutationofjb/widgets/conversationwidget.cpp
  46. +3 −1 engines/mutationofjb/widgets/conversationwidget.h
  47. +1 −1 engines/mutationofjb/widgets/inventorywidget.cpp
  48. +2 −2 engines/mutationofjb/widgets/inventorywidget.h
@@ -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 &reg, 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 @@ class ChangeCommand : public SeqCommand {
YL, // Height
WX, // Walk to X
WY, // Walk to Y
SP, //
SP, //
AC, // Active
FA, // First animation
FR,
@@ -67,7 +67,7 @@ class ChangeCommand : public SeqCommand {
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 @@ class IfCommandParser : public ConditionalCommandParser {
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;

Oops, something went wrong.

0 comments on commit a25715a

Please sign in to comment.