ScummVM
LastExpress::Entities Class Reference

#include <entities.h>

+ Inheritance diagram for LastExpress::Entities:
+ Collaboration diagram for LastExpress::Entities:

Public Member Functions

 Entities (LastExpressEngine *engine)
 
 ~Entities () override
 
void saveLoadWithSerializer (Common::Serializer &ser) override
 
void savePositions (Common::Serializer &ser)
 
void saveCompartments (Common::Serializer &ser)
 
void setup (bool isFirstChapter, EntityIndex entity)
 
void setupChapter (ChapterIndex chapter)
 
void reset ()
 
void resetState (EntityIndex entity)
 Reset an entity state. More...
 
void updateFields () const
 
void updateSequences () const
 
void updateCallbacks ()
 
EntityIndex canInteractWith (const Common::Point &point) const
 
bool compare (EntityIndex entity1, EntityIndex entity2) const
 
void updateFrame (EntityIndex entity) const
 Update an entity current sequence frame (and related fields) More...
 
void updatePositionEnter (EntityIndex entity, CarIndex car, Position position)
 
void updatePositionExit (EntityIndex entity, CarIndex car, Position position)
 
void enterCompartment (EntityIndex entity, ObjectIndex compartment, bool useCompartment1=false)
 Compartments. More...
 
void exitCompartment (EntityIndex entity, ObjectIndex compartment, bool useCompartment1=false)
 
void drawSequenceLeft (EntityIndex index, const char *sequence) const
 
void drawSequenceRight (EntityIndex index, const char *sequence) const
 
void clearSequences (EntityIndex index) const
 
bool updateEntity (EntityIndex entity, CarIndex car, EntityPosition position) const
 
bool hasValidFrame (EntityIndex entity) const
 
Entity * get (EntityIndex entity)
 
EntityData::EntityCallData * getData (EntityIndex entity) const
 
int getPosition (CarIndex car, Position position) const
 
int getCompartments (int index) const
 
int getCompartments1 (int index) const
 
void loadSceneFromEntityPosition (CarIndex car, EntityPosition position, bool alternate=false) const
 
bool isInsideCompartment (EntityIndex entity, CarIndex car, EntityPosition position) const
 Query if 'entity' is inside a compartment. More...
 
bool checkFields2 (ObjectIndex object) const
 
bool isInsideCompartments (EntityIndex entity) const
 Query if 'entity' is in compartment cars. More...
 
bool isPlayerPosition (CarIndex car, Position position) const
 Query if the player is in the specified position. More...
 
bool isInsideTrainCar (EntityIndex entity, CarIndex car) const
 Query if 'entity' is inside a train car. More...
 
bool isInGreenCarEntrance (EntityIndex entity) const
 Query if 'entity' is in green car entrance. More...
 
bool isPlayerInCar (CarIndex car) const
 Query if the player is in a specific car. More...
 
bool isDirectionUpOrDown (EntityIndex entity) const
 Query if 'entity' is going in the up or down direction. More...
 
bool isDistanceBetweenEntities (EntityIndex entity1, EntityIndex entity2, uint distance) const
 Query if the distance between the two entities is less 'distance'. More...
 
bool checkFields10 (EntityIndex entity) const
 
bool isSomebodyInsideRestaurantOrSalon () const
 Query if there is somebody in the restaurant or salon. More...
 
bool isInSalon (EntityIndex entity) const
 Query if 'entity' is in the salon. More...
 
bool isInRestaurant (EntityIndex entity) const
 Query if 'entity' is in the restaurant. More...
 
bool isInKronosSalon (EntityIndex entity) const
 Query if 'entity' is in Kronos salon. More...
 
bool isOutsideAlexeiWindow () const
 Query if the player is outside Alexei window. More...
 
bool isOutsideAnnaWindow () const
 Query if the player is outside Anna window. More...
 
bool isInKitchen (EntityIndex entity) const
 Query if 'entity' is in the kitchen. More...
 
bool isNobodyInCompartment (CarIndex car, EntityPosition position) const
 Query if nobody is in a compartment at that position. More...
 
bool checkFields19 (EntityIndex entity, CarIndex car, EntityPosition position) const
 
bool isInBaggageCarEntrance (EntityIndex entity) const
 Query if 'entity' is in the baggage car entrance. More...
 
