aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/game
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lastexpress/game')
-rw-r--r--engines/lastexpress/game/action.cpp116
-rw-r--r--engines/lastexpress/game/action.h28
-rw-r--r--engines/lastexpress/game/entities.h8
-rw-r--r--engines/lastexpress/game/inventory.cpp56
-rw-r--r--engines/lastexpress/game/inventory.h20
-rw-r--r--engines/lastexpress/game/logic.cpp6
-rw-r--r--engines/lastexpress/game/logic.h2
-rw-r--r--engines/lastexpress/game/object.cpp29
-rw-r--r--engines/lastexpress/game/object.h28
-rw-r--r--engines/lastexpress/game/savegame.h54
-rw-r--r--engines/lastexpress/game/scenes.cpp12
-rw-r--r--engines/lastexpress/game/state.h12
12 files changed, 186 insertions, 185 deletions
diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index 796abf2ce7..c6ea6f6c8a 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -351,42 +351,42 @@ Action::Action(LastExpressEngine *engine) : _engine(engine) {
ADD_ACTION(savePoint);
ADD_ACTION(playSound);
ADD_ACTION(playMusic);
- ADD_ACTION(knock);
+ ADD_ACTION(knock); // 5
ADD_ACTION(compartment);
ADD_ACTION(playSounds);
ADD_ACTION(playAnimation);
ADD_ACTION(openCloseObject);
- ADD_ACTION(updateObjetLocation2);
- ADD_ACTION(setItemLocation);
- ADD_ACTION(knockNoSound);
+ ADD_ACTION(setModel); // 10
+ ADD_ACTION(setItem);
+ ADD_ACTION(knockInside);
ADD_ACTION(pickItem);
ADD_ACTION(dropItem);
- ADD_ACTION(dummy);
+ ADD_ACTION(dummy); // 15
ADD_ACTION(enterCompartment);
ADD_ACTION(dummy);
- ADD_ACTION(getOutsideTrain);
- ADD_ACTION(slip);
- ADD_ACTION(getInsideTrain);
- ADD_ACTION(climbUpTrain);
+ ADD_ACTION(leanOutWindow);
+ ADD_ACTION(almostFall);
+ ADD_ACTION(climbInWindow); // 20
+ ADD_ACTION(climbLadder);
ADD_ACTION(climbDownTrain);
- ADD_ACTION(jumpUpDownTrain);
- ADD_ACTION(unbound);
- ADD_ACTION(25);
- ADD_ACTION(26);
+ ADD_ACTION(kronosSanctum);
+ ADD_ACTION(escapeBaggage);
+ ADD_ACTION(enterBaggage); // 25
+ ADD_ACTION(bombPuzzle);
ADD_ACTION(27);
- ADD_ACTION(concertSitCough);
+ ADD_ACTION(kronosConcert);
ADD_ACTION(29);
- ADD_ACTION(catchBeetle);
+ ADD_ACTION(catchBeetle); // 30
ADD_ACTION(exitCompartment);
- ADD_ACTION(32);
- ADD_ACTION(useWhistle);
+ ADD_ACTION(outsideTrain);
+ ADD_ACTION(firebirdPuzzle);
ADD_ACTION(openMatchBox);
- ADD_ACTION(openBed);
+ ADD_ACTION(openBed); // 35
ADD_ACTION(dummy);
ADD_ACTION(dialog);
ADD_ACTION(eggBox);
ADD_ACTION(39);
- ADD_ACTION(bed);
+ ADD_ACTION(bed); // 40
ADD_ACTION(playMusicChapter);
ADD_ACTION(playMusicChapterSetupTrain);
ADD_ACTION(switchChapter);
@@ -521,7 +521,7 @@ IMPLEMENT_ACTION(compartment)
return kSceneNone;
}
- ObjectLocation location = getObjects()->get(compartment).location;
+ ObjectLocation location = getObjects()->get(compartment).status;
if (location == kObjectLocation1 || location == kObjectLocation3 || getEntities()->checkFields2(compartment)) {
if (location != kObjectLocation1 || getEntities()->checkFields2(compartment)
@@ -625,14 +625,14 @@ IMPLEMENT_ACTION(openCloseObject)
//////////////////////////////////////////////////////////////////////////
// Action 10
-IMPLEMENT_ACTION(updateObjetLocation2)
+IMPLEMENT_ACTION(setModel)
ObjectIndex object = (ObjectIndex)hotspot.param1;
- ObjectLocation location = (ObjectLocation)hotspot.param2;
+ ObjectModel model = (ObjectModel)hotspot.param2;
if (object >= kObjectMax)
return kSceneInvalid;
- getObjects()->updateLocation2(object, location);
+ getObjects()->updateModel(object, model);
if (object != kObject112 || getSoundQueue()->isBuffered("LIB096")) {
if (object == 1)
@@ -646,13 +646,13 @@ IMPLEMENT_ACTION(updateObjetLocation2)
//////////////////////////////////////////////////////////////////////////
// Action 11
-IMPLEMENT_ACTION(setItemLocation)
+IMPLEMENT_ACTION(setItem)
InventoryItem item = (InventoryItem)hotspot.param1;
if (item >= kPortraitOriginal)
return kSceneInvalid;
Inventory::InventoryEntry *entry = getInventory()->get(item);
- if (entry->isPresent)
+ if (entry->inPocket)
return kSceneInvalid;
entry->location = (ObjectLocation)hotspot.param2;
@@ -667,7 +667,7 @@ IMPLEMENT_ACTION(setItemLocation)
//////////////////////////////////////////////////////////////////////////
// Action 12
-IMPLEMENT_ACTION(knockNoSound)
+IMPLEMENT_ACTION(knockInside)
ObjectIndex object = (ObjectIndex)hotspot.param1;
if (object >= kObjectMax)
return kSceneInvalid;
@@ -726,7 +726,7 @@ IMPLEMENT_ACTION(pickItem)
break;
case kItemBomb:
- RESET_ENTITY_STATE(kEntityAbbot, Abbot, setup_pickBomb);
+ RESET_ENTITY_STATE(kEntityAbbot, Abbot, setup_catchCath);
break;
case kItemBriefcase:
@@ -808,7 +808,7 @@ IMPLEMENT_ACTION(dropItem)
//////////////////////////////////////////////////////////////////////////
// Action 16
IMPLEMENT_ACTION(enterCompartment)
- if (getObjects()->get(kObjectCompartment1).location == kObjectLocation1 || getObjects()->get(kObjectCompartment1).location == kObjectLocation3 || getInventory()->getSelectedItem() == kItemKey)
+ if (getObjects()->get(kObjectCompartment1).status == kObjectLocation1 || getObjects()->get(kObjectCompartment1).status == kObjectLocation3 || getInventory()->getSelectedItem() == kItemKey)
return action_compartment(hotspot);
if (getProgress().eventCorpseFound) {
@@ -842,12 +842,12 @@ IMPLEMENT_ACTION(enterCompartment)
//////////////////////////////////////////////////////////////////////////
// Action 18
-IMPLEMENT_ACTION(getOutsideTrain)
+IMPLEMENT_ACTION(leanOutWindow)
ObjectIndex object = (ObjectIndex)hotspot.param1;
- if ((getEvent(kEventCathLookOutsideWindowDay) || getEvent(kEventCathLookOutsideWindowNight) || getObjects()->get(kObjectCompartment1).location2 == kObjectLocation1)
+ if ((getEvent(kEventCathLookOutsideWindowDay) || getEvent(kEventCathLookOutsideWindowNight) || getObjects()->get(kObjectCompartment1).model == kObjectModel1)
&& getProgress().isTrainRunning
- && (object != kObjectOutsideAnnaCompartment || (!getEntities()->isInsideCompartment(kEntityRebecca, kCarRedSleeping, kPosition_4840) && getObjects()->get(kObjectOutsideBetweenCompartments).location == kObjectLocation2))
+ && (object != kObjectOutsideAnnaCompartment || (!getEntities()->isInsideCompartment(kEntityRebecca, kCarRedSleeping, kPosition_4840) && getObjects()->get(kObjectOutsideBetweenCompartments).status == kObjectLocation2))
&& getInventory()->getSelectedItem() != kItemFirebird
&& getInventory()->getSelectedItem() != kItemBriefcase) {
@@ -887,7 +887,7 @@ IMPLEMENT_ACTION(getOutsideTrain)
//////////////////////////////////////////////////////////////////////////
// Action 19
-IMPLEMENT_ACTION(slip)
+IMPLEMENT_ACTION(almostFall)
switch((ObjectIndex)hotspot.param1) {
default:
return kSceneInvalid;
@@ -911,7 +911,7 @@ IMPLEMENT_ACTION(slip)
//////////////////////////////////////////////////////////////////////////
// Action 20
-IMPLEMENT_ACTION(getInsideTrain)
+IMPLEMENT_ACTION(climbInWindow)
switch ((ObjectIndex)hotspot.param1) {
default:
return kSceneInvalid;
@@ -937,7 +937,7 @@ IMPLEMENT_ACTION(getInsideTrain)
//////////////////////////////////////////////////////////////////////////
// Action 21
-IMPLEMENT_ACTION(climbUpTrain)
+IMPLEMENT_ACTION(climbLadder)
byte action = hotspot.param1;
if (action != 1 && action != 2)
@@ -999,7 +999,7 @@ IMPLEMENT_ACTION(climbDownTrain)
//////////////////////////////////////////////////////////////////////////
// Action 23
-IMPLEMENT_ACTION(jumpUpDownTrain)
+IMPLEMENT_ACTION(kronosSanctum)
switch (hotspot.param1) {
default:
break;
@@ -1038,7 +1038,7 @@ IMPLEMENT_ACTION(jumpUpDownTrain)
//////////////////////////////////////////////////////////////////////////
// Action 24
-IMPLEMENT_ACTION(unbound)
+IMPLEMENT_ACTION(escapeBaggage)
byte action = hotspot.param1;
switch (action) {
@@ -1086,7 +1086,7 @@ IMPLEMENT_ACTION(unbound)
//////////////////////////////////////////////////////////////////////////
// Action 25
-IMPLEMENT_ACTION(25)
+IMPLEMENT_ACTION(enterBaggage)
switch(hotspot.param1) {
default:
break;
@@ -1103,7 +1103,7 @@ IMPLEMENT_ACTION(25)
case 3:
getSound()->playSoundEvent(kEntityPlayer, 43);
if (!getInventory()->hasItem(kItemKey) && !getEvent(kEventAnnaBaggageArgument)) {
- RESET_ENTITY_STATE(kEntityAnna, Anna, setup_baggage);
+ RESET_ENTITY_STATE(kEntityAnna, Anna, setup_baggageFight);
return kSceneNone;
}
break;
@@ -1114,7 +1114,7 @@ IMPLEMENT_ACTION(25)
//////////////////////////////////////////////////////////////////////////
// Action 26
-IMPLEMENT_ACTION(26)
+IMPLEMENT_ACTION(bombPuzzle)
switch(hotspot.param1) {
default:
return kSceneInvalid;
@@ -1168,7 +1168,7 @@ IMPLEMENT_ACTION(27)
//////////////////////////////////////////////////////////////////////////
// Action 28
-IMPLEMENT_ACTION(concertSitCough)
+IMPLEMENT_ACTION(kronosConcert)
switch(hotspot.param1) {
default:
return kSceneInvalid;
@@ -1224,7 +1224,7 @@ IMPLEMENT_ACTION(exitCompartment)
getProgress().field_30 = 1;
}
- getObjects()->updateLocation2(kObjectCompartment1, (ObjectLocation)hotspot.param2);
+ getObjects()->updateModel(kObjectCompartment1, (ObjectModel)hotspot.param2);
// fall to case enterCompartment action
return action_enterCompartment(hotspot);
@@ -1232,7 +1232,7 @@ IMPLEMENT_ACTION(exitCompartment)
//////////////////////////////////////////////////////////////////////////
// Action 32
-IMPLEMENT_ACTION(32)
+IMPLEMENT_ACTION(outsideTrain)
switch(hotspot.param1) {
default:
break;
@@ -1273,7 +1273,7 @@ IMPLEMENT_ACTION(32)
//////////////////////////////////////////////////////////////////////////
// Action 33
-IMPLEMENT_ACTION(useWhistle)
+IMPLEMENT_ACTION(firebirdPuzzle)
EventIndex evt = kEventNone;
SceneIndex sceneIndex = kSceneInvalid;
@@ -1335,7 +1335,7 @@ IMPLEMENT_ACTION(useWhistle)
IMPLEMENT_ACTION(openMatchBox)
// If the match is already in the inventory, do nothing
if (!getInventory()->get(kItemMatch)->location
- || getInventory()->get(kItemMatch)->isPresent)
+ || getInventory()->get(kItemMatch)->inPocket)
return kSceneInvalid;
getInventory()->addItem(kItemMatch);
@@ -1392,7 +1392,7 @@ IMPLEMENT_ACTION(39)
IMPLEMENT_ACTION(bed)
getSound()->playSoundEvent(kEntityPlayer, 85);
// falls to case knockNoSound
- return action_knockNoSound(hotspot);
+ return action_knockInside(hotspot);
}
//////////////////////////////////////////////////////////////////////////
@@ -1724,7 +1724,7 @@ bool Action::handleOtherCompartment(ObjectIndex object, bool doPlaySound, bool d
}
void Action::playCompartmentSoundEvents(ObjectIndex object) const {
- if (getObjects()->get(object).location == kObjectLocation1 || getObjects()->get(object).location == kObjectLocation3 || getEntities()->checkFields2(object)) {
+ if (getObjects()->get(object).status == kObjectLocation1 || getObjects()->get(object).status == kObjectLocation3 || getEntities()->checkFields2(object)) {
getSound()->playSoundEvent(kEntityPlayer, 13);
} else {
getSound()->playSoundEvent(kEntityPlayer, 14);
@@ -1757,7 +1757,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
if (object >= kObjectMax)
return kCursorNormal;
else
- return (CursorStyle)getObjects()->get(object).cursor;
+ return (CursorStyle)getObjects()->get(object).windowCursor;
case SceneHotspot::kAction12:
debugC(2, kLastExpressDebugScenes, "================================= OBJECT %03d =================================", object);
@@ -1765,7 +1765,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
return kCursorNormal;
if (getObjects()->get(object).entity)
- return (CursorStyle)getObjects()->get(object).cursor;
+ return (CursorStyle)getObjects()->get(object).windowCursor;
else
return kCursorNormal;
@@ -1774,7 +1774,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
if (object >= kObjectCompartmentA)
return kCursorNormal;
- if ((!getInventory()->getSelectedItem() || getInventory()->getSelectedEntry()->manualSelect)
+ if ((!getInventory()->getSelectedItem() || getInventory()->getSelectedEntry()->floating)
&& (object != kObject21 || getProgress().eventCorpseMovedFromFloor))
return kCursorHand;
else
@@ -1806,8 +1806,8 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
return kCursorNormal;
case SceneHotspot::kActionEnterCompartment:
- if ((getInventory()->getSelectedItem() != kItemKey || getObjects()->get(kObjectCompartment1).location)
- && (getObjects()->get(kObjectCompartment1).location != 1 || !getInventory()->hasItem(kItemKey)
+ if ((getInventory()->getSelectedItem() != kItemKey || getObjects()->get(kObjectCompartment1).status)
+ && (getObjects()->get(kObjectCompartment1).status != 1 || !getInventory()->hasItem(kItemKey)
|| (getInventory()->getSelectedItem() != kItemFirebird && getInventory()->getSelectedItem() != kItemBriefcase)))
goto LABEL_KEY;
@@ -1817,13 +1817,13 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
if (getProgress().jacket != kJacketGreen)
return kCursorNormal;
- if ((getEvent(kEventCathLookOutsideWindowDay) || getEvent(kEventCathLookOutsideWindowNight) || getObjects()->get(kObjectCompartment1).location2 == kObjectLocation1)
+ if ((getEvent(kEventCathLookOutsideWindowDay) || getEvent(kEventCathLookOutsideWindowNight) || getObjects()->get(kObjectCompartment1).model == kObjectModel1)
&& getProgress().isTrainRunning
- && (object != kObjectOutsideAnnaCompartment || (getEntities()->isInsideCompartment(kEntityRebecca, kCarRedSleeping, kPosition_4840) && getObjects()->get(kObjectOutsideBetweenCompartments).location == 2))
+ && (object != kObjectOutsideAnnaCompartment || (getEntities()->isInsideCompartment(kEntityRebecca, kCarRedSleeping, kPosition_4840) && getObjects()->get(kObjectOutsideBetweenCompartments).status == 2))
&& getInventory()->getSelectedItem() != kItemBriefcase && getInventory()->getSelectedItem() != kItemFirebird)
return kCursorForward;
- return (getObjects()->get(kObjectCompartment1).location2 < kObjectLocation2) ? kCursorNormal : kCursorMagnifier;
+ return (getObjects()->get(kObjectCompartment1).model < kObjectModel2) ? kCursorNormal : kCursorMagnifier;
case SceneHotspot::kActionSlip:
return (getProgress().field_C8 < 1) ? kCursorNormal : kCursorLeft;
@@ -1841,7 +1841,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
if (object != kObjectCompartment1)
return kCursorNormal;
- return (getObjects()->get(kObjectCeiling).location < kObjectLocation1) ? kCursorHand : kCursorNormal;
+ return (getObjects()->get(kObjectCeiling).status < kObjectLocation1) ? kCursorHand : kCursorNormal;
case SceneHotspot::kActionUnbound:
if (hotspot.param2 != 2)
@@ -1904,11 +1904,11 @@ LABEL_KEY:
if (getInventory()->getSelectedItem() != kItemKey
|| getObjects()->get(object).entity
- || getObjects()->get(object).location != 1
- || !getObjects()->get(object).cursor2
+ || getObjects()->get(object).status != 1
+ || !getObjects()->get(object).handleCursor
|| getEntities()->isInsideCompartments(kEntityPlayer)
|| getEntities()->checkFields2(object))
- return (CursorStyle)getObjects()->get(object).cursor2;
+ return (CursorStyle)getObjects()->get(object).handleCursor;
else
return (CursorStyle)getInventory()->get(kItemKey)->cursor;
}
diff --git a/engines/lastexpress/game/action.h b/engines/lastexpress/game/action.h
index e1a4a53224..3dad51d0d3 100644
--- a/engines/lastexpress/game/action.h
+++ b/engines/lastexpress/game/action.h
@@ -82,28 +82,28 @@ private:
DECLARE_ACTION(playSounds);
DECLARE_ACTION(playAnimation);
DECLARE_ACTION(openCloseObject);
- DECLARE_ACTION(updateObjetLocation2);
- DECLARE_ACTION(setItemLocation);
- DECLARE_ACTION(knockNoSound);
+ DECLARE_ACTION(setModel);
+ DECLARE_ACTION(setItem);
+ DECLARE_ACTION(knockInside);
DECLARE_ACTION(pickItem);
DECLARE_ACTION(dropItem);
DECLARE_ACTION(enterCompartment);
- DECLARE_ACTION(getOutsideTrain);
- DECLARE_ACTION(slip);
- DECLARE_ACTION(getInsideTrain);
- DECLARE_ACTION(climbUpTrain);
+ DECLARE_ACTION(leanOutWindow);
+ DECLARE_ACTION(almostFall);
+ DECLARE_ACTION(climbInWindow);
+ DECLARE_ACTION(climbLadder);
DECLARE_ACTION(climbDownTrain);
- DECLARE_ACTION(jumpUpDownTrain);
- DECLARE_ACTION(unbound);
- DECLARE_ACTION(25);
- DECLARE_ACTION(26);
+ DECLARE_ACTION(kronosSanctum);
+ DECLARE_ACTION(escapeBaggage);
+ DECLARE_ACTION(enterBaggage);
+ DECLARE_ACTION(bombPuzzle);
DECLARE_ACTION(27);
- DECLARE_ACTION(concertSitCough);
+ DECLARE_ACTION(kronosConcert);
DECLARE_ACTION(29);
DECLARE_ACTION(catchBeetle);
DECLARE_ACTION(exitCompartment);
- DECLARE_ACTION(32);
- DECLARE_ACTION(useWhistle);
+ DECLARE_ACTION(outsideTrain);
+ DECLARE_ACTION(firebirdPuzzle);
DECLARE_ACTION(openMatchBox);
DECLARE_ACTION(openBed);
DECLARE_ACTION(dialog);
diff --git a/engines/lastexpress/game/entities.h b/engines/lastexpress/game/entities.h
index 81aed627aa..cacbc408c9 100644
--- a/engines/lastexpress/game/entities.h
+++ b/engines/lastexpress/game/entities.h
@@ -110,7 +110,7 @@ public:
* Query if 'entity' is inside a compartment
*
* @param entity The entity.
- * @param car The car.
+ * @param car The car.
* @param position The position.
*
* @return true if inside the compartment, false if not.
@@ -247,7 +247,7 @@ public:
/**
* Query if nobody is in a compartment at that position.
*
- * @param car The car.
+ * @param car The car.
* @param position The position.
*
* @return true if nobody is in a compartment, false if not.
@@ -334,8 +334,8 @@ private:
static const int _compartmentsCount = 16;
static const int _positionsCount = 100 * 10; // 100 positions per train car
- LastExpressEngine *_engine;
- EntityData *_header;
+ LastExpressEngine *_engine;
+ EntityData *_header;
Common::Array<Entity *> _entities;
// Compartments & positions
diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp
index 2f1b0a8e76..11a76a77f0 100644
--- a/engines/lastexpress/game/inventory.cpp
+++ b/engines/lastexpress/game/inventory.cpp
@@ -97,19 +97,19 @@ void Inventory::init() {
_entries[kItemPassengerList].isSelectable = true;
// Auto selection
- _entries[kItem2].manualSelect = false;
- _entries[kItem3].manualSelect = false;
- _entries[kItem5].manualSelect = false;
- _entries[kItem7].manualSelect = false;
- _entries[kItem9].manualSelect = false;
- _entries[kItem11].manualSelect = false;
- _entries[kItemBeetle].manualSelect = false;
- _entries[kItem17].manualSelect = false;
- _entries[kItemFirebird].manualSelect = false;
- _entries[kItemBriefcase].manualSelect = false;
- _entries[kItemCorpse].manualSelect = false;
- _entries[kItemGreenJacket].manualSelect = false;
- _entries[kItem22].manualSelect = false;
+ _entries[kItem2].floating = false;
+ _entries[kItem3].floating = false;
+ _entries[kItem5].floating = false;
+ _entries[kItem7].floating = false;
+ _entries[kItem9].floating = false;
+ _entries[kItem11].floating = false;
+ _entries[kItemBeetle].floating = false;
+ _entries[kItem17].floating = false;
+ _entries[kItemFirebird].floating = false;
+ _entries[kItemBriefcase].floating = false;
+ _entries[kItemCorpse].floating = false;
+ _entries[kItemGreenJacket].floating = false;
+ _entries[kItem22].floating = false;
// Scene
_entries[kItemMatchBox].scene = kSceneMatchbox;
@@ -123,8 +123,8 @@ void Inventory::init() {
_entries[kItemBriefcase].scene = kSceneBriefcase;
// Has item
- _entries[kItemTelegram].isPresent = true;
- _entries[kItemArticle].isPresent = true;
+ _entries[kItemTelegram].inPocket = true;
+ _entries[kItemArticle].inPocket = true;
_selectedItem = kItemNone;
}
@@ -298,7 +298,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
getScenes()->loadScene(entry.scene);
}
- if (entry.field_2)
+ if (entry.usable)
selectItem((InventoryItem)index);
else
drawSelectedItem();
@@ -346,7 +346,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
if (!getProgress().field_84
&& getEntityData(kEntityPlayer)->location != kLocationOutsideTrain
&& getProgress().field_18 != 4
- && (_selectedItem == kItemNone || get(_selectedItem)->manualSelect || getState()->sceneUseBackup)) {
+ && (_selectedItem == kItemNone || get(_selectedItem)->floating || getState()->sceneUseBackup)) {
// Draw inventory contents when clicking on portrait
if (ev.type == Common::EVENT_LBUTTONDOWN) {
@@ -363,7 +363,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
close();
// Select item
- if (_selectedItem == kItemNone || get(_selectedItem)->manualSelect) {
+ if (_selectedItem == kItemNone || get(_selectedItem)->floating) {
_selectedItem = getFirstExaminableItem();
if (_selectedItem != kItemNone)
@@ -447,11 +447,11 @@ void Inventory::addItem(InventoryItem item) {
if (item >= kPortraitOriginal)
return;
- get(item)->isPresent = true;
+ get(item)->inPocket = true;
get(item)->location = kObjectLocationNone;
// Auto-select item if necessary
- if (get(item)->cursor && !get(item)->manualSelect) {
+ if (get(item)->cursor && !get(item)->floating) {
_selectedItem = item;
drawItem(get(_selectedItem)->cursor, 44, 0);
askForRedraw();
@@ -462,7 +462,7 @@ void Inventory::removeItem(InventoryItem item, ObjectLocation newLocation) {
if (item >= kPortraitOriginal)
return;
- get(item)->isPresent = false;
+ get(item)->inPocket = false;
get(item)->location = newLocation;
if (get(item)->cursor == get(_selectedItem)->cursor) {
@@ -473,7 +473,7 @@ void Inventory::removeItem(InventoryItem item, ObjectLocation newLocation) {
}
bool Inventory::hasItem(InventoryItem item) {
- if (get(item)->isPresent && item < kPortraitOriginal)
+ if (get(item)->inPocket && item < kPortraitOriginal)
return true;
return false;
@@ -537,7 +537,7 @@ InventoryItem Inventory::getFirstExaminableItem() const {
int index = 0;
InventoryEntry entry = _entries[index];
- while (!entry.isPresent || !entry.cursor || entry.manualSelect) {
+ while (!entry.inPocket || !entry.cursor || entry.floating) {
index++;
entry = _entries[index];
@@ -676,7 +676,7 @@ void Inventory::drawItem(CursorStyle id, uint16 x, uint16 y, int16 brightnessInd
void Inventory::drawSelectedItem() {
// Draw the selected item if any
- if (!_selectedItem || get(_selectedItem)->manualSelect) {
+ if (!_selectedItem || get(_selectedItem)->floating) {
_selectedItem = getFirstExaminableItem();
if (_selectedItem) {
@@ -703,10 +703,10 @@ void Inventory::open() {
// Draw at most 11 items in the inventory
_itemsShown = 0;
for (int i = 1; i < ARRAYSIZE(_entries); i++) {
- if (!_entries[i].isPresent)
+ if (!_entries[i].inPocket)
continue;
- if (!_entries[i].manualSelect)
+ if (!_entries[i].floating)
continue;
if (_itemsShown < 11) {
@@ -747,10 +747,10 @@ uint32 Inventory::getItemIndex(uint32 currentIndex) const {
uint32 count = 0;
for (uint32 i = 1; i < ARRAYSIZE(_entries); i++) {
- if (!_entries[i].isPresent)
+ if (!_entries[i].inPocket)
continue;
- if (!_entries[i].manualSelect)
+ if (!_entries[i].floating)
continue;
if (count < 11) {
diff --git a/engines/lastexpress/game/inventory.h b/engines/lastexpress/game/inventory.h
index b1019a43c6..242dfc30cc 100644
--- a/engines/lastexpress/game/inventory.h
+++ b/engines/lastexpress/game/inventory.h
@@ -56,33 +56,33 @@ public:
struct InventoryEntry : Common::Serializable {
CursorStyle cursor;
SceneIndex scene;
- byte field_2;
+ byte usable;
bool isSelectable;
- bool isPresent;
- bool manualSelect;
+ bool inPocket;
+ bool floating;
ObjectLocation location;
InventoryEntry() {
cursor = kCursorNormal;
scene = kSceneNone;
- field_2 = 0;
+ usable = 0;
isSelectable = false;
- isPresent = false;
- manualSelect = true;
+ inPocket = false;
+ floating = true;
location = kObjectLocationNone;
}
Common::String toString() {
- return Common::String::format("{ %d - %d - %d - %d - %d - %d - %d }", cursor, scene, field_2, isSelectable, isPresent, manualSelect, location);
+ return Common::String::format("{ %d - %d - %d - %d - %d - %d - %d }", cursor, scene, usable, isSelectable, inPocket, floating, location);
}
void saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsByte(cursor);
s.syncAsByte(scene);
- s.syncAsByte(field_2);
+ s.syncAsByte(usable);
s.syncAsByte(isSelectable);
- s.syncAsByte(isPresent);
- s.syncAsByte(manualSelect);
+ s.syncAsByte(inPocket);
+ s.syncAsByte(floating);
s.syncAsByte(location);
}
};
diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp
index 09104d1bf9..1a9c6b4123 100644
--- a/engines/lastexpress/game/logic.cpp
+++ b/engines/lastexpress/game/logic.cpp
@@ -413,8 +413,8 @@ void Logic::resetState() {
/**
* Handle game over
*
- * @param type The savegame type.
- * @param value The value (event, time, index, ...)
+ * @param type The savegame type.
+ * @param value The value (event, time, index, ...)
* @param sceneIndex Index of the scene to show.
* @param showScene true to show a scene, false to return to menu directly
*/
@@ -468,7 +468,7 @@ void Logic::switchChapter() const {
case kChapter3:
getInventory()->get(kItemFirebird)->location = kObjectLocation4;
- getInventory()->get(kItemFirebird)->isPresent = false;
+ getInventory()->get(kItemFirebird)->inPocket = false;
getInventory()->get(kItem11)->location = kObjectLocation1;
getInventory()->addItem(kItemWhistle);
getInventory()->addItem(kItemKey);
diff --git a/engines/lastexpress/game/logic.h b/engines/lastexpress/game/logic.h
index efb8f1e1a3..b2d08cb06f 100644
--- a/engines/lastexpress/game/logic.h
+++ b/engines/lastexpress/game/logic.h
@@ -54,7 +54,7 @@ public:
void playFinalSequence() const;
void updateCursor(bool redraw = true) const;
- Action *getGameAction() { return _action; }
+ Action *getGameAction() { return _action; }
Beetle *getGameBeetle() { return _beetle; }
Entities *getGameEntities() { return _entities; }
Fight *getGameFight() { return _fight; }
diff --git a/engines/lastexpress/game/object.cpp b/engines/lastexpress/game/object.cpp
index 48df91ea6d..ad13a65199 100644
--- a/engines/lastexpress/game/object.cpp
+++ b/engines/lastexpress/game/object.cpp
@@ -32,7 +32,7 @@
namespace LastExpress {
Common::String Objects::Object::toString() {
- return Common::String::format("{ %s - %d - %d - %d - %d }", ENTITY_NAME(entity), location, cursor, cursor2, location2);
+ return Common::String::format("{ %s - %d - %d - %d - %d }", ENTITY_NAME(entity), status, windowCursor, handleCursor, model);
}
Objects::Objects(LastExpressEngine *engine) : _engine(engine) {}
@@ -44,24 +44,24 @@ const Objects::Object Objects::get(ObjectIndex index) const {
return _objects[index];
}
-void Objects::update(ObjectIndex index, EntityIndex entity, ObjectLocation location, CursorStyle cursor, CursorStyle cursor2) {
+void Objects::update(ObjectIndex index, EntityIndex entity, ObjectLocation status, CursorStyle windowCursor, CursorStyle handleCursor) {
if (index >= kObjectMax)
return;
Object *object = &_objects[index];
// Store original location
- ObjectLocation original_location = object->location;
+ ObjectLocation original_status = object->status;
// Update entity
object->entity = entity;
- object->location = location;
+ object->status = status;
- if (cursor != kCursorKeepValue || cursor2 != kCursorKeepValue) {
- if (cursor != kCursorKeepValue)
- object->cursor = cursor;
- if (cursor2 != kCursorKeepValue)
- object->cursor2 = cursor2;
+ if (windowCursor != kCursorKeepValue || handleCursor != kCursorKeepValue) {
+ if (windowCursor != kCursorKeepValue)
+ object->windowCursor = windowCursor;
+ if (handleCursor != kCursorKeepValue)
+ object->handleCursor = handleCursor;
getLogic()->updateCursor();
}
@@ -69,18 +69,19 @@ void Objects::update(ObjectIndex index, EntityIndex entity, ObjectLocation locat
getFlags()->flag_3 = true;
// Compartments
- if (original_location != location && (original_location == kObjectLocation2 || location == kObjectLocation2))
+ if (original_status != status && (original_status == kObjectLocation2 || status == kObjectLocation2)) {
if ((index >= kObjectCompartment1 && index <= kObjectCompartment8)
- || (index >= kObjectCompartmentA && index <= kObjectCompartmentF)) {
- getScenes()->updateDoorsAndClock();
+ || (index >= kObjectCompartmentA && index <= kObjectCompartmentF)) {
+ getScenes()->updateDoorsAndClock();
}
+ }
}
-void Objects::updateLocation2(ObjectIndex index, ObjectLocation location2) {
+void Objects::updateModel(ObjectIndex index, ObjectModel model) {
if (index >= kObjectMax)
return;
- _objects[index].location2 = location2;
+ _objects[index].model = model;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/game/object.h b/engines/lastexpress/game/object.h
index 87c9d7d407..be9d63d6c5 100644
--- a/engines/lastexpress/game/object.h
+++ b/engines/lastexpress/game/object.h
@@ -37,17 +37,17 @@ public:
struct Object : Common::Serializable { // All fields should be saved as bytes
EntityIndex entity;
- ObjectLocation location;
- CursorStyle cursor;
- CursorStyle cursor2;
- ObjectLocation location2;
+ ObjectLocation status;
+ CursorStyle windowCursor;
+ CursorStyle handleCursor;
+ ObjectModel model;
Object() {
entity = kEntityPlayer;
- location = kObjectLocationNone;
- cursor = kCursorHandKnock;
- cursor2 = kCursorHandKnock;
- location2 = kObjectLocationNone;
+ status = kObjectLocationNone;
+ windowCursor = kCursorHandKnock;
+ handleCursor = kCursorHandKnock;
+ model = kObjectModelNone;
}
Common::String toString();
@@ -55,18 +55,18 @@ public:
// Serializable
void saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsByte(entity);
- s.syncAsByte(location);
- s.syncAsByte(cursor);
- s.syncAsByte(cursor2);
- s.syncAsByte(location2);
+ s.syncAsByte(status);
+ s.syncAsByte(windowCursor);
+ s.syncAsByte(handleCursor);
+ s.syncAsByte(model);
}
};
Objects(LastExpressEngine *engine);
const Object get(ObjectIndex index) const;
- void update(ObjectIndex index, EntityIndex entity, ObjectLocation location, CursorStyle cursor, CursorStyle cursor2);
- void updateLocation2(ObjectIndex index, ObjectLocation location2);
+ void update(ObjectIndex index, EntityIndex entity, ObjectLocation status, CursorStyle cursor, CursorStyle cursor2);
+ void updateModel(ObjectIndex index, ObjectModel model);
// Serializable
void saveLoadWithSerializer(Common::Serializer &s);
diff --git a/engines/lastexpress/game/savegame.h b/engines/lastexpress/game/savegame.h
index 361957227e..7e8095fde1 100644
--- a/engines/lastexpress/game/savegame.h
+++ b/engines/lastexpress/game/savegame.h
@@ -40,32 +40,32 @@
Game data Format
-----------------
- uint32 {4} - entity
- uint32 {4} - current time
- uint32 {4} - time delta (how much a tick is in "real" time)
- uint32 {4} - time ticks
- uint32 {4} - scene Index max: 2500
- byte {1} - use backup scene
- uint32 {4} - backup Scene Index 1 max: 2500
- uint32 {4} - backup Scene Index 2 max: 2500
- uint32 {4} - selected inventory item max: 32
- uint32 {4*100*10} - positions (by car)
- uint32 {4*16} - compartments
- uint32 {4*16} - compartments ??
- uint32 {4*128} - game progress
- byte {512} - game events
- byte {7*32} - inventory
- byte {5*128} - objects
- byte {1262*40} - entities (characters and train entities)
-
- uint32 {4} - sound queue state
- uint32 {4} - ??
- uint32 {4} - number of sound entries
- byte {count*68} - sound entries
-
- byte {16*128} - save point data
- uint32 {4} - number of save points (max: 128)
- byte {count*16} - save points
+ uint32 {4} - entity
+ uint32 {4} - current time
+ uint32 {4} - time delta (how much a tick is in "real" time)
+ uint32 {4} - time ticks
+ uint32 {4} - scene Index max: 2500
+ byte {1} - use backup scene
+ uint32 {4} - backup Scene Index 1 max: 2500
+ uint32 {4} - backup Scene Index 2 max: 2500
+ uint32 {4} - selected inventory item max: 32
+ uint32 {4*100*10} - positions by car(BlockedView)
+ uint32 {4*16} - compartments (BlockedX)
+ uint32 {4*16} - compartments? (SoftBlockedX)
+ uint32 {4*128} - game progress
+ byte {512} - game events
+ byte {7*32} - inventory
+ byte {5*128} - objects
+ byte {1262*40} - entities (characters and train entities)
+
+ uint32 {4} - sound queue state
+ uint32 {4} - ??
+ uint32 {4} - number of sound entries
+ byte {count*68} - sound entries
+
+ byte {16*128} - save point data
+ uint32 {4} - number of save points (max: 128)
+ byte {count*16} - save points
... more unknown stuff
@@ -167,7 +167,7 @@ public:
bool isGameFinished(uint32 menuIndex, uint32 savegameIndex);
// Accessors
- uint32 getTime(uint32 index) { return getEntry(index)->time; }
+ uint32 getTime(uint32 index) { return getEntry(index)->time; }
ChapterIndex getChapter(uint32 index) { return getEntry(index)->chapter; }
uint32 getValue(uint32 index) { return getEntry(index)->value; }
uint32 getLastSavegameTicks() const { return _gameTicksLastSavegame; }
diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp
index 82688fff2e..0d8f51af6e 100644
--- a/engines/lastexpress/game/scenes.cpp
+++ b/engines/lastexpress/game/scenes.cpp
@@ -579,7 +579,7 @@ void SceneManager::updateDoorsAndClock() {
for (ObjectIndex index = firstIndex; index < (ObjectIndex)(firstIndex + 8); index = (ObjectIndex)(index + 1)) {
// Doors is not open, nothing to do
- if (getObjects()->get(index).location != kObjectLocation2)
+ if (getObjects()->get(index).status != kObjectLocation2)
continue;
// Load door sequence
@@ -842,11 +842,11 @@ void SceneManager::preProcessScene(SceneIndex *index) {
if (object >= kObjectMax)
break;
- if (getObjects()->get(object).location == kObjectLocationNone)
+ if (getObjects()->get(object).status == kObjectLocationNone)
break;
for (Common::Array<SceneHotspot *>::iterator it = scene->getHotspots()->begin(); it != scene->getHotspots()->end(); ++it) {
- if (getObjects()->get(object).location != (*it)->location)
+ if (getObjects()->get(object).status != (*it)->location)
continue;
PROCESS_HOTSPOT_SCENE(*it, index);
@@ -920,7 +920,7 @@ void SceneManager::preProcessScene(SceneIndex *index) {
int location = kObjectLocationNone;
- if (getObjects()->get(object).location == kObjectLocation2)
+ if (getObjects()->get(object).status == kObjectLocation2)
location = kObjectLocation1;
if (getInventory()->get(item)->location != kObjectLocationNone)
@@ -933,7 +933,7 @@ void SceneManager::preProcessScene(SceneIndex *index) {
if (location != (*it)->location)
continue;
- if (getObjects()->get(object).location != (*it)->param1)
+ if (getObjects()->get(object).status != (*it)->param1)
continue;
if (getInventory()->get(item)->location != (*it)->param2)
@@ -994,7 +994,7 @@ void SceneManager::preProcessScene(SceneIndex *index) {
bool found = false;
for (Common::Array<SceneHotspot *>::iterator it = scene->getHotspots()->begin(); it != scene->getHotspots()->end(); ++it) {
- if (getObjects()->get(object).location2 != (*it)->location)
+ if (getObjects()->get(object).model != (*it)->location)
continue;
PROCESS_HOTSPOT_SCENE(*it, index);
diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h
index 944f6d47b1..83d528d346 100644
--- a/engines/lastexpress/game/state.h
+++ b/engines/lastexpress/game/state.h
@@ -657,12 +657,12 @@ private:
// Timer
int _timer;
- Flags *_flags; ///< Flags
- Inventory *_inventory; ///< Inventory
- Objects *_objects; ///< Objects
- SavePoints *_savepoints; ///< SavePoints
- GameState *_state; ///< State
- Common::Point _coords; ///< Current coordinates
+ Flags *_flags; ///< Flags
+ Inventory *_inventory; ///< Inventory
+ Objects *_objects; ///< Objects
+ SavePoints *_savepoints; ///< SavePoints
+ GameState *_state; ///< State
+ Common::Point _coords; ///< Current coordinates
};
} // End of namespace LastExpress