Skip to content

Commit

Permalink
MUTATIONOFJB: Fix code formatting issues (with astyle).
Browse files Browse the repository at this point in the history
  • Loading branch information
LubomirR committed Aug 19, 2018
1 parent 5605946 commit b670a66
Show file tree
Hide file tree
Showing 48 changed files with 361 additions and 309 deletions.
4 changes: 2 additions & 2 deletions engines/mutationofjb/animationdecoder.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions engines/mutationofjb/assets.cpp
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions engines/mutationofjb/assets.h
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions engines/mutationofjb/commands/additemcommand.cpp
Expand Up @@ -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 {

Expand Down
10 changes: 5 additions & 5 deletions engines/mutationofjb/commands/callmacrocommand.cpp
Expand Up @@ -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 {

Expand Down
14 changes: 7 additions & 7 deletions engines/mutationofjb/commands/camefromcommand.cpp
Expand Up @@ -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 {

Expand Down
104 changes: 68 additions & 36 deletions engines/mutationofjb/commands/changecommand.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)";
}
}

Expand Down
4 changes: 2 additions & 2 deletions engines/mutationofjb/commands/changecommand.h
Expand Up @@ -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,
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion engines/mutationofjb/commands/definestructcommand.cpp
Expand Up @@ -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;

Expand Down
46 changes: 23 additions & 23 deletions engines/mutationofjb/commands/endblockcommand.cpp
Expand Up @@ -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 {

Expand Down
10 changes: 5 additions & 5 deletions engines/mutationofjb/commands/gotocommand.cpp
Expand Up @@ -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 {

Expand Down
38 changes: 19 additions & 19 deletions engines/mutationofjb/commands/ifcommand.cpp
Expand Up @@ -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 {

Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/mutationofjb/commands/ifcommand.h
Expand Up @@ -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;

Expand Down

0 comments on commit b670a66

Please sign in to comment.