bool isInBaggageCar (EntityIndex entity) const
 Query if 'entity' is in the baggage car. More...
 
bool isInKronosSanctum (EntityIndex entity) const
 Query if 'entity' is in Kronos sanctum. More...
 
bool isInKronosCarEntrance (EntityIndex entity) const
 Query if 'entity' is in Kronos car entrance. More...
 
bool checkDistanceFromPosition (EntityIndex entity, EntityPosition position, int distance) const
 Check distance from position. More...
 
bool isWalkingOppositeToPlayer (EntityIndex entity) const
 Query if 'entity' is walking opposite to player. More...
 

Static Public Member Functions

static bool isFemale (EntityIndex entity)
 Query if 'entity' is female. More...
 
static bool isMarried (EntityIndex entity)
 Query if 'entity' is married. More...
 

Private Member Functions

void executeCallbacks ()
 
void incrementDirectionCounter (EntityData::EntityCallData *data) const
 
void processEntity (EntityIndex entity)
 
void drawSequence (EntityIndex entity, const char *sequence, EntityDirection direction) const
 
void drawSequences (EntityIndex entity, EntityDirection direction, bool loadSequence) const
 
void loadSequence2 (EntityIndex entity, Common::String sequenceName, Common::String sequenceName2, byte field30, bool loadSequence) const
 
void clearEntitySequenceData (EntityData::EntityCallData *data, EntityDirection direction) const
 
void computeCurrentFrame (EntityIndex entity) const
 
int16 getCurrentFrame (EntityIndex entity, Sequence *sequence, EntityPosition position, bool doProcessing) const
 
void processFrame (EntityIndex entity, bool keepPreviousFrame, bool dontPlaySound)
 
void drawNextSequence (EntityIndex entity) const
 
void updateEntityPosition (EntityIndex entity) const
 
void copySequenceData (EntityIndex entity) const
 
bool changeCar (EntityData::EntityCallData *data, EntityIndex entity, CarIndex car, EntityPosition position, bool increment, EntityPosition newPosition, CarIndex newCar) const
 
void getSequenceName (EntityIndex entity, EntityDirection direction, Common::String &sequence1, Common::String &sequence2) const
 
void updatePositionsEnter (EntityIndex entity, CarIndex car, Position position1, Position position2, Position position3, Position position4)
 
void updatePositionsExit (EntityIndex entity, CarIndex car, Position position1, Position position2)
 
void resetSequences (EntityIndex entity) const
 
bool checkPosition (EntityPosition position) const
 
bool checkSequenceFromPosition (EntityIndex entity) const
 
EntityPosition getEntityPositionFromCurrentPosition () const
 
- Private Member Functions inherited from Common::Serializable
virtual ~Serializable ()
 

Private Attributes

LastExpressEngine_engine
 
EntityData * _header
 
Common::Array< Entity * > _entities
 
uint _compartments [_compartmentsCount]
 
uint _compartments1 [_compartmentsCount]
 
uint _positions [_positionsCount]
 

Static Private Attributes

static const int _compartmentsCount = 16
 
static const int _positionsCount = 100 * 10
 

Detailed Description

Definition at line 46 of file entities.h.

Constructor & Destructor Documentation

◆ Entities()

LastExpress::Entities::Entities ( LastExpressEngine engine)

Definition at line 128 of file entities.cpp.

◆ ~Entities()

LastExpress::Entities::~Entities ( )
override

Definition at line 181 of file entities.cpp.

Member Function Documentation

◆ canInteractWith()

EntityIndex LastExpress::Entities::canInteractWith ( const Common::Point point) const

Definition at line 327 of file entities.cpp.

◆ changeCar()

bool LastExpress::Entities::changeCar ( EntityData::EntityCallData *  data,
EntityIndex  entity,
CarIndex  car,
EntityPosition  position,
bool  increment,
EntityPosition  newPosition,
CarIndex  newCar 
) const
private

Definition at line 2335 of file entities.cpp.

◆ checkDistanceFromPosition()

bool LastExpress::Entities::checkDistanceFromPosition ( EntityIndex  entity,
EntityPosition  position,
int  distance 
) const

Check distance from position.

Parameters
entityThe entity.
positionThe position.
distanceThe distance.
Returns
true if distance is bigger, false otherwise.

