aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-26 09:32:33 -0400
committerPaul Gilbert2014-03-26 09:32:33 -0400
commitf9e2c1c71f29f6dc1ba8e860d597fe93bc79646a (patch)
treed90a8ecdfb86f9e97b2430d05ad7e102ce7bb720 /engines
parent56f7b51754e30ec75c596cd80c76991ac158da66 (diff)
downloadscummvm-rg350-f9e2c1c71f29f6dc1ba8e860d597fe93bc79646a.tar.gz
scummvm-rg350-f9e2c1c71f29f6dc1ba8e860d597fe93bc79646a.tar.bz2
scummvm-rg350-f9e2c1c71f29f6dc1ba8e860d597fe93bc79646a.zip
MADS: Cleaned up game initialisation code to use more constants
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/game.cpp8
-rw-r--r--engines/mads/game.h4
-rw-r--r--engines/mads/inventory.cpp2
-rw-r--r--engines/mads/inventory.h8
-rw-r--r--engines/mads/nebular/game_nebular.cpp236
-rw-r--r--engines/mads/nebular/globals_nebular.cpp7
-rw-r--r--engines/mads/nebular/globals_nebular.h82
-rw-r--r--engines/mads/nebular/nebular_scenes2.cpp40
-rw-r--r--engines/mads/nebular/nebular_scenes8.cpp10
-rw-r--r--engines/mads/player.cpp40
-rw-r--r--engines/mads/player.h4
-rw-r--r--engines/mads/scene.cpp2
12 files changed, 307 insertions, 136 deletions
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 631ce20a32..50a4f6358d 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -42,7 +42,7 @@ Game *Game::init(MADSEngine *vm) {
Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm),
_scene(vm), _screenObjects(vm), _player(vm) {
_sectionNumber = _priorSectionNumber = 0;
- _difficultyLevel = DIFFICULTY_HARD;
+ _difficulty = DIFFICULTY_HARD;
_saveSlot = -1;
_statusFlag = 0;
_sectionHandler = nullptr;
@@ -207,7 +207,7 @@ void Game::sectionLoop() {
_scene._action.clear();
_player.turnToDestFacing();
- _player._direction = _player._newDirection;
+ _player._facing = _player._turnToFacing;
_player.moveComplete();
switch (_vm->_screenFade) {
@@ -231,8 +231,8 @@ void Game::sectionLoop() {
// Set player data
_player._destPos = _player._playerPos;
- _player._newDirection = _player._direction;
- _player._targetFacing = _player._direction;
+ _player._turnToFacing = _player._facing;
+ _player._targetFacing = _player._facing;
_player.setupFrame();
_player.updateFrame();
_player._visible3 = _player._visible;
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 0abb70bb9f..0d7178a567 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -40,7 +40,7 @@ enum {
};
enum Difficulty {
- DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3
+ DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3
};
enum ProtectionResult {
@@ -117,7 +117,7 @@ public:
public:
Player _player;
ScreenObjects _screenObjects;
- Difficulty _difficultyLevel;
+ Difficulty _difficulty;
int _sectionNumber;
int _priorSectionNumber;
int _currentSectionNumber;
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp
index 1443761ada..3237d55b77 100644
--- a/engines/mads/inventory.cpp
+++ b/engines/mads/inventory.cpp
@@ -66,7 +66,7 @@ void InventoryObjects::load() {
}
}
-void InventoryObjects::setData(int objIndex, int id, const byte *p) {
+void InventoryObjects::setQuality(int objIndex, int id, const byte *p) {
// TODO: This whole method seems weird. Check it out more thoroughly once
// more of the engine is implemented
for (int i = 0; i < (int)size(); ++i) {
diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h
index 2ca270649e..eec272b365 100644
--- a/engines/mads/inventory.h
+++ b/engines/mads/inventory.h
@@ -28,6 +28,10 @@
namespace MADS {
+enum {
+ NOWHERE = 1
+};
+
class MADSEngine;
class InventoryObject {
@@ -75,9 +79,9 @@ public:
}
/**
- * Set the associated data? pointer with an inventory object
+ * Set the associated quality data for an inventory object
*/
- void setData(int objIndex, int id, const byte *p);
+ void setQuality(int objIndex, int id, const byte *p);
/**
* Sets an item's scene number
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index 9b48bde9da..55a348a489 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -58,96 +58,178 @@ ProtectionResult GameNebular::checkCopyProtection() {
}
void GameNebular::initialiseGlobals() {
- // Set specific values needed by the game
- _globals[4] = 8;
- _globals[33] = 1;
- _globals[10] = -1;
- _globals[13] = -1;
- _globals[15] = -1;
- _globals[19] = -1;
- _globals[20] = -1;
- _globals[21] = -1;
- _globals[95] = -1;
-
- _objects.setData(3, 17, nullptr);
-
- // Put the values 0 through 3 in a random order in global slots 83 to 86
- for (int i = 0; i < 4;) {
- int randomVal = _vm->getRandomNumber(3);
- _globals[83 + i] = randomVal;
-
- bool flag = false;
- for (int idx2 = 0; idx2 < i; ++idx2) {
- if (_globals[83 + idx2] == randomVal)
- flag = true;
- }
-
- if (!flag)
- ++i;
- }
+ int count, count2;
+ int bad;
+
+ _globals.reset();
+ _globals[kTalkInanimateCount] = 8;
+
+ /* Section #1 variables */
+ _globals[kNeedToStandUp] = true;
+ _globals[kTurkeyExploded] = false;
+ _globals[kMedicineCabinetOpen] = false;
+ _globals[kMedicineCabinetVirgin] = true;
+ _globals[kWatchedViewScreen] = false;
+ _globals[kHoovicAlive] = true;
+ _globals[kWaterInAPuddle] = false;
+
+ _globals[kFishIn105] = true;
+ _globals[kFishIn107] = true;
+ _globals[kFishIn108] = true;
+
+ /* Section #2 variables */
+ _globals[kLadderBroken] = false;
+ _globals[kBone202Status] = 0;
+ _globals[kRhotundaStatus] = RHOTUNDA_HUNGRY;
+ _globals[kMonkeyStatus] = MONKEY_AMBUSH_READY;
+ _globals[kMeteorologistStatus] = METEOROLOGIST_PRESENT;
+ _globals[kMeteorologistEverSeen] = false;
+ _globals[kMeteorologistWatch] = METEOROLOGIST_NORMAL;
+ _globals[kTeleporterCommand] = TELEPORTER_NONE;
+ _globals[kTeleporterUnderstood] = false;
+ _globals[kTwinklesStatus] = TWINKLES_AT_HOME;
+ _globals[kTwinklesApproached] = 0;
+
+ /* Section #3 variables */
+ _globals[kAfterHavoc] = false;
+ _globals[kKickedIn391Grate] = false;
- // Put the values 0 through 3 in a random order in global slots 87 to 90
- for (int i = 0; i < 4;) {
- int randomVal = _vm->getRandomNumber(3);
- _globals[87 + i] = randomVal;
+ /* Section #4 variables */
+ _globals[kBadFirstIngredient] = -1;
+ _objects.setQuality(OBJ_CHARGE_CASES, EXPLOSIVES_INSIDE, nullptr);
+ _globals[kHasPurchased] = false;
+ _globals[kBeenThruHelgaScene] = false;
+ _globals[kNextIngredient] = 0;
+ _globals[kHasSaidTimer] = false;
+ _globals[kHasSaidBinocs] = false;
+ _globals[kBottleDisplayed] = false;
+ _globals[kHasBeenScanned] = false;
+ _globals[kSomeoneHasExploded] = false;
- bool flag = false;
- for (int idx2 = 0; idx2 < i; ++idx2) {
- if (_globals[87 + idx2] == randomVal)
- flag = true;
- }
+ // Generate a random ingredient list
+ for (count = 0; count < 4; ++count) {
+ do {
+ _globals[kIngredientList + count] = _vm->getRandomNumber(3);
+ bad = false;
+ for (count2 = 0; count2 < count; ++count2) {
+ if (_globals[kIngredientList + count] == _globals[kIngredientList + count2]) {
+ bad = true;
+ }
+ }
+ } while (bad);
+ }
- if (!flag)
- ++i;
+ // Generate random ingredient quantities
+ for (count = 0; count < 4; ++count) {
+ do {
+ _globals[kIngredientQuantity + count] = _vm->getRandomNumber(3);
+ bad = false;
+ for (count2 = 0; count2 < count; ++count2) {
+ if (_globals[kIngredientQuantity + count] == _globals[kIngredientQuantity + count2]) {
+ bad = true;
+ }
+ }
+ } while (bad);
}
- _globals[120] = 501;
- _globals[121] = -1;
- _globals[55] = -1;
- _globals[119] = 1;
- _globals[134] = 4;
-
- // Fill out the globals 200 to 209 with unique random values less than 10000
- for (int i = 0; i < 10; ++i) {
- int randomVal = _vm->getRandomNumber(9999);
- _globals[200 + i] = randomVal;
-
- bool flag = false;
- for (int idx2 = 0; idx2 < i; ++idx2) {
- if (_globals[200 + idx2] == randomVal)
- flag = true;
- }
-
- if (!flag)
- ++i;
+
+ /* Section #5 variables */
+ _globals[kHoverCarLocation] = 501;
+ _globals[kHoverCarDestination] = -1;
+ _globals[kCityFlooded] = false;
+ _globals[kBoatRaised] = true;
+ _globals[kLaserHoleIsThere] = false;
+ _globals[kLineStatus] = LINE_NOT_DROPPED;
+
+
+ /* Section #6 variables */
+ _globals[kHasTalkedToHermit] = false;
+ _globals[kHandsetCellStatus] = FIRST_TIME_PHONE_CELLS;
+ _globals[kTimebombStatus] = TIMEBOMB_DEACTIVATED;
+ _globals[kWarnedFloodCity] = false;
+ _globals._timebombClock = 0;
+ _globals._timebombTimer = 0;
+
+
+ /* Section #7 variables */
+ _globals[kBottleStatus] = BOTTLE_EMPTY;
+ _globals[kBoatStatus] = BOAT_UNFLOODED;
+
+
+ /* Section #8 variables */
+ _globals[kWindowFixed] = false;
+ _globals[kInSpace] = false;
+ _globals[kReturnFromCut] = false;
+ _globals[kBeamIsUp] = false;
+ _globals[kForceBeamDown] = false;
+ _globals[kCameFromCut] = false;
+ _globals[kDontRepeat] = false;
+ _globals[kHoppyDead] = false;
+ _globals[kHasWatchedAntigrav] = false;
+ _globals[kRemoteSequenceRan] = false;
+ _globals[kRemoteOnGround] = false;
+ _globals[kFromCockpit] = false;
+ _globals[kExitShip] = false;
+ _globals[kBetweenRooms] = false;
+ _globals[kTopButtonPushed] = false;
+ _globals[kShieldModInstalled] = false;
+ _globals[kTargetModInstalled] = false;
+ _globals[kUpBecauseOfRemote] = false;
+
+
+ /* Set up the game's teleporters */
+ _globals[kTeleporterRoom] = 201;
+ _globals[kTeleporterRoom + 1] = 301;
+ _globals[kTeleporterRoom + 2] = 413;
+ _globals[kTeleporterRoom + 3] = 706;
+ _globals[kTeleporterRoom + 4] = 801;
+ _globals[kTeleporterRoom + 5] = 551;
+ _globals[kTeleporterRoom + 6] = 752;
+ _globals[kTeleporterRoom + 7] = 0;
+ _globals[kTeleporterRoom + 8] = 0;
+ _globals[kTeleporterRoom + 9] = 0;
+
+ for (count = 0; count < TELEPORTER_COUNT; ++count) {
+ do {
+ _globals[kTeleporterCode + count] = _vm->getRandomNumber(9999);
+ bad = false;
+ for (count2 = 0; count2 < count; ++count2) {
+ if (_globals[kTeleporterCode + count] == _globals[kTeleporterCode + count2]) {
+ bad = true;
+ }
+ }
+ } while (bad);
}
- // Difficulty level control
- switch (_difficultyLevel) {
+ // Final setup based on selected difficulty level
+ switch (_difficulty) {
case DIFFICULTY_HARD:
- _globals[35] = 0;
- _objects.setRoom(9, 1);
- _objects.setRoom(50, 1);
- _globals[137] = 5;
- _globals[136] = 0;
- break;
- case DIFFICULTY_MEDIUM:
- _globals[35] = 0;
- _objects.setRoom(8, 1);
- _globals[137] = -1;
- _globals[136] = 6;
+ _objects.setRoom(OBJ_PLANT_STALK, NOWHERE);
+ _objects.setRoom(OBJ_PENLIGHT, NOWHERE);
+
+ _globals[kLeavesStatus] = LEAVES_ON_TRAP;
break;
- case DIFFICULTY_EASY:
- _globals[35] = 2;
- _objects.setRoom(8, 1);
- _objects.setRoom(27, 1);
+
+ case DIFFICULTY_REALLY_HARD:
+ _objects.setRoom(OBJ_PLANT_STALK, NOWHERE);
+
+ _globals[kLeavesStatus] = LEAVES_ON_GROUND;
+ _globals[kDurafailRecharged] = true;
+ _globals[kPenlightCellStatus] = FIRST_TIME_CHARGED_DURAFAIL;
break;
- default:
+
+ case DIFFICULTY_IMPOSSIBLE:
+ _objects.setRoom(OBJ_BLOWGUN, NOWHERE);
+ _objects.setRoom(OBJ_NOTE, NOWHERE);
+
+ _globals[kLeavesStatus] = LEAVES_ON_GROUND;
+ _globals[kPenlightCellStatus] = FIRST_TIME_UNCHARGED_DURAFAIL;
+ _globals[kDurafailRecharged] = false;
break;
}
- _player._direction = FACING_NORTH;
- _player._newDirection = FACING_NORTH;
+ _player._facing = FACING_NORTH;
+ _player._turnToFacing = FACING_NORTH;
loadResourceSequence("RXM", 1);
loadResourceSequence("ROX", 1);
diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp
index adc58e66aa..c0df8007d9 100644
--- a/engines/mads/nebular/globals_nebular.cpp
+++ b/engines/mads/nebular/globals_nebular.cpp
@@ -34,6 +34,8 @@ Globals::Globals() {
_spriteIndexes.resize(30);
// Initialise game flags
+ _timebombClock = 0;
+ _timebombTimer = 0;
_v0 = 0;
_frameTime = 0;
_v2 = 0;
@@ -53,6 +55,11 @@ Globals::Globals() {
_v84274 = 0;
}
+void Globals::reset() {
+ for (uint i = 0; i < _flags.size(); ++i)
+ _flags[i] = 0;
+}
+
} // End of namespace Nebular
} // End of namespace MADS
diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h
index b3cc94acb3..703dc1b62a 100644
--- a/engines/mads/nebular/globals_nebular.h
+++ b/engines/mads/nebular/globals_nebular.h
@@ -178,7 +178,7 @@ enum GlobalId {
kAntigravTiming = 162,
kAntigravTiming0 = 163,
kWindowFixed = 164,
- kinSpace = 165,
+ kInSpace = 165,
kReturnFromCut = 166,
kBeamIsUp = 167,
kForceBeamDown = 168,
@@ -205,12 +205,85 @@ enum GlobalId {
kTeleporterCode = 200
};
+/* Enums used for specific individual globals */
+/* Section #1 */
+// State of Meteorologist in the outpost
+enum { METEOROLOGIST_ABSENT = 0, METEOROLOGIST_PRESENT = 1, METEOROLOGIST_GONE = 2 };
+
+// State of watching the Meteorologist
+enum { METEOROLOGIST_NORMAL = 0, METEOROLOGIST_GROUND = 1, METEOROLOGIST_TOWER = 2 };
+
+// The fat bouncy lady that can squish you on the plains
+enum { RHOTUNDA_HUNGRY = 0, RHOTUNDA_STUCK = 1, RHOTUNDA_GONE = 2 };
+
+// Flags for the bones you can take
+enum { BONE_202_LEFT_GONE = 1, BONE_202_RIGHT_GONE = 2 };
+
+// Leaves used to cover the trap
+enum { LEAVES_ON_GROUND = 0, LEAVES_WITH_PLAYER = 1, LEAVES_ON_TRAP = 2 };
+
+// Monkey ambush state
+enum { MONKEY_AMBUSH_READY = 0, MONKEY_HAS_BINOCULARS = 1, MONKEY_IS_GONE = 2 };
+
+// Teleporter status flags
+enum {
+ TELEPORTER_NONE = 0, TELEPORTER_BEAM_IN = 1, TELEPORTER_BEAM_OUT = 2,
+ TELEPORTER_STEP_OUT = 3, TELEPORTER_WRONG = 4
+};
+
+// TWinkies status
+enum { TWINKLES_AT_HOME = 0, TWINKLES_GONE = 1 };
+
+/* Section #4 */
+// Status of the explosives
+enum { EXPLOSIVES_INSIDE = 3 };
+
+/* Section # 5 */
+enum { LINE_NOT_DROPPED = 1, LINE_DROPPED = 2, LINE_TIED = 3, LINE_NOW_UNTIED = 4 };
+
+/* Section #6 */
+enum {
+ NO_CELLS = 0, // Handset doesn't contain any cells
+ CHARGED_DURAFAIL = 1, // Handset has charged durafail cells
+ UNCHARGED_DURAFAIL = 2, // Handset has uncharged durafail cells */
+ PHONE_CELLS = 3, // Handset has already charged phone cells
+ FIRST_TIME_PHONE_CELLS = 4, // First time phone cells are in the handset
+ FIRST_TIME_UNCHARGED_DURAFAIL = 5, // First time uncharged cells are in penlight
+ FIRST_TIME_CHARGED_DURAFAIL = 6 // First time charged cells are in penlight
+};
+
+// Time bomb status
+enum {
+ TIMEBOMB_DEACTIVATED = 0, TIMEBOMB_ACTIVATED = 1,
+ TIMEBOMB_BLOW_UP = 2, TIMEBOMB_DEAD = 3
+};
+
+/* Section #7 */
+// Status of the the bottle
+enum {
+ BOTTLE_EMPTY = 0, BOTTLE_ONE_QUARTER_FULL = 1, BOTTLE_HALF_FULL = 2,
+ BOTTLE_THREE_QUARTERS_FULL = 3, BOTTLE_FULL = 4
+};
+
+// Status of the boat
+enum {
+ BOAT_UNFLOODED = 0, BOAT_ADRIFT = 1, BOAT_TIED_FLOATING = 2,
+ BOAT_TIED = 3, BOAT_GONE = 4
+};
+
+
+/* Miscellaneous defines */
+#define TELEPORTER_COUNT 10 // Total number of teleporters
+#define TELEPORTER_WORK_COUNT 6 // Total number that actually work
+
+
class Globals {
private:
Common::Array<int16> _flags;
public:
Common::Array<int> _spriteIndexes;
-
+
+ int _timebombClock, _timebombTimer;
int _v0;
uint32 _frameTime;
int _v2;
@@ -233,6 +306,11 @@ public:
* Square brackets operator for accessing flags
*/
int16 &operator[](int idx) { return _flags[idx]; }
+
+ /*
+ * Resets all the globals to empty
+ */
+ void reset();
};
} // End of namespace Nebular
diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp
index 4fc1e3e48d..d0814f0ef2 100644
--- a/engines/mads/nebular/nebular_scenes2.cpp
+++ b/engines/mads/nebular/nebular_scenes2.cpp
@@ -152,7 +152,7 @@ void Scene201::enter() {
_game._player._playerPos = Common::Point(165, 152);
} else {
_game._player._playerPos = Common::Point(223, 149);
- _game._player._direction = FACING_SOUTH;
+ _game._player._facing = FACING_SOUTH;
}
if (_globals[kTeleporterCommand] != 0) {
@@ -391,10 +391,10 @@ void Scene202::enter() {
if (_scene->_priorSceneId == 201) {
_game._player._playerPos = Common::Point(190, 91);
- _game._player._direction = FACING_SOUTH;
+ _game._player._facing = FACING_SOUTH;
} else if (_scene->_priorSceneId != -2) {
_game._player._playerPos = Common::Point(178, 152);
- _game._player._direction = FACING_NORTH;
+ _game._player._facing = FACING_NORTH;
}
if (_globals[kLadderBroken]) {
@@ -440,12 +440,12 @@ void Scene202::enter() {
if (_globals._v4) {
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82));
_game._player._playerPos = Common::Point(246, 124);
- _game._player._direction = FACING_NORTH;
+ _game._player._facing = FACING_NORTH;
_globals[kTeleporterUnderstood] = -1;
} else {
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123));
_game._player._playerPos = Common::Point(171, 122);
- _game._player._direction = FACING_NORTH;
+ _game._player._facing = FACING_NORTH;
}
_scene->loadAnimation(formAnimName('M', -1), 71);
@@ -456,7 +456,7 @@ void Scene202::enter() {
_scene->_sequences.setDepth(_globals._spriteIndexes[24], 1);
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82));
_game._player._playerPos = Common::Point(246, 124);
- _game._player._direction = FACING_NORTH;
+ _game._player._facing = FACING_NORTH;
}
_globals._abortVal = 0;
}
@@ -470,7 +470,7 @@ void Scene202::setRandomKernelMessage() {
}
void Scene202::step() {
- if ((_globals._v0 == 0) && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._direction == 8) && (_vm->getRandomNumber(999) == 0)) {
+ if ((_globals._v0 == 0) && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8) && (_vm->getRandomNumber(999) == 0)) {
_scene->_kernelMessages.reset();
_globals._v0 = 0;
if (_vm->getRandomNumber(4) == 0)
@@ -949,7 +949,7 @@ void Scene202::actions() {
} else if (action->isAction(0x3, 0x142, 0)) {
Dialog::show(0x4EF2);
} else if (action->isAction(0x3, 0xAA, 0)) {
- if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._direction == 8))
+ if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8))
Dialog::show(0x4EF4);
else
Dialog::show(0x4EF3);
@@ -986,13 +986,13 @@ void Scene203::setup() {
void Scene203::enter() {
if (_scene->_priorSceneId == 202) {
_game._player._playerPos = Common::Point(187, 99);
- _game._player._direction = FACING_SOUTH;
+ _game._player._facing = FACING_SOUTH;
} else if (_scene->_priorSceneId == 209) {
_game._player._playerPos = Common::Point(308, 117);
- _game._player._direction = FACING_WEST;
+ _game._player._facing = FACING_WEST;
} else if (_scene->_priorSceneId == -2) {
_game._player._playerPos = Common::Point(155, 152);
- _game._player._direction = FACING_NORTH;
+ _game._player._facing = FACING_NORTH;
}
_globals._v0 = 0;
@@ -1032,7 +1032,7 @@ void Scene203::step() {
if ((_game._abortTimers == 0) && (_globals._frameTime != 0))
return;
- if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._direction != 2))
+ if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._facing != 2))
return;
_globals._frameTime = 0xFFFF;
@@ -1239,10 +1239,10 @@ void Scene207::enter() {
_globals._v2 = 0;
if (_scene->_priorSceneId == 211) {
_game._player._playerPos = Common::Point(13, 105);
- _game._player._direction = FACING_EAST;
+ _game._player._facing = FACING_EAST;
} else if (_scene->_priorSceneId == 214) {
_game._player._playerPos = Common::Point(164, 117);
- _game._player._direction = FACING_SOUTH;
+ _game._player._facing = FACING_SOUTH;
} else if (_scene->_priorSceneId != -2) {
_game._player._playerPos = Common::Point(305, 131);
}
@@ -1386,16 +1386,16 @@ void Scene208::enter() {
if (_scene->_priorSceneId == 207) {
_game._player._playerPos = Common::Point(8, 122);
- _game._player._direction = FACING_EAST;
+ _game._player._facing = FACING_EAST;
} else if (_scene->_priorSceneId == 203) {
_game._player._playerPos = Common::Point(142, 108);
- _game._player._direction = FACING_SOUTH;
+ _game._player._facing = FACING_SOUTH;
} else if (_scene->_priorSceneId == 209) {
_game._player._playerPos = Common::Point(307, 123);
- _game._player._direction = FACING_WEST;
+ _game._player._facing = FACING_WEST;
} else if (_scene->_priorSceneId != -2) {
_game._player._playerPos = Common::Point(162, 149);
- _game._player._direction = FACING_NORTH;
+ _game._player._facing = FACING_NORTH;
}
_game.loadQuoteSet(0x81, 0x46, 0);
@@ -1421,7 +1421,7 @@ void Scene208::step() {
if (_globals._v0 == 0)
return;
- if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._direction != 6))
+ if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._facing != 6))
return;
if ((_game._abortTimers == 0) && ((_globals._frameTime & 0xFFFF) != 0))
@@ -1515,7 +1515,7 @@ void Scene208::actions() {
} else if (_action.isAction(0x3, 0x1AA, 0)) {
Dialog::show(0x5149);
} else if (_action.isAction(0x3, 0x1A9, 0)) {
- if (_game._difficultyLevel == DIFFICULTY_EASY)
+ if (_game._difficulty == DIFFICULTY_IMPOSSIBLE)
Dialog::show(0x514A);
else
Dialog::show(0x514B);
diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp
index c60a43a5e1..fa928916d6 100644
--- a/engines/mads/nebular/nebular_scenes8.cpp
+++ b/engines/mads/nebular/nebular_scenes8.cpp
@@ -90,7 +90,7 @@ void Scene804::enter() {
_globals._v8 = 0;
if (_globals[kCopyProtectFailed]) {
// Copy protection failed
- _globals[kinSpace] = -1;
+ _globals[kInSpace] = true;
_globals[kWindowFixed] = 0;
}
@@ -103,7 +103,7 @@ void Scene804::enter() {
_game.loadQuoteSet(791, 0);
- if (_globals[kinSpace]) {
+ if (_globals[kInSpace]) {
if (_globals[kWindowFixed]) {
_globals._spriteIndexes[20] = _scene->_sequences.startCycle(
_globals._spriteIndexes[5], 0, 1);
@@ -137,7 +137,7 @@ void Scene804::enter() {
Scene8xx::enter1();
- if (_globals[kinSpace] && !_globals[kWindowFixed]) {
+ if (_globals[kInSpace] && !_globals[kWindowFixed]) {
_scene->_userInterface.setup(2);
_vm->_sound->command(19);
}
@@ -191,7 +191,7 @@ void Scene804::step() {
if (_scene->_activeAnimation->getCurrentFrame() == 81) {
_globals._v5 = 80;
} else {
- _globals[kinSpace] = 0;
+ _globals[kInSpace] = 0;
_globals[kBeamIsUp] = -1;
assert(!_globals[kCopyProtectFailed]);
_game._winStatus = 4;
@@ -203,7 +203,7 @@ void Scene804::step() {
if (_scene->_activeAnimation->getCurrentFrame() == 68) {
_globals._v5 = 66;
} else {
- _globals[kinSpace] = 0;
+ _globals[kInSpace] = 0;
_globals[kBeamIsUp] = -1;
assert(!_globals[kCopyProtectFailed]);
_game._winStatus = 4;
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index 03d03cb4a8..115a63045f 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -34,8 +34,8 @@ const int Player::_directionListIndexes[32] = {
Player::Player(MADSEngine *vm): _vm(vm) {
_action = nullptr;
- _direction = FACING_NORTH;
- _newDirection = FACING_NORTH;
+ _facing = FACING_NORTH;
+ _turnToFacing = FACING_NORTH;
_targetFacing = FACING_NORTH;
_spritesLoaded = false;
_spritesStart = 0;
@@ -73,7 +73,7 @@ void Player::reset() {
_action = &_vm->_game->_scene._action;
_destPos = _playerPos;
_targetFacing = FACING_NONE;
- _newDirection = _direction;
+ _turnToFacing = _facing;
_moving = false;
_newSceneId = _v844BE = 0;
_next = 0;
@@ -133,42 +133,42 @@ bool Player::loadSprites(const Common::String &prefix) {
void Player::turnToDestFacing() {
if (_targetFacing != 5)
- _newDirection = _targetFacing;
+ _turnToFacing = _targetFacing;
}
void Player::dirChanged() {
int dirIndex = 0, dirIndex2 = 0;
int newDir = 0, newDir2 = 0;
- if (_direction != _newDirection) {
+ if (_facing != _turnToFacing) {
// Find the index for the given direction in the player direction list
- int tempDir = _direction;
+ int tempDir = _facing;
do {
++dirIndex;
newDir += tempDir;
tempDir = _directionListIndexes[tempDir + 10];
- } while (tempDir != _newDirection);
+ } while (tempDir != _turnToFacing);
}
- if (_direction != _newDirection) {
+ if (_facing != _turnToFacing) {
// Find the index for the given direction in the player direction list
- int tempDir = _direction;
+ int tempDir = _facing;
do {
++dirIndex2;
newDir2 += tempDir;
tempDir = _directionListIndexes[tempDir + 20];
- } while (tempDir != _newDirection);
+ } while (tempDir != _turnToFacing);
}
int diff = dirIndex - dirIndex2;
if (diff == 0)
diff = newDir - newDir2;
- _direction = (diff >= 0) ? (Facing)_directionListIndexes[_direction + 20] :
- (Facing)_directionListIndexes[_direction + 10];
+ _facing = (diff >= 0) ? (Facing)_directionListIndexes[_facing + 20] :
+ (Facing)_directionListIndexes[_facing + 10];
setupFrame();
- if ((_direction == _newDirection) && !_moving)
+ if ((_facing == _turnToFacing) && !_moving)
updateFrame();
_priorTimer += 1;
@@ -184,7 +184,7 @@ void Player::setupFrame() {
resetActionList();
_frameOffset = 0;
- _spritesIdx = _directionListIndexes[_direction];
+ _spritesIdx = _directionListIndexes[_facing];
if (!_spriteSetsPresent[_spritesIdx]) {
// Direction isn't present, so use alternate direction, with entries flipped
_spritesIdx -= 4;
@@ -425,7 +425,7 @@ void Player::move() {
if (routeFlag && _moving)
startMovement();
- if (_newDirection != _direction)
+ if (_turnToFacing != _facing)
dirChanged();
else if (!_moving)
updateFrame();
@@ -436,7 +436,7 @@ void Player::move() {
var1 = MAX(1, 10000 / (v1 * _currentScale * var1));
}
- if (!_moving || (_direction != _newDirection))
+ if (!_moving || (_facing != _turnToFacing))
return;
Common::Point newPos = _playerPos;
@@ -490,7 +490,7 @@ void Player::move() {
void Player::idle() {
Scene &scene = _vm->_game->_scene;
- if (_direction != _newDirection) {
+ if (_facing != _turnToFacing) {
// The direction has changed, so reset for new direction
dirChanged();
return;
@@ -717,14 +717,14 @@ void Player::startMovement() {
switch (majorDir) {
case 1:
- _newDirection = (_yDirection <= 0) ? FACING_NORTH : FACING_SOUTH;
+ _turnToFacing = (_yDirection <= 0) ? FACING_NORTH : FACING_SOUTH;
break;
case 2: {
- _newDirection = (Facing)(((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0));
+ _turnToFacing = (Facing)(((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0));
break;
}
case 3:
- _newDirection = (_xDirection <= 0) ? FACING_WEST : FACING_EAST;
+ _turnToFacing = (_xDirection <= 0) ? FACING_WEST : FACING_EAST;
break;
default:
break;
diff --git a/engines/mads/player.h b/engines/mads/player.h
index 6daacd99ab..754ac7edc8 100644
--- a/engines/mads/player.h
+++ b/engines/mads/player.h
@@ -105,8 +105,8 @@ private:
public:
MADSAction *_action;
- Facing _direction;
- Facing _newDirection;
+ Facing _facing;
+ Facing _turnToFacing;
int _xDirection, _yDirection;
Facing _targetFacing;
bool _spritesLoaded;
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index 6a42ed9005..c90a54c317 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -323,7 +323,7 @@ void Scene::doFrame() {
_frameStartTime = _vm->_events->getFrameCounter();
if ((_action._inProgress && !player._moving && !_action._startWalkFlag &&
- player._newDirection == player._direction) ||
+ player._turnToFacing == player._facing) ||
(_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_0)) {
doAction();
}