Permalink
Browse files

MUTATIONOFJB: Fix uninitialized ChangeOperation, fix parsing tag in I…

…F command and add some comments.
  • Loading branch information...
LubomirR authored and sev- committed Mar 9, 2018
1 parent b4dad9b commit d3e281e24cb0ce522dc943b2d2a6bdde0766b62c
@@ -195,8 +195,9 @@ bool ChangeSceneCommandParser::parse(const Common::String &line, ScriptParseCont
}

int ChangeCommandParser::parseInteger(const char *val, ChangeCommand::ChangeOperation &op) {
op = ChangeCommand::SetValue;

if (!val || !(*val)) {
op = ChangeCommand::SetValue;
return 0;
}

@@ -64,7 +64,7 @@ bool IfCommandParser::parse(const Common::String &line, ScriptParseContext &pars
}

const char *const cstr = line.c_str();
const char tag = cstr[2];
const char tag = cstr[2] == ' ' ? 0 : cstr[2];
const uint8 sceneId = atoi(cstr + 3);
const uint8 objectId = atoi(cstr + 6);
const uint8 value = atoi(cstr + 9);
@@ -92,7 +92,7 @@ bool Static::loadFromStream(Common::ReadStream &stream) {
}

bool Bitmap::loadFromStream(Common::ReadStream &stream) {
_unknown = stream.readByte();
_frame = stream.readByte();
_isVisible = stream.readByte();
_x1 = stream.readUint16LE();
_y1 = stream.readByte();
@@ -133,8 +133,7 @@ bool Scene::loadFromStream(Common::ReadStream &stream) {
_bitmaps[i].loadFromStream(stream);
}

_obstacleY1 = stream.readByte();
_unknown386 = stream.readByte();
_obstacleY1 = stream.readUint16LE();
_palRotStart = stream.readByte();
_palRotEnd = stream.readByte();
_palRotPeriod = stream.readByte();
@@ -35,16 +35,33 @@ namespace MutationOfJB {
static const uint8 MAX_STR_LENGTH = 0x14;

struct Door {
/*
Door name.
Can be empty - deactivates door completely.
*/
char _name[MAX_STR_LENGTH + 1];
/*
Scene ID where the door leads.
Can be 0 - you can hover your mouse over it, but clicking it doesn't do anything (unless scripted).
*/
uint8 _destSceneId;
/* X coordinate for player's position after going through the door. */
uint16 _destX;
/* Y coordinate for player's position after going through the door. */
uint16 _destY;
/* X coordinate of the door rectangle. */
uint16 _x;
/* Y coordinate of the door rectangle. */
uint8 _y;
/* Width of the door rectangle. */
uint16 _width;
/* Height of the door rectangle. */
uint8 _height;
/* X coordinate for position towards player will walk after clicking the door. */
uint16 _walkToX;
/* Y coordinate for position towards player will walk after clicking the door. */
uint8 _walkToY;
/* Unknown for now - likely not even used. */
uint8 _SP;

bool loadFromStream(Common::ReadStream &stream);
@@ -84,7 +101,7 @@ struct Static {
};

struct Bitmap {
uint8 _unknown;
uint8 _frame;
uint8 _isVisible;
uint16 _x1;
uint8 _y1;
@@ -118,8 +135,7 @@ struct Scene {

Bitmap _bitmaps[10];

uint8 _obstacleY1;
uint8 _unknown386;
uint16 _obstacleY1;
uint8 _palRotStart;
uint8 _palRotEnd;
uint8 _palRotPeriod;

0 comments on commit d3e281e

Please sign in to comment.