Definition at line 2597 of file entities.cpp.

◆ checkFields10()

bool LastExpress::Entities::checkFields10 ( EntityIndex  entity) const

Definition at line 2491 of file entities.cpp.

◆ checkFields19()

bool LastExpress::Entities::checkFields19 ( EntityIndex  entity,
CarIndex  car,
EntityPosition  position 
) const

Definition at line 2548 of file entities.cpp.

◆ checkFields2()

bool LastExpress::Entities::checkFields2 ( ObjectIndex  object) const

Definition at line 2390 of file entities.cpp.

◆ checkPosition()

bool LastExpress::Entities::checkPosition ( EntityPosition  position) const
private

Definition at line 2627 of file entities.cpp.

◆ checkSequenceFromPosition()

bool LastExpress::Entities::checkSequenceFromPosition ( EntityIndex  entity) const
private

Definition at line 2687 of file entities.cpp.

◆ clearEntitySequenceData()

void LastExpress::Entities::clearEntitySequenceData ( EntityData::EntityCallData *  data,
EntityDirection  direction 
) const
private

Definition at line 2714 of file entities.cpp.

◆ clearSequences()

void LastExpress::Entities::clearSequences ( EntityIndex  index) const

Definition at line 1296 of file entities.cpp.

◆ compare()

bool LastExpress::Entities::compare ( EntityIndex  entity1,
EntityIndex  entity2 
) const

Definition at line 1986 of file entities.cpp.

◆ computeCurrentFrame()

void LastExpress::Entities::computeCurrentFrame ( EntityIndex  entity) const
private

Definition at line 793 of file entities.cpp.

◆ copySequenceData()

void LastExpress::Entities::copySequenceData ( EntityIndex  entity) const
private

Definition at line 1252 of file entities.cpp.

◆ drawNextSequence()

void LastExpress::Entities::drawNextSequence ( EntityIndex  entity) const
private

Definition at line 1176 of file entities.cpp.

◆ drawSequence()

void LastExpress::Entities::drawSequence ( EntityIndex  entity,
const char *  sequence,
EntityDirection  direction 
) const
private

Definition at line 1323 of file entities.cpp.

◆ drawSequenceLeft()

void LastExpress::Entities::drawSequenceLeft ( EntityIndex  index,
const char *  sequence 
) const

Definition at line 1288 of file entities.cpp.

◆ drawSequenceRight()

void LastExpress::Entities::drawSequenceRight ( EntityIndex  index,
const char *  sequence 
) const

Definition at line 1292 of file entities.cpp.

◆ drawSequences()

void LastExpress::Entities::drawSequences ( EntityIndex  entity,
EntityDirection  direction,
bool  loadSequence 
) const
private

Definition at line 1339 of file entities.cpp.

◆ enterCompartment()

void LastExpress::Entities::enterCompartment ( EntityIndex  entity,
ObjectIndex  compartment,
bool  useCompartment1 = false 
)

Compartments.

Definition at line 1697 of file entities.cpp.

◆ executeCallbacks()

void LastExpress::Entities::executeCallbacks ( )
private

Definition at line 639 of file entities.cpp.

◆ exitCompartment()

void LastExpress::Entities::exitCompartment ( EntityIndex  entity,
ObjectIndex  compartment,
bool  useCompartment1 = false 
)

Definition at line 1781 of file entities.cpp.

◆ get()

Entity * LastExpress::Entities::get ( EntityIndex  entity)

Definition at line 196 of file entities.cpp.

◆ getCompartments()

int LastExpress::Entities::getCompartments ( int  index) const

Definition at line 226 of file entities.cpp.

◆ getCompartments1()

int LastExpress::Entities::getCompartments1 ( int  index) const

Definition at line 233 of file entities.cpp.

◆ getCurrentFrame()

int16 LastExpress::Entities::getCurrentFrame ( EntityIndex  entity,
Sequence sequence,
EntityPosition  position,
bool  doProcessing 
) const
private

Definition at line 1024 of file entities.cpp.

◆ getData()

EntityData::EntityCallData * LastExpress::Entities::getData ( EntityIndex  entity) const

Definition at line 205 of file entities.cpp.

◆ getEntityPositionFromCurrentPosition()

EntityPosition LastExpress::Entities::getEntityPositionFromCurrentPosition ( ) const
private

