aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/entities/entity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lastexpress/entities/entity.cpp')
-rw-r--r--engines/lastexpress/entities/entity.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 2deca291f6..dad5e67392 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -26,10 +26,15 @@
#include "lastexpress/game/action.h"
#include "lastexpress/game/entities.h"
+#include "lastexpress/game/logic.h"
#include "lastexpress/game/object.h"
#include "lastexpress/game/savegame.h"
+#include "lastexpress/game/savepoint.h"
+#include "lastexpress/game/state.h"
#include "lastexpress/game/scenes.h"
+#include "lastexpress/lastexpress.h"
+
namespace LastExpress {
//////////////////////////////////////////////////////////////////////////
@@ -45,12 +50,14 @@ EntityData::EntityCallData::~EntityCallData() {
SAFE_DELETE(sequence3);
}
-void EntityData::EntityCallData::syncString(Common::Serializer &s, Common::String &string, int length) {
+void EntityData::EntityCallData::syncString(Common::Serializer &s, Common::String &string, uint length) const {
char seqName[13];
memset(&seqName, 0, length);
- if (s.isSaving()) strcpy((char *)&seqName, string.c_str());
- s.syncBytes((byte *)&seqName, length);
+ if (s.isSaving())
+ strcpy((char *)&seqName, string.c_str());
+
+ s.syncBytes((byte *)&seqName, length);
if (s.isLoading())
string = seqName;
@@ -110,7 +117,7 @@ EntityData::EntityParameters *EntityData::getParameters(uint callback, byte inde
return _parameters[callback].parameters[index];
}
-int EntityData::getCallback(uint callback) const {
+byte EntityData::getCallback(uint callback) const {
if (callback >= 16)
error("[EntityData::getCallback] Invalid callback value (was: %d, max: 16)", callback);
@@ -818,7 +825,7 @@ void Entity::setupIISS(const char *name, uint index, uint param1, uint param2, c
// Helper functions
//////////////////////////////////////////////////////////////////////////
-bool Entity::updateParameter(uint &parameter, uint timeType, uint delta) {
+bool Entity::updateParameter(uint &parameter, uint timeType, uint delta) const {
if (!parameter)
parameter = (uint)(timeType + delta);
@@ -830,7 +837,7 @@ bool Entity::updateParameter(uint &parameter, uint timeType, uint delta) {
return true;
}
-bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta) {
+bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint &parameter, uint delta) const {
if (getState()->time <= timeValue) {
if (check || !parameter)
parameter = (uint)(getState()->time + delta);
@@ -844,7 +851,7 @@ bool Entity::updateParameterTime(TimeValue timeValue, bool check, uint &paramete
return true;
}
-bool Entity::updateParameterCheck(uint &parameter, uint timeType, uint delta) {
+bool Entity::updateParameterCheck(uint &parameter, uint timeType, uint delta) const {
if (parameter && parameter >= timeType)
return false;
@@ -854,7 +861,7 @@ bool Entity::updateParameterCheck(uint &parameter, uint timeType, uint delta) {
return true;
}
-bool Entity::timeCheck(TimeValue timeValue, uint &parameter, Common::Functor0<void> *function) {
+bool Entity::timeCheck(TimeValue timeValue, uint &parameter, Common::Functor0<void> *function) const {
if (getState()->time > timeValue && !parameter) {
parameter = 1;
(*function)();
@@ -929,14 +936,14 @@ bool Entity::timeCheckCar(TimeValue timeValue, uint &parameter, byte callback, C
return false;
}
-void Entity::timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) {
+void Entity::timeCheckSavepoint(TimeValue timeValue, uint &parameter, EntityIndex entity1, EntityIndex entity2, ActionIndex action) const {
if (getState()->time > timeValue && !parameter) {
parameter = 1;
getSavePoints()->push(entity1, entity2, action);
}
}
-void Entity::timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex object, ObjectLocation location) {
+void Entity::timeCheckObject(TimeValue timeValue, uint &parameter, ObjectIndex object, ObjectLocation location) const {
if (getState()->time > timeValue && !parameter) {
parameter = 1;
getObjects()->updateLocation2(object, location);