[Scummvm-git-logs] scummvm master -> 9ba2652fa35abff23215ef4d7263f22d023c052c

mgerhardy noreply at scummvm.org
Sat Jun 11 11:07:19 UTC 2022


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
027a64f77f TWINE: reset more actor flags
9ba2652fa3 TWINE: reduced access to _processActor


Commit: 027a64f77fe9ae2c755040d856786de721f89d48
    https://github.com/scummvm/scummvm/commit/027a64f77fe9ae2c755040d856786de721f89d48
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T13:07:09+02:00

Commit Message:
TWINE: reset more actor flags

Changed paths:
    engines/twine/scene/actor.cpp
    engines/twine/scene/actor.h
    engines/twine/scene/scene.cpp


diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 13b25351eae..d1a6347115b 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -257,49 +257,20 @@ void Actor::initActor(int16 actorIdx) {
 	actor->_positionInLifeScript = 0;
 }
 
+// InitObject
 void Actor::resetActor(int16 actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
+	*actor = ActorStruct();
 
 	actor->_actorIdx = actorIdx;
-	actor->_genBody = BodyType::btNormal;
 	actor->_anim = AnimationTypes::kStanding;
 	actor->_pos = IVec3(0, -1, 0);
-	actor->_spriteActorRotation = 0;
-
-	actor->_boundingBox = BoundingBox();
-
-	actor->_angle = 0;
-	actor->_speed = 40;
-	actor->_controlMode = ControlMode::kNoMove;
-
-	actor->_cropLeft = 0;
-	actor->_cropTop = 0;
-	actor->_cropRight = 0;
-	actor->_cropBottom = 0;
-
-	actor->setBrickShape(ShapeType::kNone);
-	actor->_collision = -1;
-	actor->_carryBy = -1;
-	actor->_zone = -1;
 
 	memset(&actor->_staticFlags, 0, sizeof(StaticFlagsStruct));
 	memset(&actor->_dynamicFlags, 0, sizeof(DynamicFlagsStruct));
 	memset(&actor->_bonusParameter, 0, sizeof(BonusParameter));
 
-	actor->setLife(kActorMaxLife);
-	actor->_armor = 1;
-	actor->_hitBy = -1;
-	actor->_lastRotationAngle = ANGLE_0;
-	actor->_animStep = IVec3();
-	actor->_body = -1;
-	actor->_previousAnimIdx = -1;
-	actor->_animType = AnimType::kAnimationTypeLoop;
-	actor->_animPosition = 0;
-
 	_engine->_movements->setActorAngleSafe(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_move);
-
-	actor->_positionInMoveScript = -1;
-	actor->_positionInLifeScript = 0;
 }
 
 void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit, int32 angle) {
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 82aac36790c..2e91bb54bd2 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -167,7 +167,7 @@ public:
 
 	const IVec3 &pos() const;
 
-	int32 _body = 0; // costumeIndex - index into bodyTable
+	int32 _body = -1; // costumeIndex - index into bodyTable
 	BodyType _genBody = BodyType::btNormal;
 	AnimationTypes _anim = AnimationTypes::kAnimNone;
 	AnimationTypes _animExtra = AnimationTypes::kStanding;
@@ -178,10 +178,10 @@ public:
 	int16 _actorIdx = 0; // own actor index
 	IVec3 _pos;
 	int32 _strengthOfHit = 0;
-	int32 _hitBy = 0;
+	int32 _hitBy = -1;
 	BonusParameter _bonusParameter;
 	int32 _angle = 0; // facing angle of actor. Minumum is 0 (SW). Going counter clock wise
-	int32 _speed = 0;
+	int32 _speed = 40; // speed of movement
 	ControlMode _controlMode = ControlMode::kNoMove;
 	int32 _delayInMillis = 0;
 	int32 _cropLeft = 0;
@@ -191,12 +191,12 @@ public:
 	int32 _followedActor = 0; // same as info3
 	int32 _bonusAmount = 0;
 	int32 _talkColor = COLOR_BLACK;
-	int32 _armor = 0;
-	int32 _life = 0;
+	int32 _armor = 1;
+	int32 _life = kActorMaxLife;
 
 	IVec3 _collisionPos;
 
-	int32 _positionInMoveScript = 0;
+	int32 _positionInMoveScript = -1;
 	uint8 *_moveScript = nullptr;
 	int32 _moveScriptSize = 0;
 
@@ -211,16 +211,16 @@ public:
 	/**
 	 * colliding actor id
 	 */
-	int32 _collision = 0;
+	int32 _collision = -1;
 	/**
 	 * actor id we are standing on
 	 */
-	int32 _carryBy = 0;
-	int32 _zone = 0;
+	int32 _carryBy = -1;
+	int32 _zone = -1;
 
 	int32 _lastRotationAngle = ANGLE_0;
 	IVec3 _animStep;
-	int32 _previousAnimIdx = 0;
+	int32 _previousAnimIdx = -1;
 	int32 _doorWidth = 0;
 	int32 _animPosition = 0;
 	AnimType _animType = AnimType::kAnimationTypeLoop;
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index f09b95e4630..fd3d9386a4a 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -278,6 +278,7 @@ bool Scene::loadSceneLBA2() {
 	return true;
 }
 
+// LoadScene
 bool Scene::loadSceneLBA1() {
 	Common::MemoryReadStream stream(_currentScene, _currentSceneSize);
 
@@ -335,6 +336,7 @@ bool Scene::loadSceneLBA1() {
 		act->_collisionPos = act->pos();
 		act->_strengthOfHit = stream.readByte();
 		setBonusParameterFlags(act, stream.readUint16LE());
+		act->_bonusParameter.givenNothing = 0;
 		act->_angle = (int16)stream.readUint16LE();
 		act->_speed = (int16)stream.readUint16LE();
 		act->_controlMode = (ControlMode)stream.readUint16LE();
@@ -480,6 +482,7 @@ void Scene::dumpSceneScripts() const {
 	}
 }
 
+// ChangeCube
 void Scene::changeScene() {
 	if (_engine->isLBA1()) {
 		if (_enableEnhancements) {
@@ -579,8 +582,7 @@ void Scene::changeScene() {
 
 	_engine->_gameState->_inventoryNumKeys = 0;
 	_engine->_disableScreenRecenter = false;
-	_heroPositionType = ScenePositionType::kNoPosition;
-	_sampleAmbienceTime = 0;
+
 
 	ActorStruct *followedActor = getActor(_currentlyFollowedActor);
 	_engine->_grid->centerOnActor(followedActor);
@@ -590,11 +592,13 @@ void Scene::changeScene() {
 	_engine->_grid->_useCellingGrid = -1;
 	_engine->_grid->_cellingGridIdx = -1;
 	_engine->_screens->_fadePalette = false;
+	_engine->_renderer->setLightVector(_alphaLight, _betaLight, ANGLE_0);
 
 	_needChangeScene = SCENE_CEILING_GRID_FADE_1;
 	_enableGridTileRendering = true;
-
-	_engine->_renderer->setLightVector(_alphaLight, _betaLight, ANGLE_0);
+	_heroPositionType = ScenePositionType::kNoPosition;
+	_zoneHeroPos = IVec3();
+	_sampleAmbienceTime = 0;
 
 	if (_sceneMusic != -1) {
 		debug(2, "Scene %i music track id: %i", _currentSceneIdx, _sceneMusic);


Commit: 9ba2652fa35abff23215ef4d7263f22d023c052c
    https://github.com/scummvm/scummvm/commit/9ba2652fa35abff23215ef4d7263f22d023c052c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T13:07:09+02:00

Commit Message:
TWINE: reduced access to _processActor

Changed paths:
    engines/twine/renderer/redraw.cpp
    engines/twine/scene/actor.cpp
    engines/twine/scene/actor.h
    engines/twine/scene/animations.cpp
    engines/twine/scene/collision.cpp
    engines/twine/scene/collision.h
    engines/twine/scene/movements.cpp
    engines/twine/scene/movements.h
    engines/twine/scene/scene.cpp


diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 4e5e0f29f3c..011a11d7c1b 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -241,19 +241,19 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
 			// if use shadows
 			if (_engine->_cfgfile.ShadowMode != 0 && !(actor->_staticFlags.bDoesntCastShadow)) {
 				if (actor->_carryBy != -1) {
-					_engine->_actor->_shadowCoord.x = actor->_pos.x;
-					_engine->_actor->_shadowCoord.y = actor->_pos.y - 1;
-					_engine->_actor->_shadowCoord.z = actor->_pos.z;
+					drawList[drawListPos].x = actor->_pos.x;
+					drawList[drawListPos].y = actor->_pos.y - 1;
+					drawList[drawListPos].z = actor->_pos.z;
 				} else {
-					_engine->_movements->getShadowPosition(actor->pos());
+					const IVec3 shadowCoord = _engine->_movements->getShadowPosition(actor->pos());
+					drawList[drawListPos].x = shadowCoord.x;
+					drawList[drawListPos].y = shadowCoord.y;
+					drawList[drawListPos].z = shadowCoord.z;
 				}
 
 				drawList[drawListPos].posValue = tmpVal - 1; // save the shadow entry in the _drawList
 				drawList[drawListPos].type = DrawListType::DrawShadows;
 				drawList[drawListPos].actorIdx = 0;
-				drawList[drawListPos].x = _engine->_actor->_shadowCoord.x;
-				drawList[drawListPos].y = _engine->_actor->_shadowCoord.y;
-				drawList[drawListPos].z = _engine->_actor->_shadowCoord.z;
 				drawList[drawListPos].offset = 1;
 				drawListPos++;
 			}
@@ -291,14 +291,14 @@ int32 Redraw::fillExtraDrawingList(DrawListStruct *drawList, int32 drawListPos)
 				drawListPos++;
 
 				if (_engine->_cfgfile.ShadowMode == 2 && !(extra->info0 & EXTRA_SPECIAL_MASK)) {
-					_engine->_movements->getShadowPosition(extra->pos);
+					const IVec3 &shadowCoord = _engine->_movements->getShadowPosition(extra->pos);
 
 					drawList[drawListPos].posValue = tmpVal - 1;
 					drawList[drawListPos].actorIdx = 0;
 					drawList[drawListPos].type = DrawListType::DrawShadows;
-					drawList[drawListPos].x = _engine->_actor->_shadowCoord.x;
-					drawList[drawListPos].y = _engine->_actor->_shadowCoord.y;
-					drawList[drawListPos].z = _engine->_actor->_shadowCoord.z;
+					drawList[drawListPos].x = shadowCoord.x;
+					drawList[drawListPos].y = shadowCoord.y;
+					drawList[drawListPos].z = shadowCoord.z;
 					drawList[drawListPos].offset = 0;
 					drawListPos++;
 				}
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index d1a6347115b..1359ab41712 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -263,7 +263,6 @@ void Actor::resetActor(int16 actorIdx) {
 	*actor = ActorStruct();
 
 	actor->_actorIdx = actorIdx;
-	actor->_anim = AnimationTypes::kStanding;
 	actor->_pos = IVec3(0, -1, 0);
 
 	memset(&actor->_staticFlags, 0, sizeof(StaticFlagsStruct));
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 2e91bb54bd2..7e294584e3b 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -194,6 +194,10 @@ public:
 	int32 _armor = 1;
 	int32 _life = kActorMaxLife;
 
+	/** Process actor coordinate */
+	IVec3 _processActor;
+	/** Previous process actor coordinate */
+	IVec3 _previousActor;
 	IVec3 _collisionPos;
 
 	int32 _positionInMoveScript = -1;
@@ -280,9 +284,6 @@ public:
 
 	ActorStruct *_processActorPtr = nullptr;
 
-	/** Actor shadow coordinate */
-	IVec3 _shadowCoord;
-
 	HeroBehaviourType _heroBehaviour = HeroBehaviourType::kNormal;
 	/** Hero auto aggressive mode */
 	bool _autoAggressive = true;
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 689eef56a61..9b50bc701cf 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -466,10 +466,10 @@ void Animations::processActorAnimations(int32 actorIdx) {
 		return;
 	}
 
-	IVec3 &previousActor = _engine->_movements->_previousActor;
+	IVec3 &previousActor = actor->_previousActor;
 	previousActor = actor->_collisionPos;
 
-	IVec3 &processActor = _engine->_movements->_processActor;
+	IVec3 &processActor = actor->_processActor;
 	if (actor->_staticFlags.bIsSpriteActor) {
 		if (actor->_strengthOfHit) {
 			actor->_dynamicFlags.bIsHitting = 1;
@@ -488,11 +488,11 @@ void Animations::processActorAnimations(int32 actorIdx) {
 					}
 				}
 
-				IVec3 destPos = _engine->_movements->rotateActor(xAxisRotation, 0, actor->_spriteActorRotation);
+				const IVec3 xRotPos = _engine->_movements->rotateActor(xAxisRotation, 0, actor->_spriteActorRotation);
 
-				processActor.y = actor->_pos.y - destPos.z;
+				processActor.y = actor->_pos.y - xRotPos.z;
 
-				destPos = _engine->_movements->rotateActor(0, destPos.x, actor->_angle);
+				const IVec3 destPos = _engine->_movements->rotateActor(0, xRotPos.x, actor->_angle);
 
 				processActor.x = actor->_pos.x + destPos.x;
 				processActor.z = actor->_pos.z + destPos.z;
@@ -653,7 +653,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
 
 		if (brickShape != ShapeType::kNone) {
 			if (brickShape != ShapeType::kSolid) {
-				_engine->_collision->reajustActorPosition(brickShape);
+				_engine->_collision->reajustActorPosition(processActor, brickShape);
 			} else { // this shouldn't happen (collision should avoid it)
 				actor->_pos.y = processActor.y = (processActor.y / BRICK_HEIGHT) * BRICK_HEIGHT + BRICK_HEIGHT; // go upper
 			}
@@ -673,16 +673,16 @@ void Animations::processActorAnimations(int32 actorIdx) {
 
 		if (IS_HERO(actorIdx) && !actor->_staticFlags.bComputeLowCollision) {
 			// check hero collisions with bricks
-			_engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
-			_engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
-			_engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
-			_engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
+			_engine->_collision->checkHeroCollisionWithBricks(actor, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
+			_engine->_collision->checkHeroCollisionWithBricks(actor, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
+			_engine->_collision->checkHeroCollisionWithBricks(actor, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
+			_engine->_collision->checkHeroCollisionWithBricks(actor, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
 		} else {
 			// check other actors collisions with bricks
-			_engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
-			_engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
-			_engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
-			_engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
+			_engine->_collision->checkActorCollisionWithBricks(actor, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
+			_engine->_collision->checkActorCollisionWithBricks(actor, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
+			_engine->_collision->checkActorCollisionWithBricks(actor, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
+			_engine->_collision->checkActorCollisionWithBricks(actor, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
 		}
 		processActor = processActorSave;
 
@@ -739,7 +739,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
 					_engine->_collision->stopFalling();
 				}
 
-				_engine->_collision->reajustActorPosition(brickShape);
+				_engine->_collision->reajustActorPosition(processActor, brickShape);
 			}
 
 			actor->_dynamicFlags.bIsFalling = 0;
@@ -752,7 +752,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
 						_engine->_collision->stopFalling();
 					}
 
-					_engine->_collision->reajustActorPosition(brickShape);
+					_engine->_collision->reajustActorPosition(processActor, brickShape);
 				} else {
 					if (!actor->_dynamicFlags.bIsRotationByAnim) {
 						actor->_dynamicFlags.bIsFalling = 1;
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index fc86f462aa2..96bd069cc82 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -44,7 +44,7 @@ bool Collision::standingOnActor(int32 actorIdx1, int32 actorIdx2) const {
 	const ActorStruct *actor1 = _engine->_scene->getActor(actorIdx1);
 	const ActorStruct *actor2 = _engine->_scene->getActor(actorIdx2);
 
-	const IVec3 &processActor = _engine->_movements->_processActor;
+	const IVec3 &processActor = actor1->_processActor;
 	const IVec3 &mins1 = processActor + actor1->_boundingBox.mins;
 	const IVec3 &maxs1 = processActor + actor1->_boundingBox.maxs;
 
@@ -94,7 +94,7 @@ int32 Collision::getAverageValue(int32 start, int32 end, int32 maxDelay, int32 d
 	return (((end - start) * delay) / maxDelay) + start;
 }
 
-void Collision::reajustActorPosition(ShapeType brickShape) {
+void Collision::reajustActorPosition(IVec3 &processActor, ShapeType brickShape) const {
 	if (brickShape == ShapeType::kNone) {
 		return;
 	}
@@ -103,8 +103,7 @@ void Collision::reajustActorPosition(ShapeType brickShape) {
 	const int32 yw = _collision.y * BRICK_HEIGHT;
 	const int32 zw = (_collision.z * BRICK_SIZE) - BRICK_HEIGHT;
 
-	IVec3 &processActor = _engine->_movements->_processActor;
-
+	// double-side stairs
 	switch (brickShape) {
 	case ShapeType::kDoubleSideStairsTop1:
 		if (processActor.x - xw < processActor.z - zw) {
@@ -184,9 +183,9 @@ void Collision::reajustActorPosition(ShapeType brickShape) {
 	}
 }
 
-void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, const ActorStruct *actor, ActorStruct *actorTest) {
-	IVec3 &processActor = _engine->_movements->_processActor;
-	const IVec3 &previousActor = _engine->_movements->_previousActor;
+void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, ActorStruct *actor, ActorStruct *actorTest) {
+	IVec3 &processActor = actor->_processActor;
+	const IVec3 &previousActor = actor->_previousActor;
 
 	const int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(processActor, actorTest->pos());
 
@@ -234,7 +233,7 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, cons
 int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 
-	IVec3 &processActor = _engine->_movements->_processActor;
+	IVec3 &processActor = actor->_processActor;
 	IVec3 mins = processActor + actor->_boundingBox.mins;
 	IVec3 maxs = processActor + actor->_boundingBox.maxs;
 
@@ -293,9 +292,9 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 	return actor->_collision;
 }
 
-void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 damageMask) {
-	IVec3 &processActor = _engine->_movements->_processActor;
-	IVec3 &previousActor = _engine->_movements->_previousActor;
+void Collision::checkHeroCollisionWithBricks(ActorStruct *actor, int32 x, int32 y, int32 z, int32 damageMask) {
+	IVec3 &processActor = actor->_processActor;
+	IVec3 &previousActor = actor->_previousActor;
 	ShapeType brickShape = _engine->_grid->getBrickShape(processActor);
 
 	processActor.x += x;
@@ -304,7 +303,7 @@ void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 da
 
 	if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= SCENE_SIZE_MAX && processActor.z <= SCENE_SIZE_MAX) {
 		const BoundingBox &bbox = _engine->_actor->_processActorPtr->_boundingBox;
-		reajustActorPosition(brickShape);
+		reajustActorPosition(processActor, brickShape);
 		brickShape = _engine->_grid->getBrickShapeFull(processActor, bbox.maxs.y);
 
 		if (brickShape == ShapeType::kSolid) {
@@ -326,9 +325,9 @@ void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 da
 	processActor = _processCollision;
 }
 
-void Collision::checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 damageMask) {
-	IVec3 &processActor = _engine->_movements->_processActor;
-	IVec3 &previousActor = _engine->_movements->_previousActor;
+void Collision::checkActorCollisionWithBricks(ActorStruct *actor, int32 x, int32 y, int32 z, int32 damageMask) {
+	IVec3 &processActor = actor->_processActor;
+	IVec3 &previousActor = actor->_previousActor;
 	ShapeType brickShape = _engine->_grid->getBrickShape(processActor);
 
 	processActor.x += x;
@@ -336,7 +335,7 @@ void Collision::checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 d
 	processActor.z += z;
 
 	if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= SCENE_SIZE_MAX && processActor.z <= SCENE_SIZE_MAX) {
-		reajustActorPosition(brickShape);
+		reajustActorPosition(processActor, brickShape);
 		brickShape = _engine->_grid->getBrickShape(processActor);
 
 		if (brickShape == ShapeType::kSolid) {
@@ -360,7 +359,7 @@ void Collision::checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 d
 
 void Collision::stopFalling() { // ReceptionObj()
 	if (IS_HERO(_engine->_animations->_currentlyProcessedActorIdx)) {
-		const IVec3 &processActor = _engine->_movements->_processActor;
+		const IVec3 &processActor = _engine->_actor->_processActorPtr->_processActor;
 		const int32 fall = _engine->_scene->_startYFalling - processActor.y;
 
 		if (fall >= BRICK_HEIGHT * 8) {
diff --git a/engines/twine/scene/collision.h b/engines/twine/scene/collision.h
index 0c15ca494b3..206d27f3568 100644
--- a/engines/twine/scene/collision.h
+++ b/engines/twine/scene/collision.h
@@ -35,7 +35,7 @@ class Collision {
 private:
 	TwinEEngine *_engine;
 
-	void handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, const ActorStruct *actor, ActorStruct *actorTest);
+	void handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, ActorStruct *actor, ActorStruct *actorTest);
 public:
 	Collision(TwinEEngine *engine);
 	/** Actor collision coordinate */
@@ -60,7 +60,7 @@ public:
 	 * Reajust actor position in scene according with brick shape bellow actor
 	 * @param brickShape Shape of brick bellow the actor
 	 */
-	void reajustActorPosition(ShapeType brickShape);
+	void reajustActorPosition(IVec3 &processActor, ShapeType brickShape) const;
 
 	/**
 	 * Check collision with actors
@@ -75,7 +75,7 @@ public:
 	 * @param z Hero Z coordinate
 	 * @param damageMask Cause damage mask
 	 */
-	void checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 damageMask);
+	void checkHeroCollisionWithBricks(ActorStruct *actor, int32 x, int32 y, int32 z, int32 damageMask);
 
 	/**
 	 * Check other actor collision with bricks
@@ -84,7 +84,7 @@ public:
 	 * @param z Actor Z coordinate
 	 * @param damageMask Cause damage mask
 	 */
-	void checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 damageMask);
+	void checkActorCollisionWithBricks(ActorStruct *actor, int32 x, int32 y, int32 z, int32 damageMask);
 
 	/** Make actor to stop falling */
 	void stopFalling();
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 7e57191c8df..c16ee133c85 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -37,10 +37,11 @@ namespace TwinE {
 
 Movements::Movements(TwinEEngine *engine) : _engine(engine) {}
 
-void Movements::getShadowPosition(const IVec3 &pos) {
-	const uint8 *ptr = _engine->_grid->getBlockBufferGround(pos, _processActor.y);
-	_processActor.x = pos.x;
-	_processActor.z = pos.z;
+IVec3 Movements::getShadowPosition(const IVec3 &pos) {
+	IVec3 shadowCoord;
+	const uint8 *ptr = _engine->_grid->getBlockBufferGround(pos, shadowCoord.y);
+	shadowCoord.x = pos.x;
+	shadowCoord.z = pos.z;
 
 	ShapeType shadowCollisionType;
 	const int32 blockIdx = *ptr;
@@ -51,9 +52,8 @@ void Movements::getShadowPosition(const IVec3 &pos) {
 	} else {
 		shadowCollisionType = ShapeType::kNone;
 	}
-	_engine->_collision->reajustActorPosition(shadowCollisionType);
-
-	_engine->_actor->_shadowCoord = _processActor;
+	_engine->_collision->reajustActorPosition(shadowCoord, shadowCollisionType);
+	return shadowCoord;
 }
 
 void Movements::setActorAngleSafe(int16 startAngle, int16 endAngle, int16 stepAngle, ActorMoveStruct *movePtr) {
diff --git a/engines/twine/scene/movements.h b/engines/twine/scene/movements.h
index 5b56280bb7d..363c21c9497 100644
--- a/engines/twine/scene/movements.h
+++ b/engines/twine/scene/movements.h
@@ -127,19 +127,13 @@ public:
 
 	bool _lastJoyFlag = false;
 
-	/** Process actor coordinate */
-	IVec3 _processActor;
-
-	/** Previous process actor coordinate */
-	IVec3 _previousActor;
-
 	int32 _targetActorDistance = 0;
 
 	/**
 	 * Get shadow position
 	 * @param pos Shadow coordinates
 	 */
-	void getShadowPosition(const IVec3 &pos);
+	IVec3 getShadowPosition(const IVec3 &pos);
 
 	/**
 	 * Set actor safe angle
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index fd3d9386a4a..e0d3670dc2b 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -774,8 +774,8 @@ void Scene::processActorZones(int32 actorIdx) {
 			case ZoneType::kLadder:
 				if (IS_HERO(actorIdx) && _engine->_actor->_heroBehaviour != HeroBehaviourType::kProtoPack && (actor->_anim == AnimationTypes::kForward || actor->_anim == AnimationTypes::kTopLadder || actor->_anim == AnimationTypes::kClimbLadder)) {
 					IVec3 destPos = _engine->_movements->rotateActor(actor->_boundingBox.mins.x, actor->_boundingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
-					destPos.x += _engine->_movements->_processActor.x;
-					destPos.z += _engine->_movements->_processActor.z;
+					destPos.x += actor->_processActor.x;
+					destPos.z += actor->_processActor.z;
 
 					if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= SCENE_SIZE_MAX && destPos.z <= SCENE_SIZE_MAX) {
 						if (_engine->_grid->getBrickShape(destPos.x, actor->_pos.y + BRICK_HEIGHT, destPos.z) != ShapeType::kNone) {




More information about the Scummvm-git-logs mailing list