Definition at line 2701 of file entities.cpp.

◆ getPosition()

int LastExpress::Entities::getPosition ( CarIndex  car,
Position  position 
) const

Definition at line 214 of file entities.cpp.

◆ getSequenceName()

void LastExpress::Entities::getSequenceName ( EntityIndex  entity,
EntityDirection  direction,
Common::String sequence1,
Common::String sequence2 
) const
private

Definition at line 1508 of file entities.cpp.

◆ hasValidFrame()

bool LastExpress::Entities::hasValidFrame ( EntityIndex  entity) const

Definition at line 1982 of file entities.cpp.

◆ incrementDirectionCounter()

void LastExpress::Entities::incrementDirectionCounter ( EntityData::EntityCallData *  data) const
private

Definition at line 671 of file entities.cpp.

◆ isDirectionUpOrDown()

bool LastExpress::Entities::isDirectionUpOrDown ( EntityIndex  entity) const

Query if 'entity' is going in the up or down direction.

Parameters
entityThe entity.
Returns
true if direction is up or down, false if not.

Definition at line 2481 of file entities.cpp.

◆ isDistanceBetweenEntities()

bool LastExpress::Entities::isDistanceBetweenEntities ( EntityIndex  entity1,
EntityIndex  entity2,
uint  distance 
) const

Query if the distance between the two entities is less 'distance'.

Parameters
entity1The first entity.
entity2The second entity.
distanceThe distance.
Returns
true if the distance between entities is less than 'distance', false if not.

Definition at line 2485 of file entities.cpp.

◆ isFemale()

bool LastExpress::Entities::isFemale ( EntityIndex  entity)
static

Query if 'entity' is female.

Parameters
entityThe entity.
Returns
true if female, false if not.

Definition at line 2608 of file entities.cpp.

◆ isInBaggageCar()

bool LastExpress::Entities::isInBaggageCar ( EntityIndex  entity) const

Query if 'entity' is in the baggage car.

Parameters
entityThe entity.
Returns
true if in the baggage car, false if not.

Definition at line 2583 of file entities.cpp.

◆ isInBaggageCarEntrance()

bool LastExpress::Entities::isInBaggageCarEntrance ( EntityIndex  entity) const

Query if 'entity' is in the baggage car entrance.

Parameters
entityThe entity.
Returns
true if in the baggage car entrance, false if not.

Definition at line 2577 of file entities.cpp.

◆ isInGreenCarEntrance()

bool LastExpress::Entities::isInGreenCarEntrance ( EntityIndex  entity) const

Query if 'entity' is in green car entrance.

Parameters
entityThe entity.
Returns
true if in the green car entrance, false if not.

Definition at line 2473 of file entities.cpp.

◆ isInKitchen()

bool LastExpress::Entities::isInKitchen ( EntityIndex  entity) const

Query if 'entity' is in the kitchen.

Parameters
entityThe entity.
Returns
true if in the kitchen, false if not.

Definition at line 2536 of file entities.cpp.

◆ isInKronosCarEntrance()

bool LastExpress::Entities::isInKronosCarEntrance ( EntityIndex  entity) const

Query if 'entity' is in Kronos car entrance.

Parameters
entityThe entity.
Returns
true if in Kronos car entrance, false if not.

Definition at line 2593 of file entities.cpp.

◆ isInKronosSalon()

bool LastExpress::Entities::isInKronosSalon ( EntityIndex  entity) const

Query if 'entity' is in Kronos salon.

Parameters
entityThe entity.
Returns
true if in Kronos salon, false if not.

Definition at line 2518 of file entities.cpp.

◆ isInKronosSanctum()

bool LastExpress::Entities::isInKronosSanctum ( EntityIndex  entity) const

Query if 'entity' is in Kronos sanctum.

Parameters
entityThe entity.
Returns
true if in Kronos sanctum, false if not.

Definition at line 2587 of file entities.cpp.

◆ isInRestaurant()

bool LastExpress::Entities::isInRestaurant ( EntityIndex  entity) const

Query if 'entity' is in the restaurant.

Parameters
entityThe entity.
Returns
true if in the restaurant, false if not.

Definition at line 2512 of file entities.cpp.

◆ isInSalon()

bool LastExpress::Entities::isInSalon ( EntityIndex  entity) const

Query if 'entity' is in the salon.

