Skip to content

Commit

Permalink
MUTATIONOFJB: Improve documentation, rename cryptic variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroslavR authored and sev- committed Aug 25, 2018
1 parent cda1f0d commit 578a679
Show file tree
Hide file tree
Showing 7 changed files with 247 additions and 120 deletions.
28 changes: 14 additions & 14 deletions engines/mutationofjb/commands/changecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,22 +381,22 @@ Command::ExecuteResult ChangeObjectCommand::execute(ScriptExecutionContext &scri

switch (_register) {
case AC:
object->_AC = _value._byteVal;
object->_active = _value._byteVal;
break;
case FA:
object->_FA = _value._byteVal;
object->_firstFrame = _value._byteVal;
break;
case FR:
object->_FR = _value._byteVal;
object->_randomFrame = _value._byteVal;
break;
case NA:
object->_NA = _value._byteVal;
object->_numFrames = _value._byteVal;
break;
case FS:
object->_FS = _value._byteVal;
object->_roomFrameLSB = _value._byteVal;
break;
case CA:
object->_CA = _value._byteVal;
object->_currentFrame = _value._byteVal;
break;
case XX:
object->_x = _value._wordVal;
Expand All @@ -405,16 +405,16 @@ Command::ExecuteResult ChangeObjectCommand::execute(ScriptExecutionContext &scri
object->_y = _value._byteVal;
break;
case XL:
object->_XL = _value._wordVal;
object->_width = _value._wordVal;
break;
case YL:
object->_YL = _value._byteVal;
object->_height = _value._byteVal;
break;
case WX:
object->_WX = _value._wordVal;
break;
case WY:
object->_WY = _value._byteVal;
object->_roomFrameMSB = _value._byteVal;
break;
case SP:
object->_SP = _value._byteVal;
Expand Down Expand Up @@ -468,7 +468,7 @@ Command::ExecuteResult ChangeStaticCommand::execute(ScriptExecutionContext &scri
stat->_walkToY = _value._byteVal;
break;
case SP:
stat->_SP = _value._byteVal;
stat->_walkToFrame = _value._byteVal;
break;
default:
warning("Object does not support changing this register.");
Expand All @@ -493,7 +493,7 @@ Command::ExecuteResult ChangeSceneCommand::execute(ScriptExecutionContext &scrip
scene->_startup = _value._byteVal;
break;
case DL:
scene->_DL = _value._byteVal;
scene->_delay = _value._byteVal;
break;
case ND:
scene->_noDoors = _value._byteVal;
Expand All @@ -505,13 +505,13 @@ Command::ExecuteResult ChangeSceneCommand::execute(ScriptExecutionContext &scrip
scene->_noStatics = _value._byteVal;
break;
case PF:
scene->_palRotStart = _value._byteVal;
scene->_palRotFirst = _value._byteVal;
break;
case PL:
scene->_palRotEnd = _value._byteVal;
scene->_palRotLast = _value._byteVal;
break;
case PD:
scene->_palRotPeriod = _value._byteVal;
scene->_palRotDelay = _value._byteVal;
break;
default:
warning("Scene does not support changing this register.");
Expand Down
30 changes: 15 additions & 15 deletions engines/mutationofjb/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ bool Console::cmd_dumpsceneinfo(int argc, const char **argv) {
Scene *scene = _vm->getGame().getGameData().getScene(sceneId);
if (scene) {
debugPrintf("Startup: %u\n", (unsigned int) scene->_startup);
debugPrintf("Delay: %u\n", (unsigned int) scene->_DL);
debugPrintf("Delay: %u\n", (unsigned int) scene->_delay);
debugPrintf("Doors: %u\n", (unsigned int) scene->_noDoors);
debugPrintf("Objects: %u\n", (unsigned int) scene->_noObjects);
debugPrintf("Statics: %u\n", (unsigned int) scene->_noStatics);
debugPrintf("ObstacleY1: %u\n", (unsigned int) scene->_obstacleY1);
debugPrintf("PalRotStart: %u\n", (unsigned int) scene->_palRotStart);
debugPrintf("PalRotEnd: %u\n", (unsigned int) scene->_palRotEnd);
debugPrintf("PalRotPeriod: %u\n", (unsigned int) scene->_palRotPeriod);
debugPrintf("PalRotFirst: %u\n", (unsigned int) scene->_palRotFirst);
debugPrintf("PalRotLast: %u\n", (unsigned int) scene->_palRotLast);
debugPrintf("PalRotDelay: %u\n", (unsigned int) scene->_palRotDelay);
} else {
debugPrintf(_("Scene %u not found.\n"), (unsigned int) sceneId);
}
Expand Down Expand Up @@ -377,19 +377,19 @@ bool Console::cmd_dumpobjectinfo(int argc, const char **argv) {
if (scene) {
Object *const object = scene->getObject(objectId);
if (object) {
debugPrintf("AC: %u\n", (unsigned int) object->_AC);
debugPrintf("FA: %u\n", (unsigned int) object->_FA);
debugPrintf("FR: %u\n", (unsigned int) object->_FR);
debugPrintf("NA: %u\n", (unsigned int) object->_NA);
debugPrintf("FS: %u\n", (unsigned int) object->_FS);
debugPrintf("Unknown: %u\n", (unsigned int) object->_unknown);
debugPrintf("CA: %u\n", (unsigned int) object->_CA);
debugPrintf("AC: %u\n", (unsigned int) object->_active);
debugPrintf("FA: %u\n", (unsigned int) object->_firstFrame);
debugPrintf("FR: %u\n", (unsigned int) object->_randomFrame);
debugPrintf("NA: %u\n", (unsigned int) object->_numFrames);
debugPrintf("FS: %u\n", (unsigned int) object->_roomFrameLSB);
debugPrintf("Jump chance: %u\n", (unsigned int) object->_jumpChance);
debugPrintf("CA: %u\n", (unsigned int) object->_currentFrame);
debugPrintf("X: %u\n", (unsigned int) object->_x);
debugPrintf("Y: %u\n", (unsigned int) object->_y);
debugPrintf("XL: %u\n", (unsigned int) object->_XL);
debugPrintf("YL: %u\n", (unsigned int) object->_YL);
debugPrintf("XL: %u\n", (unsigned int) object->_width);
debugPrintf("YL: %u\n", (unsigned int) object->_height);
debugPrintf("WX: %u\n", (unsigned int) object->_WX);
debugPrintf("WY: %u\n", (unsigned int) object->_WY);
debugPrintf("WY: %u\n", (unsigned int) object->_roomFrameMSB);
debugPrintf("SP: %u\n", (unsigned int) object->_SP);
} else {
debugPrintf(_("Object %u not found.\n"), (unsigned int) objectId);
Expand Down Expand Up @@ -421,7 +421,7 @@ bool Console::cmd_dumpstaticinfo(int argc, const char **argv) {
debugPrintf("Height: %u\n", (unsigned int) stat->_height);
debugPrintf("WalkToX: %u\n", (unsigned int) stat->_walkToY);
debugPrintf("WalkToY: %u\n", (unsigned int) stat->_walkToX);
debugPrintf("WalkToFrame: %u\n", (unsigned int) stat->_SP);
debugPrintf("WalkToFrame: %u\n", (unsigned int) stat->_walkToFrame);
} else {
debugPrintf(_("Static %u not found.\n"), (unsigned int) staticId);
}
Expand Down
32 changes: 16 additions & 16 deletions engines/mutationofjb/gamedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ bool Door::loadFromStream(Common::ReadStream &stream) {
}

bool Object::loadFromStream(Common::ReadStream &stream) {
_AC = stream.readByte();
_FA = stream.readByte();
_FR = stream.readByte();
_NA = stream.readByte();
_FS = stream.readByte();
_unknown = stream.readByte();
_CA = stream.readByte();
_active = stream.readByte();
_firstFrame = stream.readByte();
_randomFrame = stream.readByte();
_numFrames = stream.readByte();
_roomFrameLSB = stream.readByte();
_jumpChance = stream.readByte();
_currentFrame = stream.readByte();
_x = stream.readUint16LE();
_y = stream.readByte();
_XL = stream.readUint16LE();
_YL = stream.readByte();
_width = stream.readUint16LE();
_height = stream.readByte();
_WX = stream.readUint16LE();
_WY = stream.readByte();
_roomFrameMSB = stream.readByte();
_SP = stream.readByte();

return true;
Expand All @@ -85,13 +85,13 @@ bool Static::loadFromStream(Common::ReadStream &stream) {
_height = stream.readByte();
_walkToX = stream.readUint16LE();
_walkToY = stream.readByte();
_SP = stream.readByte();
_walkToFrame = stream.readByte();

return true;
}

bool Bitmap::loadFromStream(Common::ReadStream &stream) {
_frame = stream.readByte();
_roomFrame = stream.readByte();
_isVisible = stream.readByte();
_x1 = stream.readUint16LE();
_y1 = stream.readByte();
Expand All @@ -108,7 +108,7 @@ bool Scene::loadFromStream(Common::ReadStream &stream) {
_unknown001 = stream.readByte();
_unknown002 = stream.readByte();
_unknown003 = stream.readByte();
_DL = stream.readByte();
_delay = stream.readByte();

_noDoors = stream.readByte();
_noDoors = MIN(_noDoors, (uint8) ARRAYSIZE(_doors));
Expand All @@ -133,9 +133,9 @@ bool Scene::loadFromStream(Common::ReadStream &stream) {
}

_obstacleY1 = stream.readUint16LE();
_palRotStart = stream.readByte();
_palRotEnd = stream.readByte();
_palRotPeriod = stream.readByte();
_palRotFirst = stream.readByte();
_palRotLast = stream.readByte();
_palRotDelay = stream.readByte();
_exhaustedChoiceNext = stream.readByte();

for (i = 0; i < 79; ++i) {
Expand Down
Loading

0 comments on commit 578a679

Please sign in to comment.