Parameters
entityThe entity.
Returns
true if in the salon, false if not.

Definition at line 2506 of file entities.cpp.

◆ isInsideCompartment()

bool LastExpress::Entities::isInsideCompartment ( EntityIndex  entity,
CarIndex  car,
EntityPosition  position 
) const

Query if 'entity' is inside a compartment.

Parameters
entityThe entity.
carThe car.
positionThe position.
Returns
true if inside the compartment, false if not.

Definition at line 2384 of file entities.cpp.

◆ isInsideCompartments()

bool LastExpress::Entities::isInsideCompartments ( EntityIndex  entity) const

Query if 'entity' is in compartment cars.

Parameters
entityThe entity.
Returns
true if in compartment cars, false if not.

Definition at line 2459 of file entities.cpp.

◆ isInsideTrainCar()

bool LastExpress::Entities::isInsideTrainCar ( EntityIndex  entity,
CarIndex  car 
) const

Query if 'entity' is inside a train car.

Parameters
entityThe entity.
carThe car.
Returns
true if inside a train car, false if not.

Definition at line 2469 of file entities.cpp.

◆ isMarried()

bool LastExpress::Entities::isMarried ( EntityIndex  entity)
static

Query if 'entity' is married.

Parameters
entityThe entity.
Returns
true if married, false if not.

Definition at line 2621 of file entities.cpp.

◆ isNobodyInCompartment()

bool LastExpress::Entities::isNobodyInCompartment ( CarIndex  car,
EntityPosition  position 
) const

Query if nobody is in a compartment at that position.

Parameters
carThe car.
positionThe position.
Returns
true if nobody is in a compartment, false if not.

Definition at line 2540 of file entities.cpp.

◆ isOutsideAlexeiWindow()

bool LastExpress::Entities::isOutsideAlexeiWindow ( ) const

Query if the player is outside Alexei window.

Returns
true if outside alexei window, false if not.

Definition at line 2524 of file entities.cpp.

◆ isOutsideAnnaWindow()

bool LastExpress::Entities::isOutsideAnnaWindow ( ) const

Query if the player is outside Anna window.

Returns
true if outside anna window, false if not.

Definition at line 2530 of file entities.cpp.

◆ isPlayerInCar()

bool LastExpress::Entities::isPlayerInCar ( CarIndex  car) const

Query if the player is in a specific car.

Parameters
carThe car.
Returns
true if player is in the car, false if not.

Definition at line 2477 of file entities.cpp.

◆ isPlayerPosition()

bool LastExpress::Entities::isPlayerPosition ( CarIndex  car,
Position  position 
) const

Query if the player is in the specified position.

Parameters
carThe car.
positionThe position.
Returns
true if player is in that position, false if not.

Definition at line 2465 of file entities.cpp.

◆ isSomebodyInsideRestaurantOrSalon()

bool LastExpress::Entities::isSomebodyInsideRestaurantOrSalon ( ) const

Query if there is somebody in the restaurant or salon.

Returns
true if somebody is in the restaurant or salon, false if not.

Definition at line 2495 of file entities.cpp.

◆ isWalkingOppositeToPlayer()

bool LastExpress::Entities::isWalkingOppositeToPlayer ( EntityIndex  entity) const

Query if 'entity' is walking opposite to player.

Parameters
entityThe entity.
Returns
true if walking opposite to player, false if not.

Definition at line 2601 of file entities.cpp.

◆ loadSceneFromEntityPosition()

void LastExpress::Entities::loadSceneFromEntityPosition ( CarIndex  car,
EntityPosition  position,
bool  alternate = false 
) const

Definition at line 1929 of file entities.cpp.

◆ loadSequence2()

void LastExpress::Entities::loadSequence2 ( EntityIndex  entity,
Common::String  sequenceName,
Common::String  sequenceName2,
byte  field30,
bool  loadSequence 
) const
private

Definition at line 1492 of file entities.cpp.

◆ processEntity()

void LastExpress::Entities::processEntity ( EntityIndex  entity)
private

Definition at line 678 of file entities.cpp.

◆ processFrame()

void LastExpress::Entities::processFrame ( EntityIndex  entity,
bool  keepPreviousFrame,
bool  dontPlaySound 
)
private

Definition at line 1077 of file entities.cpp.

◆ reset()

void LastExpress::Entities::reset ( )

Definition at line 312 of file entities.cpp.

◆ resetSequences()

void LastExpress::Entities::resetSequences ( EntityIndex  entity) const
private

Definition at line 594 of file entities.cpp.

◆ resetState()

void LastExpress::Entities::resetState ( EntityIndex  entity)

Reset an entity state.

Parameters
entityentity index
Note
remember to call the function pointer (we do not pass it our implementation)

Definition at line 365 of file entities.cpp.

◆ saveCompartments()

void LastExpress::Entities::saveCompartments ( Common::Serializer ser)

Definition at line 254 of file entities.cpp.

◆ saveLoadWithSerializer()

void LastExpress::Entities::saveLoadWithSerializer ( Common::Serializer ser)
overridevirtual

Implements Common::Serializable.

Definition at line 243 of file entities.cpp.

◆ savePositions()

void LastExpress::Entities::savePositions ( Common::Serializer ser)

Definition at line 249 of file entities.cpp.

◆ setup()

void LastExpress::Entities::setup ( bool  isFirstChapter,
EntityIndex  entity 
)

Definition at line 265 of file entities.cpp.

◆ setupChapter()

void LastExpress::Entities::setupChapter ( ChapterIndex  chapter)

Definition at line 284 of file entities.cpp.

◆ updateCallbacks()

void LastExpress::Entities::updateCallbacks ( )

Definition at line 623 of file entities.cpp.

◆ updateEntity()

bool LastExpress::Entities::updateEntity ( EntityIndex  entity,
CarIndex  car,
EntityPosition  position 
) const

Definition at line 2044 of file entities.cpp.

◆ updateEntityPosition()

void LastExpress::Entities::updateEntityPosition ( EntityIndex  entity) const
private

Definition at line 1218 of file entities.cpp.

◆ updateFields()

void LastExpress::Entities::updateFields ( ) const

Definition at line 392 of file entities.cpp.

◆ updateFrame()

void LastExpress::Entities::updateFrame ( EntityIndex  entity) const

Update an entity current sequence frame (and related fields)

Parameters
entityentity index

Definition at line 434 of file entities.cpp.

◆ updatePositionEnter()

void LastExpress::Entities::updatePositionEnter ( EntityIndex  entity,
CarIndex  car,
Position  position 
)

Definition at line 1866 of file entities.cpp.

◆ updatePositionExit()

void LastExpress::Entities::updatePositionExit ( EntityIndex  entity,
CarIndex  car,
Position  position 
)

Definition at line 1884 of file entities.cpp.

◆ updatePositionsEnter()

void LastExpress::Entities::updatePositionsEnter ( EntityIndex  entity,
CarIndex  car,
Position  position1,
Position  position2,
Position  position3,
Position  position4 
)
private

Definition at line 1896 of file entities.cpp.

◆ updatePositionsExit()

void LastExpress::Entities::updatePositionsExit ( EntityIndex  entity,
CarIndex  car,
Position  position1,
Position  position2 
)
private

Definition at line 1916 of file entities.cpp.

◆ updateSequences()

void LastExpress::Entities::updateSequences ( ) const

Definition at line 482 of file entities.cpp.

Member Data Documentation

◆ _compartments

uint LastExpress::Entities::_compartments[_compartmentsCount]
private

Definition at line 342 of file entities.h.

◆ _compartments1

uint LastExpress::Entities::_compartments1[_compartmentsCount]
private

Definition at line 343 of file entities.h.

◆ _compartmentsCount

const int LastExpress::Entities::_compartmentsCount = 16
staticprivate

Definition at line 334 of file entities.h.

◆ _engine

LastExpressEngine* LastExpress::Entities::_engine
private

Definition at line 337 of file entities.h.

◆ _entities

Common::Array<Entity *> LastExpress::Entities::_entities
private

Definition at line 339 of file entities.h.

◆ _header

EntityData* LastExpress::Entities::_header
private

Definition at line 338 of file entities.h.

◆ _positions

uint LastExpress::Entities::_positions[_positionsCount]
private

Definition at line 344 of file entities.h.

◆ _positionsCount

const int LastExpress::Entities::_positionsCount = 100 * 10
staticprivate

Definition at line 335 of file entities.h.


The documentation for this class was generated from the following files: