[Scummvm-git-logs] scummvm master -> a0175e1b696a11cafdec17dbb92e74d99dac99fd

mgerhardy martin.gerhardy at gmail.com
Wed Mar 17 17:33:57 UTC 2021


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

Summary:
9420635ed3 TWINE: disable actor bbox rendering for some actors
ffc006e9c8 TWINE: reduced BonusParameter struct size from 32 to 16 bits
95e6b98463 TWINE: fixed addExtraBonus extra flags for keys according to disassembly
6b27f35c6a TWINE: minor cleanup
9d7ca64342 TWINE: removed ZVBox and ScenePoint struct - use BoundingBox and Vec3
fcdba48458 TWINE: more use of Vec3
3a6923795d TWINE: renamed Vec3 to IVec3
8769c1cf0a TWINE: renamed parameter
3b6bad320c TWINE: renamed method
4726df938c TWINE: minor cleanup
8b909d0ebc TWINE: moved enums into shared.h
f2e69b3f9c TWINE: converted to enum class
d0cff45a93 TWINE: renamed ActorBoundingBox members
f6555148ff TWINE: use BoundingBox struct in ActorBoundingBox
5383d9ff4b TWINE: use BoundingBox in BodyData
2fecba8fdd TWINE: use nullptr
df31075ecc TWINE: comment on sample idx
abae3e440a TWINE: refactored extra shape
110d324ae9 TWINE: renamed constants
b0411c3bf2 TWINE: const
a0175e1b69 TWINE: const


Commit: 9420635ed3806482b0ffa2d5b508f4131844dc5e
    https://github.com/scummvm/scummvm/commit/9420635ed3806482b0ffa2d5b508f4131844dc5e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: disable actor bbox rendering for some actors

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


diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index af8d9bfb73..8262240906 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -180,11 +180,14 @@ bool DebugScene::drawBox(const ScenePositionsProjected &positions, uint8 color)
 	return state;
 }
 
-// TODO: redrawing doesn't work properly yet for moving actors
 bool DebugScene::displayActors() {
 	bool state = false;
 	for (int i = 0; i < _engine->_scene->sceneNumActors; i++) {
 		const ActorStruct *actorPtr = _engine->_scene->getActor(i);
+		// TODO: redrawing doesn't work properly yet for moving actors
+		if (!actorPtr->staticFlags.bIsSpriteActor) {
+			continue;
+		}
 		const Vec3 &pos = actorPtr->pos;
 		const ZVBox &bbox = actorPtr->boudingBox;
 		const Vec3 mins(bbox.x.bottomLeft, bbox.y.bottomLeft, bbox.z.bottomLeft);
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index cfa320d754..4b8b1c1a1f 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -96,12 +96,12 @@ struct StaticFlagsStruct {
 	uint32 bIsCarrierActor : 1;             // 0x004000
 	// take smaller value for bound, or if not set take average for bound
 	uint32 bUseMiniZv : 1;                  // 0x008000
-	uint32 bHasInvalidPosition : 1;          // 0x010000
-	uint32 bNoElectricShock : 1;             // 0x020000
-	uint32 bHasSpriteAnim3D : 1;             // 0x040000
-	uint32 bNoPreClipping : 1;               // 0x080000
-	uint32 bHasZBuffer : 1;                  // 0x100000
-	uint32 bHasZBufferInWater : 1;           // 0x200000
+	uint32 bHasInvalidPosition : 1;         // 0x010000
+	uint32 bNoElectricShock : 1;            // 0x020000
+	uint32 bHasSpriteAnim3D : 1;            // 0x040000
+	uint32 bNoPreClipping : 1;              // 0x080000
+	uint32 bHasZBuffer : 1;                 // 0x100000
+	uint32 bHasZBufferInWater : 1;          // 0x200000
 };
 
 /** Actors dynamic flags structure */


Commit: ffc006e9c8c54b151998cc64c1ac85a003974db4
    https://github.com/scummvm/scummvm/commit/ffc006e9c8c54b151998cc64c1ac85a003974db4
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: reduced BonusParameter struct size from 32 to 16 bits

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


diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 4b8b1c1a1f..998bf68c79 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -135,16 +135,16 @@ struct DynamicFlagsStruct {
  * will be chosen randomly each time player uses Action.
  */
 struct BonusParameter {
-	uint32 unk1 : 1;
-	uint32 unk2 : 1;
-	uint32 unk3 : 1;
-	uint32 unk4 : 1;
-	uint32 kashes : 1;
-	uint32 lifepoints : 1;
-	uint32 magicpoints : 1;
-	uint32 key : 1;
-	uint32 cloverleaf : 1;
-	uint32 unused : 23;
+	uint16 unk1 : 1;
+	uint16 unk2 : 1;
+	uint16 unk3 : 1;
+	uint16 unk4 : 1;
+	uint16 kashes : 1;
+	uint16 lifepoints : 1;
+	uint16 magicpoints : 1;
+	uint16 key : 1;
+	uint16 cloverleaf : 1;
+	uint16 unused : 7;
 };
 
 #define kAnimationTypeLoop 0
@@ -271,19 +271,19 @@ private:
 	TwinEEngine *_engine;
 
 	/** Hero 3D entity for normal behaviour */
-	uint8 *heroEntityNORMAL = nullptr; // file3D0
+	uint8 *heroEntityNORMAL = nullptr;
 	int32 heroEntityNORMALSize = 0;
 	/** Hero 3D entity for athletic behaviour */
-	uint8 *heroEntityATHLETIC = nullptr; // file3D1
+	uint8 *heroEntityATHLETIC = nullptr;
 	int32 heroEntityATHLETICSize = 0;
 	/** Hero 3D entity for aggressive behaviour */
-	uint8 *heroEntityAGGRESSIVE = nullptr; // file3D2
+	uint8 *heroEntityAGGRESSIVE = nullptr;
 	int32 heroEntityAGGRESSIVESize = 0;
 	/** Hero 3D entity for discrete behaviour */
-	uint8 *heroEntityDISCRETE = nullptr; // file3D3
+	uint8 *heroEntityDISCRETE = nullptr;
 	int32 heroEntityDISCRETESize = 0;
 	/** Hero 3D entity for protopack behaviour */
-	uint8 *heroEntityPROTOPACK = nullptr; // file3D4
+	uint8 *heroEntityPROTOPACK = nullptr;
 	int32 heroEntityPROTOPACKSize = 0;
 
 	void initSpriteActor(int32 actorIdx);
@@ -301,12 +301,12 @@ public:
 	Actor(TwinEEngine *engine);
 	~Actor();
 
-	ActorStruct *processActorPtr = nullptr; // processActorVar1
+	ActorStruct *processActorPtr = nullptr;
 
 	/** Actor shadow coordinate */
 	Vec3 shadowCoord;
 	/** Actor shadow collition type - brick shape */
-	ShapeType shadowCollisionType = ShapeType::kNone; // shadowVar
+	ShapeType shadowCollisionType = ShapeType::kNone;
 
 	HeroBehaviourType heroBehaviour = HeroBehaviourType::kNormal;
 	/** Hero auto aggressive mode */
@@ -319,18 +319,18 @@ public:
 	int16 cropBottomScreen = 0;
 
 	/** Hero current anim for normal behaviour */
-	int16 heroAnimIdxNORMAL = 0; // TCos0Init
+	int16 heroAnimIdxNORMAL = 0;
 	/** Hero current anim for athletic behaviour */
-	int16 heroAnimIdxATHLETIC = 0; // TCos1Init
+	int16 heroAnimIdxATHLETIC = 0;
 	/** Hero current anim for aggressive behaviour */
-	int16 heroAnimIdxAGGRESSIVE = 0; // TCos2Init
+	int16 heroAnimIdxAGGRESSIVE = 0;
 	/** Hero current anim for discrete behaviour */
-	int16 heroAnimIdxDISCRETE = 0; // TCos3Init
+	int16 heroAnimIdxDISCRETE = 0;
 	/** Hero current anim for protopack behaviour */
-	int16 heroAnimIdxPROTOPACK = 0; // TCos4Init
+	int16 heroAnimIdxPROTOPACK = 0;
 
 	/** Hero anim for behaviour menu */
-	int16 heroAnimIdx[4]; // TCOS
+	int16 heroAnimIdx[4];
 
 	/** Actors 3D body table - size of NUM_BODIES */
 	uint8 *bodyTable[NUM_BODIES]{nullptr};


Commit: 95e6b98463b23f6e82194aec84d457f7053737a3
    https://github.com/scummvm/scummvm/commit/95e6b98463b23f6e82194aec84d457f7053737a3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: fixed addExtraBonus extra flags for keys according to disassembly

Changed paths:
    engines/twine/scene/extra.cpp


diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index fdfbbc93cd..5621afd1e3 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -258,11 +258,11 @@ int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle
 			continue;
 		}
 		extra->info0 = type;
-		extra->type = ExtraType::TIME_OUT | ExtraType::TAKABLE | ExtraType::FLASH | ExtraType::STOP_COL | ExtraType::BONUS;
+		extra->type = ExtraType::STOP_COL | ExtraType::TAKABLE | ExtraType::BONUS;
 
-		/*if(type == SPRITEHQR_KEY) {
-			extra->type = ExtraFlag::STOP_COL | ExtraFlag::TAKABLE | ExtraFlag::BONUS;
-		}*/
+		if (type != SPRITEHQR_KEY) {
+			extra->type = ExtraType::TIME_OUT | ExtraType::TAKABLE | ExtraType::FLASH | ExtraType::STOP_COL | ExtraType::BONUS;
+		}
 
 		extra->pos.x = x;
 		extra->pos.y = y;


Commit: 6b27f35c6a6e38ca7465888a7369bc804609326b
    https://github.com/scummvm/scummvm/commit/6b27f35c6a6e38ca7465888a7369bc804609326b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: minor cleanup

Changed paths:
    engines/twine/scene/extra.cpp


diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 5621afd1e3..f7839a845d 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -361,7 +361,7 @@ int32 Extra::addExtraAimingAtKey(int32 actorIdx, int32 x, int32 y, int32 z, int3
 		extra->destPos.z = 4000;
 		extra->strengthOfHit = 0;
 		_engine->_movements->setActorAngle(ANGLE_0, 4000, ANGLE_17, &extra->trackActorMove);
-		extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(x, z, extraList[extraIdx].pos.x, extraList[extraIdx].pos.z);
+		extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, extraList[extraIdx].pos);
 
 		return i;
 	}


Commit: 9d7ca643426eb72b0f5d2edfc5330dd6ff8b68d1
    https://github.com/scummvm/scummvm/commit/9d7ca643426eb72b0f5d2edfc5330dd6ff8b68d1
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: removed ZVBox and ScenePoint struct - use BoundingBox and Vec3

Changed paths:
    engines/twine/debugger/debug_scene.cpp
    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/extra.cpp
    engines/twine/scene/scene.cpp
    engines/twine/scene/scene.h


diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index 8262240906..14e145e860 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -189,10 +189,8 @@ bool DebugScene::displayActors() {
 			continue;
 		}
 		const Vec3 &pos = actorPtr->pos;
-		const ZVBox &bbox = actorPtr->boudingBox;
-		const Vec3 mins(bbox.x.bottomLeft, bbox.y.bottomLeft, bbox.z.bottomLeft);
-		const Vec3 maxs(bbox.x.topRight, bbox.y.topRight, bbox.z.topRight);
-		const ScenePositionsProjected &positions = calculateBoxPositions(pos + mins, pos + maxs);
+		const BoundingBox &bbox = actorPtr->boudingBox;
+		const ScenePositionsProjected &positions = calculateBoxPositions(pos + bbox.mins, pos + bbox.maxs);
 		if (!drawBox(positions, COLOR_WHITE)) {
 			continue;
 		}
@@ -229,7 +227,7 @@ bool DebugScene::displayZones() {
 			continue;
 		}
 
-		const ScenePositionsProjected &positions = calculateBoxPositions(zonePtr->bottomLeft, zonePtr->topRight);
+		const ScenePositionsProjected &positions = calculateBoxPositions(zonePtr->mins, zonePtr->maxs);
 		const uint8 color = 15 * 3 + zonePtr->type * 16;
 		if (!drawBox(positions, color)) {
 			continue;
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 93d8f0c4ec..2858ce59e9 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -192,7 +192,7 @@ int32 Redraw::fillActorDrawingList(bool bgRedraw) {
 		ActorStruct *actor = _engine->_scene->getActor(modelActorPos);
 		actor->dynamicFlags.bIsVisible = 0; // reset visible state
 
-		if (_engine->_grid->useCellingGrid != -1 && actor->pos.y > _engine->_scene->sceneZones[_engine->_grid->cellingGridIdx].topRight.y) {
+		if (_engine->_grid->useCellingGrid != -1 && actor->pos.y > _engine->_scene->sceneZones[_engine->_grid->cellingGridIdx].maxs.y) {
 			continue;
 		}
 		// no redraw required
@@ -435,9 +435,9 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
 			const int32 tmpZ = (actor->lastPos.z + BRICK_HEIGHT) / BRICK_SIZE;
 			_engine->_grid->drawOverSpriteActor(tmpX, tmpY, tmpZ);
 		} else {
-			const int32 tmpX = (actor->pos.x + actor->boudingBox.x.topRight + BRICK_HEIGHT) / BRICK_SIZE;
+			const int32 tmpX = (actor->pos.x + actor->boudingBox.maxs.x + BRICK_HEIGHT) / BRICK_SIZE;
 			int32 tmpY = actor->pos.y / BRICK_HEIGHT;
-			const int32 tmpZ = (actor->pos.z + actor->boudingBox.z.topRight + BRICK_HEIGHT) / BRICK_SIZE;
+			const int32 tmpZ = (actor->pos.z + actor->boudingBox.maxs.z + BRICK_HEIGHT) / BRICK_SIZE;
 			if (actor->brickShape() != ShapeType::kNone) {
 				tmpY++;
 			}
@@ -541,7 +541,7 @@ void Redraw::renderOverlays() {
 			case OverlayPosType::koFollowActor: {
 				ActorStruct *actor2 = _engine->_scene->getActor(overlay->info1);
 
-				_engine->_renderer->projectPositionOnScreen(actor2->pos.x - _engine->_grid->camera.x, actor2->pos.y + actor2->boudingBox.y.topRight - _engine->_grid->camera.y, actor2->pos.z - _engine->_grid->camera.z);
+				_engine->_renderer->projectPositionOnScreen(actor2->pos.x - _engine->_grid->camera.x, actor2->pos.y + actor2->boudingBox.maxs.y - _engine->_grid->camera.y, actor2->pos.z - _engine->_grid->camera.z);
 
 				overlay->x = _engine->_renderer->projPos.x;
 				overlay->y = _engine->_renderer->projPos.y;
@@ -746,7 +746,7 @@ void Redraw::drawBubble(int32 actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 
 	// get actor position on screen
-	_engine->_renderer->projectPositionOnScreen(actor->pos.x - _engine->_grid->camera.x, actor->pos.y + actor->boudingBox.y.topRight - _engine->_grid->camera.y, actor->pos.z - _engine->_grid->camera.z);
+	_engine->_renderer->projectPositionOnScreen(actor->pos.x - _engine->_grid->camera.x, actor->pos.y + actor->boudingBox.maxs.y - _engine->_grid->camera.y, actor->pos.z - _engine->_grid->camera.z);
 
 	if (actorIdx != bubbleActor) {
 		bubbleSpriteIndex = bubbleSpriteIndex ^ 1;
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index b03d47f2f1..d4a86e9fd6 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -155,13 +155,7 @@ void Actor::initSpriteActor(int32 actorIdx) {
 	if (localActor->staticFlags.bIsSpriteActor && localActor->sprite != -1 && localActor->entity != localActor->sprite) {
 		const BoundingBox *spritebbox = _engine->_resources->spriteBoundingBox.bbox(localActor->sprite);
 		localActor->entity = localActor->sprite;
-		ZVBox &bbox = localActor->boudingBox;
-		bbox.x.bottomLeft = spritebbox->mins.x;
-		bbox.x.topRight = spritebbox->maxs.x;
-		bbox.y.bottomLeft = spritebbox->mins.y;
-		bbox.y.topRight = spritebbox->maxs.y;
-		bbox.z.bottomLeft = spritebbox->mins.z;
-		bbox.z.topRight = spritebbox->maxs.z;
+		localActor->boudingBox = *spritebbox;
 	}
 }
 
@@ -252,13 +246,9 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 		localActor->body = BodyType::btNone;
 		localActor->entity = -1;
 
-		ZVBox &bbox = localActor->boudingBox;
-		bbox.x.bottomLeft = 0;
-		bbox.x.topRight = 0;
-		bbox.y.bottomLeft = 0;
-		bbox.y.topRight = 0;
-		bbox.z.bottomLeft = 0;
-		bbox.z.topRight = 0;
+		BoundingBox &bbox = localActor->boudingBox;
+		bbox.mins = Vec3();
+		bbox.maxs = Vec3();
 		debug("Failed to initialize body %i for actor %i", (int)bodyIdx, actorIdx);
 		return;
 	}
@@ -271,18 +261,18 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 	localActor->body = bodyIdx;
 
 	if (actorBoundingBox.hasBoundingBox) {
-		ZVBox &bbox = localActor->boudingBox;
-		bbox.x.bottomLeft = actorBoundingBox.bottomLeftX;
-		bbox.x.topRight = actorBoundingBox.topRightX;
-		bbox.y.bottomLeft = actorBoundingBox.bottomLeftY;
-		bbox.y.topRight = actorBoundingBox.topRightY;
-		bbox.z.bottomLeft = actorBoundingBox.bottomLeftZ;
-		bbox.z.topRight = actorBoundingBox.topRightZ;
+		BoundingBox &bbox = localActor->boudingBox;
+		bbox.mins.x = actorBoundingBox.bottomLeftX;
+		bbox.maxs.x = actorBoundingBox.topRightX;
+		bbox.mins.y = actorBoundingBox.bottomLeftY;
+		bbox.maxs.y = actorBoundingBox.topRightY;
+		bbox.mins.z = actorBoundingBox.bottomLeftZ;
+		bbox.maxs.z = actorBoundingBox.topRightZ;
 	} else {
-		ZVBox &bbox = localActor->boudingBox;
+		BoundingBox &bbox = localActor->boudingBox;
 		const BodyData &bd = bodyData[localActor->entity];
-		bbox.y.bottomLeft = bd.minsy;
-		bbox.y.topRight = bd.maxsy;
+		bbox.mins.y = bd.minsy;
+		bbox.maxs.y = bd.maxsy;
 
 		int32 result = 0;
 		const int32 distX = bd.maxsx - bd.minsx;
@@ -300,10 +290,10 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 			result >>= 2;
 		}
 
-		bbox.x.bottomLeft = -result;
-		bbox.x.topRight = result;
-		bbox.z.bottomLeft = -result;
-		bbox.z.topRight = result;
+		bbox.mins.x = -result;
+		bbox.maxs.x = result;
+		bbox.mins.z = -result;
+		bbox.maxs.z = result;
 	}
 }
 
@@ -355,13 +345,9 @@ void Actor::resetActor(int16 actorIdx) {
 	actor->pos.y = -1;
 	actor->pos.z = 0;
 
-	ZVBox &bbox = actor->boudingBox;
-	bbox.x.bottomLeft = 0;
-	bbox.x.topRight = 0;
-	bbox.y.bottomLeft = 0;
-	bbox.y.topRight = 0;
-	bbox.z.bottomLeft = 0;
-	bbox.z.topRight = 0;
+	BoundingBox &bbox = actor->boudingBox;
+	bbox.mins = Vec3();
+	bbox.maxs = Vec3();
 
 	actor->angle = 0;
 	actor->speed = 40;
@@ -467,8 +453,8 @@ void Actor::processActorExtraBonus(int32 actorIdx) { // GiveExtraBonus
 	} else {
 		ActorStruct *sceneHero = _engine->_scene->sceneHero;
 		const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->pos, sceneHero->pos);
-		_engine->_extra->addExtraBonus(actor->pos.x, actor->pos.y + actor->boudingBox.y.topRight, actor->pos.z, ANGLE_70, angle, bonusSprite, actor->bonusAmount);
-		_engine->_sound->playSample(Samples::ItemPopup, 1, actor->pos.x, actor->pos.y + actor->boudingBox.y.topRight, actor->pos.z, actorIdx);
+		_engine->_extra->addExtraBonus(actor->pos.x, actor->pos.y + actor->boudingBox.maxs.y, actor->pos.z, ANGLE_70, angle, bonusSprite, actor->bonusAmount);
+		_engine->_sound->playSample(Samples::ItemPopup, 1, actor->pos.x, actor->pos.y + actor->boudingBox.maxs.y, actor->pos.z, actorIdx);
 	}
 }
 
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 998bf68c79..5e44c809c1 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -58,19 +58,6 @@ struct ActorMoveStruct {
 	int32 getRealValue(int32 time);
 };
 
-/** Actors zone volumique points structure */
-struct ZVPoint {
-	int16 bottomLeft = 0;
-	int16 topRight = 0;
-};
-
-/** Actors zone volumique box structure */
-struct ZVBox {
-	ZVPoint x;
-	ZVPoint y;
-	ZVPoint z;
-};
-
 /** Actors animation timer structure */
 struct AnimTimerDataStruct {
 	const KeyFrame *ptr = nullptr;
@@ -248,7 +235,7 @@ public:
 	int32 animType = kAnimationTypeLoop;   // field_78
 	int32 brickSound = 0; // field_7A
 
-	ZVBox boudingBox;
+	BoundingBox boudingBox;
 	ActorMoveStruct move;
 	AnimTimerDataStruct animTimerData;
 };
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index e5d01829c8..9f4cbb1b7b 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -683,21 +683,21 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
 
 		if (IS_HERO(actorIdx) && !actor->staticFlags.bComputeLowCollision) {
 			// check hero collisions with bricks
-			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.x.bottomLeft, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.bottomLeft, 1);
-			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.x.topRight, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.bottomLeft, 2);
-			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.x.topRight, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.topRight, 4);
-			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.x.bottomLeft, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.topRight, 8);
+			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.mins.x, actor->boudingBox.mins.y, actor->boudingBox.mins.z, 1);
+			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.maxs.x, actor->boudingBox.mins.y, actor->boudingBox.mins.z, 2);
+			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.maxs.x, actor->boudingBox.mins.y, actor->boudingBox.maxs.z, 4);
+			_engine->_collision->checkHeroCollisionWithBricks(actor->boudingBox.mins.x, actor->boudingBox.mins.y, actor->boudingBox.maxs.z, 8);
 		} else {
 			// check other actors collisions with bricks
-			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.x.bottomLeft, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.bottomLeft, 1);
-			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.x.topRight, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.bottomLeft, 2);
-			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.x.topRight, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.topRight, 4);
-			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.x.bottomLeft, actor->boudingBox.y.bottomLeft, actor->boudingBox.z.topRight, 8);
+			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.mins.x, actor->boudingBox.mins.y, actor->boudingBox.mins.z, 1);
+			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.maxs.x, actor->boudingBox.mins.y, actor->boudingBox.mins.z, 2);
+			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.maxs.x, actor->boudingBox.mins.y, actor->boudingBox.maxs.z, 4);
+			_engine->_collision->checkActorCollisionWithBricks(actor->boudingBox.mins.x, actor->boudingBox.mins.y, actor->boudingBox.maxs.z, 8);
 		}
 
 		// process wall hit while running
 		if (_engine->_collision->causeActorDamage && !actor->dynamicFlags.bIsFalling && !currentlyProcessedActorIdx && _engine->_actor->heroBehaviour == HeroBehaviourType::kAthletic && actor->anim == AnimationTypes::kForward) {
-			_engine->_movements->rotateActor(actor->boudingBox.x.bottomLeft, actor->boudingBox.z.bottomLeft, actor->angle + ANGLE_360 + ANGLE_135);
+			_engine->_movements->rotateActor(actor->boudingBox.mins.x, actor->boudingBox.mins.z, actor->angle + ANGLE_360 + ANGLE_135);
 
 			_engine->_renderer->destPos.x += _engine->_movements->processActor.x;
 			_engine->_renderer->destPos.z += _engine->_movements->processActor.z;
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 6f56b8d465..dfa89a6acf 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -45,24 +45,20 @@ bool Collision::standingOnActor(int32 actorIdx1, int32 actorIdx2) {
 	const ActorStruct *actor2 = _engine->_scene->getActor(actorIdx2);
 
 	// Current actor (actor 1)
-	const int32 x1Left = _engine->_movements->processActor.x + actor1->boudingBox.x.bottomLeft;
-	const int32 x1Right = _engine->_movements->processActor.x + actor1->boudingBox.x.topRight;
-
-	const int32 y1Left = _engine->_movements->processActor.y + actor1->boudingBox.y.bottomLeft;
-	const int32 y1Right = _engine->_movements->processActor.y + actor1->boudingBox.y.topRight;
-
-	const int32 z1Left = _engine->_movements->processActor.z + actor1->boudingBox.z.bottomLeft;
-	const int32 z1Right = _engine->_movements->processActor.z + actor1->boudingBox.z.topRight;
+	const int32 x1Left = _engine->_movements->processActor.x + actor1->boudingBox.mins.x;
+	const int32 x1Right = _engine->_movements->processActor.x + actor1->boudingBox.maxs.x;
+	const int32 y1Left = _engine->_movements->processActor.y + actor1->boudingBox.mins.y;
+	const int32 y1Right = _engine->_movements->processActor.y + actor1->boudingBox.maxs.y;
+	const int32 z1Left = _engine->_movements->processActor.z + actor1->boudingBox.mins.z;
+	const int32 z1Right = _engine->_movements->processActor.z + actor1->boudingBox.maxs.z;
 
 	// Actor 2
-	const int32 x2Left = actor2->pos.x + actor2->boudingBox.x.bottomLeft;
-	const int32 x2Right = actor2->pos.x + actor2->boudingBox.x.topRight;
-
-	const int32 y2Left = actor2->pos.y + actor2->boudingBox.y.bottomLeft;
-	const int32 y2Right = actor2->pos.y + actor2->boudingBox.y.topRight;
-
-	const int32 z2Left = actor2->pos.z + actor2->boudingBox.z.bottomLeft;
-	const int32 z2Right = actor2->pos.z + actor2->boudingBox.z.topRight;
+	const int32 x2Left = actor2->pos.x + actor2->boudingBox.mins.x;
+	const int32 x2Right = actor2->pos.x + actor2->boudingBox.maxs.x;
+	const int32 y2Left = actor2->pos.y + actor2->boudingBox.mins.y;
+	const int32 y2Right = actor2->pos.y + actor2->boudingBox.maxs.y;
+	const int32 z2Left = actor2->pos.z + actor2->boudingBox.mins.z;
+	const int32 z2Right = actor2->pos.z + actor2->boudingBox.maxs.z;
 
 	if (x1Left >= x2Right) {
 		return false; // not standing
@@ -206,14 +202,12 @@ void Collision::reajustActorPosition(ShapeType brickShape) {
 int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 
-	int32 xLeft = _engine->_movements->processActor.x + actor->boudingBox.x.bottomLeft;
-	int32 xRight = _engine->_movements->processActor.x + actor->boudingBox.x.topRight;
-
-	int32 yLeft = _engine->_movements->processActor.y + actor->boudingBox.y.bottomLeft;
-	int32 yRight = _engine->_movements->processActor.y + actor->boudingBox.y.topRight;
-
-	int32 zLeft = _engine->_movements->processActor.z + actor->boudingBox.z.bottomLeft;
-	int32 zRight = _engine->_movements->processActor.z + actor->boudingBox.z.topRight;
+	int32 xLeft = _engine->_movements->processActor.x + actor->boudingBox.mins.x;
+	int32 xRight = _engine->_movements->processActor.x + actor->boudingBox.maxs.x;
+	int32 yLeft = _engine->_movements->processActor.y + actor->boudingBox.mins.y;
+	int32 yRight = _engine->_movements->processActor.y + actor->boudingBox.maxs.y;
+	int32 zLeft = _engine->_movements->processActor.z + actor->boudingBox.mins.z;
+	int32 zRight = _engine->_movements->processActor.z + actor->boudingBox.maxs.z;
 
 	actor->collision = -1;
 
@@ -222,25 +216,23 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 
 		// aviod current processed actor
 		if (a != actorIdx && actorTest->entity != -1 && !actor->staticFlags.bComputeLowCollision && actorTest->standOn != actorIdx) {
-			const int32 xLeftTest = actorTest->pos.x + actorTest->boudingBox.x.bottomLeft;
-			const int32 xRightTest = actorTest->pos.x + actorTest->boudingBox.x.topRight;
-
-			const int32 yLeftTest = actorTest->pos.y + actorTest->boudingBox.y.bottomLeft;
-			const int32 yRightTest = actorTest->pos.y + actorTest->boudingBox.y.topRight;
-
-			const int32 zLeftTest = actorTest->pos.z + actorTest->boudingBox.z.bottomLeft;
-			const int32 zRightTest = actorTest->pos.z + actorTest->boudingBox.z.topRight;
+			const int32 xLeftTest = actorTest->pos.x + actorTest->boudingBox.mins.x;
+			const int32 xRightTest = actorTest->pos.x + actorTest->boudingBox.maxs.x;
+			const int32 yLeftTest = actorTest->pos.y + actorTest->boudingBox.mins.y;
+			const int32 yRightTest = actorTest->pos.y + actorTest->boudingBox.maxs.y;
+			const int32 zLeftTest = actorTest->pos.z + actorTest->boudingBox.mins.z;
+			const int32 zRightTest = actorTest->pos.z + actorTest->boudingBox.maxs.z;
 
 			if (xLeft < xRightTest && xRight > xLeftTest && yLeft < yRightTest && yRight > yLeftTest && zLeft < zRightTest && zRight > zLeftTest) {
 				actor->collision = a; // mark as collision with actor a
 
 				if (actorTest->staticFlags.bIsCarrierActor) {
 					if (actor->dynamicFlags.bIsFalling) {
-						_engine->_movements->processActor.y = yRightTest - actor->boudingBox.y.bottomLeft + 1;
+						_engine->_movements->processActor.y = yRightTest - actor->boudingBox.mins.y + 1;
 						actor->standOn = a;
 					} else {
 						if (standingOnActor(actorIdx, a)) {
-							_engine->_movements->processActor.y = yRightTest - actor->boudingBox.y.bottomLeft + 1;
+							_engine->_movements->processActor.y = yRightTest - actor->boudingBox.mins.y + 1;
 							actor->standOn = a;
 						} else {
 							int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(_engine->_movements->processActor, actorTest->pos);
@@ -267,19 +259,19 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 								}
 							}
 
-							if ((actorTest->boudingBox.x.topRight - actorTest->boudingBox.x.bottomLeft == actorTest->boudingBox.z.topRight - actorTest->boudingBox.z.bottomLeft) &&
-							    (actor->boudingBox.x.topRight - actor->boudingBox.x.bottomLeft == actor->boudingBox.z.topRight - actor->boudingBox.z.bottomLeft)) {
+							if ((actorTest->boudingBox.maxs.x - actorTest->boudingBox.mins.x == actorTest->boudingBox.maxs.z - actorTest->boudingBox.mins.z) &&
+							    (actor->boudingBox.maxs.x - actor->boudingBox.mins.x == actor->boudingBox.maxs.z - actor->boudingBox.mins.z)) {
 								if (newAngle < ANGLE_135) {
-									_engine->_movements->processActor.x = xLeftTest - actor->boudingBox.x.topRight;
+									_engine->_movements->processActor.x = xLeftTest - actor->boudingBox.maxs.x;
 								}
 								if (newAngle >= ANGLE_135 && newAngle < ANGLE_225) {
-									_engine->_movements->processActor.z = zRightTest - actor->boudingBox.z.bottomLeft;
+									_engine->_movements->processActor.z = zRightTest - actor->boudingBox.mins.z;
 								}
 								if (newAngle >= ANGLE_225 && newAngle < ANGLE_315) {
-									_engine->_movements->processActor.x = xRightTest - actor->boudingBox.x.bottomLeft;
+									_engine->_movements->processActor.x = xRightTest - actor->boudingBox.mins.x;
 								}
 								if (newAngle >= ANGLE_315 || (newAngle < ANGLE_315 && newAngle < ANGLE_45)) {
-									_engine->_movements->processActor.z = zLeftTest - actor->boudingBox.z.topRight;
+									_engine->_movements->processActor.z = zLeftTest - actor->boudingBox.maxs.z;
 								}
 							} else {
 								if (!actor->dynamicFlags.bIsFalling) {
@@ -317,19 +309,19 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 						}
 					}
 
-					if ((actorTest->boudingBox.x.topRight - actorTest->boudingBox.x.bottomLeft == actorTest->boudingBox.z.topRight - actorTest->boudingBox.z.bottomLeft) &&
-					    (actor->boudingBox.x.topRight - actor->boudingBox.x.bottomLeft == actor->boudingBox.z.topRight - actor->boudingBox.z.bottomLeft)) {
+					if ((actorTest->boudingBox.maxs.x - actorTest->boudingBox.mins.x == actorTest->boudingBox.maxs.z - actorTest->boudingBox.mins.z) &&
+					    (actor->boudingBox.maxs.x - actor->boudingBox.mins.x == actor->boudingBox.maxs.z - actor->boudingBox.mins.z)) {
 						if (newAngle < ANGLE_135) {
-							_engine->_movements->processActor.x = xLeftTest - actor->boudingBox.x.topRight;
+							_engine->_movements->processActor.x = xLeftTest - actor->boudingBox.maxs.x;
 						}
 						if (newAngle >= ANGLE_135 && newAngle < ANGLE_225) {
-							_engine->_movements->processActor.z = zRightTest - actor->boudingBox.z.bottomLeft;
+							_engine->_movements->processActor.z = zRightTest - actor->boudingBox.mins.z;
 						}
 						if (newAngle >= ANGLE_225 && newAngle < ANGLE_315) {
-							_engine->_movements->processActor.x = xRightTest - actor->boudingBox.x.bottomLeft;
+							_engine->_movements->processActor.x = xRightTest - actor->boudingBox.mins.x;
 						}
 						if (newAngle >= ANGLE_315 || (newAngle < ANGLE_315 && newAngle < ANGLE_45)) {
-							_engine->_movements->processActor.z = zLeftTest - actor->boudingBox.z.topRight;
+							_engine->_movements->processActor.z = zLeftTest - actor->boudingBox.maxs.z;
 						}
 					} else {
 						if (!actor->dynamicFlags.bIsFalling) {
@@ -346,28 +338,26 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
 	if (actor->dynamicFlags.bIsHitting) {
 		_engine->_movements->rotateActor(0, 200, actor->angle);
 
-		xLeft = _engine->_renderer->destPos.x + _engine->_movements->processActor.x + actor->boudingBox.x.bottomLeft;
-		xRight = _engine->_renderer->destPos.x + _engine->_movements->processActor.x + actor->boudingBox.x.topRight;
+		xLeft = _engine->_renderer->destPos.x + _engine->_movements->processActor.x + actor->boudingBox.mins.x;
+		xRight = _engine->_renderer->destPos.x + _engine->_movements->processActor.x + actor->boudingBox.maxs.x;
 
-		yLeft = _engine->_movements->processActor.y + actor->boudingBox.y.bottomLeft;
-		yRight = _engine->_movements->processActor.y + actor->boudingBox.y.topRight;
+		yLeft = _engine->_movements->processActor.y + actor->boudingBox.mins.y;
+		yRight = _engine->_movements->processActor.y + actor->boudingBox.maxs.y;
 
-		zLeft = _engine->_renderer->destPos.z + _engine->_movements->processActor.z + actor->boudingBox.z.bottomLeft;
-		zRight = _engine->_renderer->destPos.z + _engine->_movements->processActor.z + actor->boudingBox.z.topRight;
+		zLeft = _engine->_renderer->destPos.z + _engine->_movements->processActor.z + actor->boudingBox.mins.z;
+		zRight = _engine->_renderer->destPos.z + _engine->_movements->processActor.z + actor->boudingBox.maxs.z;
 
 		for (int32 a = 0; a < _engine->_scene->sceneNumActors; a++) {
 			const ActorStruct *actorTest = _engine->_scene->getActor(a);
 
 			// aviod current processed actor
 			if (a != actorIdx && actorTest->entity != -1 && !actorTest->staticFlags.bIsHidden && actorTest->standOn != actorIdx) {
-				const int32 xLeftTest = actorTest->pos.x + actorTest->boudingBox.x.bottomLeft;
-				const int32 xRightTest = actorTest->pos.x + actorTest->boudingBox.x.topRight;
-
-				const int32 yLeftTest = actorTest->pos.y + actorTest->boudingBox.y.bottomLeft;
-				const int32 yRightTest = actorTest->pos.y + actorTest->boudingBox.y.topRight;
-
-				const int32 zLeftTest = actorTest->pos.z + actorTest->boudingBox.z.bottomLeft;
-				const int32 zRightTest = actorTest->pos.z + actorTest->boudingBox.z.topRight;
+				const int32 xLeftTest =  actorTest->pos.x + actorTest->boudingBox.mins.x;
+				const int32 xRightTest = actorTest->pos.x + actorTest->boudingBox.maxs.x;
+				const int32 yLeftTest =  actorTest->pos.y + actorTest->boudingBox.mins.y;
+				const int32 yRightTest = actorTest->pos.y + actorTest->boudingBox.maxs.y;
+				const int32 zLeftTest =  actorTest->pos.z + actorTest->boudingBox.mins.z;
+				const int32 zRightTest = actorTest->pos.z + actorTest->boudingBox.maxs.z;
 
 				if (xLeft < xRightTest && xRight > xLeftTest && yLeft < yRightTest && yRight > yLeftTest && zLeft < zRightTest && zRight > zLeftTest) {
 					_engine->_actor->hitActor(actorIdx, a, actor->strengthOfHit, actor->angle + ANGLE_180);
@@ -389,14 +379,14 @@ void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 da
 
 	if (_engine->_movements->processActor.x >= 0 && _engine->_movements->processActor.z >= 0 && _engine->_movements->processActor.x <= 0x7E00 && _engine->_movements->processActor.z <= 0x7E00) {
 		reajustActorPosition(brickShape);
-		brickShape = _engine->_grid->getBrickShapeFull(_engine->_movements->processActor.x, _engine->_movements->processActor.y, _engine->_movements->processActor.z, _engine->_actor->processActorPtr->boudingBox.y.topRight);
+		brickShape = _engine->_grid->getBrickShapeFull(_engine->_movements->processActor.x, _engine->_movements->processActor.y, _engine->_movements->processActor.z, _engine->_actor->processActorPtr->boudingBox.maxs.y);
 
 		if (brickShape == ShapeType::kSolid) {
 			causeActorDamage |= damageMask;
-			brickShape = _engine->_grid->getBrickShapeFull(_engine->_movements->processActor.x, _engine->_movements->processActor.y, _engine->_movements->previousActor.z + z, _engine->_actor->processActorPtr->boudingBox.y.topRight);
+			brickShape = _engine->_grid->getBrickShapeFull(_engine->_movements->processActor.x, _engine->_movements->processActor.y, _engine->_movements->previousActor.z + z, _engine->_actor->processActorPtr->boudingBox.maxs.y);
 
 			if (brickShape == ShapeType::kSolid) {
-				brickShape = _engine->_grid->getBrickShapeFull(x + _engine->_movements->previousActor.x, _engine->_movements->processActor.y, _engine->_movements->processActor.z, _engine->_actor->processActorPtr->boudingBox.y.topRight);
+				brickShape = _engine->_grid->getBrickShapeFull(x + _engine->_movements->previousActor.x, _engine->_movements->processActor.y, _engine->_movements->processActor.z, _engine->_actor->processActorPtr->boudingBox.maxs.y);
 
 				if (brickShape != ShapeType::kSolid) {
 					processCollision.x = _engine->_movements->previousActor.x;
@@ -479,12 +469,12 @@ int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 act
 		const ActorStruct *actorTest = _engine->_scene->getActor(a);
 
 		if (a != actorIdx && actorTest->entity != -1) {
-			const int32 xLeftTest = actorTest->pos.x + actorTest->boudingBox.x.bottomLeft;
-			const int32 xRightTest = actorTest->pos.x + actorTest->boudingBox.x.topRight;
-			const int32 yLeftTest = actorTest->pos.y + actorTest->boudingBox.y.bottomLeft;
-			const int32 yRightTest = actorTest->pos.y + actorTest->boudingBox.y.topRight;
-			const int32 zLeftTest = actorTest->pos.z + actorTest->boudingBox.z.bottomLeft;
-			const int32 zRightTest = actorTest->pos.z + actorTest->boudingBox.z.topRight;
+			const int32 xLeftTest = actorTest->pos.x + actorTest->boudingBox.mins.x;
+			const int32 xRightTest = actorTest->pos.x + actorTest->boudingBox.maxs.x;
+			const int32 yLeftTest = actorTest->pos.y + actorTest->boudingBox.mins.y;
+			const int32 yRightTest = actorTest->pos.y + actorTest->boudingBox.maxs.y;
+			const int32 zLeftTest = actorTest->pos.z + actorTest->boudingBox.mins.z;
+			const int32 zRightTest = actorTest->pos.z + actorTest->boudingBox.maxs.z;
 
 			if (xLeft < xRightTest && xRight > xLeftTest && yLeft < yRightTest && yRight > yLeftTest && zLeft < zRightTest && zRight > zLeftTest) {
 				if (extra->strengthOfHit != 0) {
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index f7839a845d..a380b1da67 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -125,7 +125,7 @@ int32 Extra::addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx
 
 		_engine->_movements->setActorAngle(ANGLE_0, maxSpeed, ANGLE_17, &extra->trackActorMove);
 		const ActorStruct *actor = _engine->_scene->getActor(targetActor);
-		extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(x, z, actor->pos.x, actor->pos.z);
+		extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->pos);
 		return i;
 	}
 	return -1;
@@ -324,7 +324,7 @@ int32 Extra::addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spr
 		extra->strengthOfHit = strengthOfHit;
 		_engine->_movements->setActorAngle(ANGLE_0, finalAngle, ANGLE_17, &extra->trackActorMove);
 		const ActorStruct *actor = _engine->_scene->getActor(targetActorIdx);
-		extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(x, z, actor->pos.x, actor->pos.z);
+		extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->pos);
 
 		return i;
 	}
@@ -637,7 +637,7 @@ void Extra::processExtras() {
 			currentExtraY = actor->pos.y + 1000;
 			currentExtraZ = actor->pos.z;
 
-			const int32 tmpAngle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos.x, extra->pos.z, currentExtraX, currentExtraZ);
+			const int32 tmpAngle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->pos);
 			const int32 angle = ClampAngle(tmpAngle - extra->angle);
 
 			if (angle > ANGLE_140 && angle < ANGLE_210) {
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index ff8aa9e1ba..f78b33177f 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -239,13 +239,13 @@ bool Scene::loadSceneLBA2() {
 	sceneNumZones = stream.readUint16LE();
 	for (int32 i = 0; i < sceneNumZones; i++) {
 		ZoneStruct *zone = &sceneZones[i];
-		zone->bottomLeft.x = stream.readSint32LE();
-		zone->bottomLeft.y = stream.readSint32LE();
-		zone->bottomLeft.z = stream.readSint32LE();
+		zone->mins.x = stream.readSint32LE();
+		zone->mins.y = stream.readSint32LE();
+		zone->mins.z = stream.readSint32LE();
 
-		zone->topRight.x = stream.readSint32LE();
-		zone->topRight.y = stream.readSint32LE();
-		zone->topRight.z = stream.readSint32LE();
+		zone->maxs.x = stream.readSint32LE();
+		zone->maxs.y = stream.readSint32LE();
+		zone->maxs.z = stream.readSint32LE();
 
 		zone->infoData.generic.info0 = stream.readSint32LE();
 		zone->infoData.generic.info1 = stream.readSint32LE();
@@ -367,13 +367,13 @@ bool Scene::loadSceneLBA1() {
 	sceneNumZones = stream.readUint16LE();
 	for (int32 i = 0; i < sceneNumZones; i++) {
 		ZoneStruct *zone = &sceneZones[i];
-		zone->bottomLeft.x = stream.readUint16LE();
-		zone->bottomLeft.y = stream.readUint16LE();
-		zone->bottomLeft.z = stream.readUint16LE();
+		zone->mins.x = stream.readUint16LE();
+		zone->mins.y = stream.readUint16LE();
+		zone->mins.z = stream.readUint16LE();
 
-		zone->topRight.x = stream.readUint16LE();
-		zone->topRight.y = stream.readUint16LE();
-		zone->topRight.z = stream.readUint16LE();
+		zone->maxs.x = stream.readUint16LE();
+		zone->maxs.y = stream.readUint16LE();
+		zone->maxs.z = stream.readUint16LE();
 
 		zone->type = stream.readUint16LE();
 
@@ -406,17 +406,17 @@ bool Scene::loadSceneLBA1() {
 			_sceneActors[29].pos.z = _sceneActors[29].collisionPos.z = 0x703;
 			assert(sceneNumZones >= 23);
 			// each scene zone entry has 24 bytes
-			sceneZones[15].bottomLeft.y = 0x450; // [zone:15] 362 (mod:2) offset relative to sceneNumZones
+			sceneZones[15].mins.y = 0x450; // [zone:15] 362 (mod:2) offset relative to sceneNumZones
 			sceneZones[15].type = 0x2ce0; // [zone:15] 372 (mod:12) offset relative to sceneNumZones
-			sceneZones[16].bottomLeft.y = 0x5270; // [zone:16] 386 (mod:2) offset relative to sceneNumZones
+			sceneZones[16].mins.y = 0x5270; // [zone:16] 386 (mod:2) offset relative to sceneNumZones
 			sceneZones[16].type = 0x1f90; // [zone:16] 396 (mod:12) offset relative to sceneNumZones
-			sceneZones[22].bottomLeft.y = 0x1800; // [zone:22] 530 (mod:2) offset relative to sceneNumZones
-			sceneZones[15].topRight.x = 0x10f0;
-			sceneZones[15].topRight.y = 0x2100; // [zone:15] 366 (mod:6) offset relative to sceneNumZones (4 bytes)
-			sceneZones[16].topRight.x = 0x5d10;
-			sceneZones[16].topRight.y = 0x1200; // [zone:16] 390 (mod:6) offset relative to sceneNumZones (4 bytes)
-			sceneZones[22].topRight.x = 0x22a1;
-			sceneZones[22].topRight.y = 0x1800; // [zone:22] 534 (mod:6) offset relative to sceneNumZones (4 bytes)
+			sceneZones[22].mins.y = 0x1800; // [zone:22] 530 (mod:2) offset relative to sceneNumZones
+			sceneZones[15].maxs.x = 0x10f0;
+			sceneZones[15].maxs.y = 0x2100; // [zone:15] 366 (mod:6) offset relative to sceneNumZones (4 bytes)
+			sceneZones[16].maxs.x = 0x5d10;
+			sceneZones[16].maxs.y = 0x1200; // [zone:16] 390 (mod:6) offset relative to sceneNumZones (4 bytes)
+			sceneZones[22].maxs.x = 0x22a1;
+			sceneZones[22].maxs.y = 0x1800; // [zone:22] 534 (mod:6) offset relative to sceneNumZones (4 bytes)
 			sceneZones[22].type = 0x1ae1; // [zone:22] 540 (mod:12) offset relative to sceneNumZones
 			break;
 		case LBA1SceneId::Tippet_Island_Secret_passage_scene_1:
@@ -649,8 +649,8 @@ void Scene::processZoneExtraBonus(ZoneStruct *zone) {
 	}
 
 	const int16 amount = zone->infoData.Bonus.amount;
-	const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(ABS(zone->topRight.x + zone->bottomLeft.x) / 2, ABS(zone->topRight.z + zone->bottomLeft.z) / 2, sceneHero->pos.x, sceneHero->pos.z);
-	const int32 index = _engine->_extra->addExtraBonus(ABS(zone->topRight.x + zone->bottomLeft.x) / 2, zone->topRight.y, ABS(zone->topRight.z + zone->bottomLeft.z) / 2, ANGLE_63, angle, bonusSprite, amount);
+	const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(ABS(zone->maxs.x + zone->mins.x) / 2, ABS(zone->maxs.z + zone->mins.z) / 2, sceneHero->pos.x, sceneHero->pos.z);
+	const int32 index = _engine->_extra->addExtraBonus(ABS(zone->maxs.x + zone->mins.x) / 2, zone->maxs.y, ABS(zone->maxs.z + zone->mins.z) / 2, ANGLE_63, angle, bonusSprite, amount);
 
 	if (index != -1) {
 		_engine->_extra->extraList[index].type |= ExtraType::TIME_IN;
@@ -676,16 +676,16 @@ void Scene::processActorZones(int32 actorIdx) {
 		ZoneStruct *zone = &sceneZones[z];
 
 		// check if actor is in zone
-		if ((currentX >= zone->bottomLeft.x && currentX <= zone->topRight.x) &&
-		    (currentY >= zone->bottomLeft.y && currentY <= zone->topRight.y) &&
-		    (currentZ >= zone->bottomLeft.z && currentZ <= zone->topRight.z)) {
+		if ((currentX >= zone->mins.x && currentX <= zone->maxs.x) &&
+		    (currentY >= zone->mins.y && currentY <= zone->maxs.y) &&
+		    (currentZ >= zone->mins.z && currentZ <= zone->maxs.z)) {
 			switch (zone->type) {
 			case ZoneType::kCube:
 				if (IS_HERO(actorIdx) && actor->life > 0) {
 					needChangeScene = zone->infoData.ChangeScene.newSceneIdx;
-					_zoneHeroPos.x = actor->pos.x - zone->bottomLeft.x + zone->infoData.ChangeScene.x;
-					_zoneHeroPos.y = actor->pos.y - zone->bottomLeft.y + zone->infoData.ChangeScene.y;
-					_zoneHeroPos.z = actor->pos.z - zone->bottomLeft.z + zone->infoData.ChangeScene.z;
+					_zoneHeroPos.x = actor->pos.x - zone->mins.x + zone->infoData.ChangeScene.x;
+					_zoneHeroPos.y = actor->pos.y - zone->mins.y + zone->infoData.ChangeScene.y;
+					_zoneHeroPos.z = actor->pos.z - zone->mins.z + zone->infoData.ChangeScene.z;
 					heroPositionType = ScenePositionType::kZone;
 				}
 				break;
@@ -736,14 +736,14 @@ void Scene::processActorZones(int32 actorIdx) {
 				break;
 			case ZoneType::kLadder:
 				if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour != HeroBehaviourType::kProtoPack && (actor->anim == AnimationTypes::kForward || actor->anim == AnimationTypes::kTopLadder || actor->anim == AnimationTypes::kClimbLadder)) {
-					_engine->_movements->rotateActor(actor->boudingBox.x.bottomLeft, actor->boudingBox.z.bottomLeft, actor->angle + ANGLE_360 + ANGLE_135);
+					_engine->_movements->rotateActor(actor->boudingBox.mins.x, actor->boudingBox.mins.z, actor->angle + ANGLE_360 + ANGLE_135);
 					_engine->_renderer->destPos.x += _engine->_movements->processActor.x;
 					_engine->_renderer->destPos.z += _engine->_movements->processActor.z;
 
 					if (_engine->_renderer->destPos.x >= 0 && _engine->_renderer->destPos.z >= 0 && _engine->_renderer->destPos.x <= 0x7E00 && _engine->_renderer->destPos.z <= 0x7E00) {
 						if (_engine->_grid->getBrickShape(_engine->_renderer->destPos.x, actor->pos.y + ANGLE_90, _engine->_renderer->destPos.z) != ShapeType::kNone) {
 							currentActorInZone = true;
-							if (actor->pos.y >= ABS(zone->bottomLeft.y + zone->topRight.y) / 2) {
+							if (actor->pos.y >= ABS(zone->mins.y + zone->maxs.y) / 2) {
 								_engine->_animations->initAnim(AnimationTypes::kTopLadder, kAnimationType_2, AnimationTypes::kStanding, actorIdx); // reached end of ladder
 							} else {
 								_engine->_animations->initAnim(AnimationTypes::kClimbLadder, kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx); // go up in ladder
diff --git a/engines/twine/scene/scene.h b/engines/twine/scene/scene.h
index 48c7ead233..ba4dfd8e55 100644
--- a/engines/twine/scene/scene.h
+++ b/engines/twine/scene/scene.h
@@ -49,8 +49,8 @@ enum class ScenePositionType {
  * Special actions, like change scene, climbing a ladder, ...
  */
 struct ZoneStruct {
-	Vec3 bottomLeft;
-	Vec3 topRight;
+	Vec3 mins;
+	Vec3 maxs;
 	int16 type = 0;
 	int16 snap = 0;
 	union {


Commit: fcdba48458e314f9a4fa2816bf20fbc0471af808
    https://github.com/scummvm/scummvm/commit/fcdba48458e314f9a4fa2816bf20fbc0471af808
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: more use of Vec3

Changed paths:
    engines/twine/holomap.cpp
    engines/twine/holomap.h


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 3d89ea5eaa..c5757c8cfb 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -63,9 +63,9 @@ bool Holomap::loadLocations() {
 
 	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	for (int32 i = 0; i < _numLocations; i++) {
-		_locations[i].x = ClampAngle(stream.readSint16LE());
-		_locations[i].y = ClampAngle(stream.readSint16LE());
-		_locations[i].z = ClampAngle(stream.readSint16LE());
+		_locations[i].angle.x = ClampAngle(stream.readSint16LE());
+		_locations[i].angle.y = ClampAngle(stream.readSint16LE());
+		_locations[i].angle.z = ClampAngle(stream.readSint16LE());
 		_locations[i].textIndex = stream.readUint16LE();
 
 		if (_engine->_text->getMenuText(_locations[i].textIndex, _locations[i].name, sizeof(_locations[i].name))) {
@@ -170,7 +170,7 @@ void Holomap::prepareHolomapPolygons() {
 	for (int32 angle = -ANGLE_90; angle <= ANGLE_90; angle += ANGLE_11_25) {
 		int rotation = 0;
 		for (int32 stepWidth = 0; stepWidth < ANGLE_11_25; ++stepWidth) {
-			HolomapSurface* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
+			Vec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
 			_engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
 			if (angle != ANGLE_90) {
 				_holomapSort[holomapSortArrayIdx].z = _engine->_renderer->destPos.z;
@@ -183,7 +183,7 @@ void Holomap::prepareHolomapPolygons() {
 			rotation += ANGLE_11_25;
 			++_projectedSurfaceIndex;
 		}
-		HolomapSurface* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
+		Vec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
 		_engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
 		_engine->_renderer->projectXYPositionOnScreen(_engine->_renderer->destPos);
 		_projectedSurfacePositions[_projectedSurfaceIndex].x = _engine->_renderer->projPos.x;
@@ -281,9 +281,9 @@ Holomap::TrajectoryData Holomap::loadTrajectoryData(int32 trajectoryIdx) {
 	data.locationIdx = stream.readSint16LE();
 	data.trajLocationIdx = stream.readSint16LE();
 	data.vehicleIdx = stream.readSint16LE();
-	data.x = stream.readSint16LE();
-	data.y = stream.readSint16LE();
-	data.z = stream.readSint16LE();
+	data.pos.x = stream.readSint16LE();
+	data.pos.y = stream.readSint16LE();
+	data.pos.z = stream.readSint16LE();
 	data.numAnimFrames = stream.readSint16LE();
 	assert(data.numAnimFrames < ARRAYSIZE(data.positions));
 	for (int32 i = 0; i < data.numAnimFrames; ++i) {
@@ -310,12 +310,12 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	loadHolomapGFX();
 	ScopedEngineFreeze timeFreeze(_engine);
 	_engine->_renderer->setCameraPosition(400, 240, 128, 1024, 1024);
-	_engine->_renderer->setCameraAngle(0, 0, 0, data.x, data.y, data.z, 5300);
+	_engine->_renderer->setCameraAngle(0, 0, 0, data.pos.x, data.pos.y, data.pos.z, 5300);
 
 	renderHolomapSurfacePolygons();
 
 	const Location &loc = _locations[data.locationIdx];
-	renderHolomapModel(_engine->_resources->holomapPointModelPtr, loc.x, loc.y, 0);
+	renderHolomapModel(_engine->_resources->holomapPointModelPtr, loc.angle.x, loc.angle.y, 0);
 
 	_engine->flip();
 	ActorMoveStruct move;
@@ -370,8 +370,8 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 		_engine->_renderer->renderIsoModel(0, 0, 0, 0, newAngle, 0, modelPtr);
 		_engine->copyBlockPhys(rect);
 		_engine->_renderer->setCameraPosition(400, 240, 128, 1024, 1024);
-		_engine->_renderer->setCameraAngle(0, 0, 0, data.x, data.y, data.z, 5300);
-		_engine->_renderer->setLightVector(data.x, data.y, 0);
+		_engine->_renderer->setCameraAngle(0, 0, 0, data.pos.x, data.pos.y, data.pos.z, 5300);
+		_engine->_renderer->setLightVector(data.pos.x, data.pos.y, 0);
 		if (frameTime + 40 <= _engine->lbaTime) {
 			frameTime = _engine->lbaTime;
 			int32 modelX;
@@ -383,8 +383,8 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 				if (data.numAnimFrames < trajAnimFrameIdx) {
 					break;
 				}
-				modelX = _locations[data.trajLocationIdx].x;
-				modelY = _locations[data.trajLocationIdx].y;
+				modelX = _locations[data.trajLocationIdx].angle.x;
+				modelY = _locations[data.trajLocationIdx].angle.y;
 			}
 			renderHolomapModel(_engine->_resources->holomapPointModelPtr, modelX, modelY, 0);
 			++trajAnimFrameIdx;
@@ -428,8 +428,8 @@ void Holomap::renderLocations(int xRot, int yRot, int zRot, bool lower) {
 	for (int locationIdx = 0; locationIdx < NUM_LOCATIONS; ++locationIdx) {
 		if ((_engine->_gameState->holomapFlags[locationIdx] & 0x80) || locationIdx == _engine->_scene->currentSceneIdx) {
 			const Location &loc = _locations[locationIdx];
-			_engine->_renderer->setBaseRotation(loc.x, loc.y, 0);
-			_engine->_renderer->getBaseRotationPosition(0, 0, loc.z + 1000);
+			_engine->_renderer->setBaseRotation(loc.angle.x, loc.angle.y, 0);
+			_engine->_renderer->getBaseRotationPosition(0, 0, loc.angle.z + 1000);
 			int32 xpos1 = _engine->_renderer->destPos.x;
 			int32 ypos1 = _engine->_renderer->destPos.y;
 			int32 zpos1 = _engine->_renderer->destPos.z;
@@ -481,8 +481,8 @@ void Holomap::renderLocations(int xRot, int yRot, int zRot, bool lower) {
 			bodyPtr = _engine->_resources->holomapTwinsenArrowPtr;
 		}
 		if (bodyPtr != nullptr) {
-			int32 angleX = _locations[drawList.actorIdx].x;
-			int32 angleY = _locations[drawList.actorIdx].y;
+			int32 angleX = _locations[drawList.actorIdx].angle.x;
+			int32 angleY = _locations[drawList.actorIdx].angle.y;
 			_engine->_renderer->renderIsoModel(drawList.x, drawList.y, drawList.z, angleX, angleY, 0, bodyPtr);
 		}
 	}
@@ -514,8 +514,8 @@ void Holomap::processHolomap() {
 	_engine->flip();
 
 	int32 time = _engine->lbaTime;
-	int32 xRot = ClampAngle(_locations[currentLocation].x);
-	int32 yRot = ClampAngle(_locations[currentLocation].y);
+	int32 xRot = ClampAngle(_locations[currentLocation].angle.x);
+	int32 yRot = ClampAngle(_locations[currentLocation].angle.y);
 	bool rotate = false;
 	bool redraw = true;
 	int local18 = 0;
@@ -569,8 +569,8 @@ void Holomap::processHolomap() {
 
 		if (rotate) {
 			const int32 dt = _engine->lbaTime - time;
-			xRot = _engine->_collision->getAverageValue(ClampAngle(xRot), _locations[currentLocation].x, 75, dt);
-			yRot = _engine->_collision->getAverageValue(ClampAngle(yRot), _locations[currentLocation].y, 75, dt);
+			xRot = _engine->_collision->getAverageValue(ClampAngle(xRot), _locations[currentLocation].angle.x, 75, dt);
+			yRot = _engine->_collision->getAverageValue(ClampAngle(yRot), _locations[currentLocation].angle.y, 75, dt);
 			redraw = true;
 		}
 
@@ -607,7 +607,7 @@ void Holomap::processHolomap() {
 			_engine->copyBlockPhys(rect);
 		}
 
-		if (rotate && xRot == _locations[currentLocation].x && yRot == _locations[currentLocation].y) {
+		if (rotate && xRot == _locations[currentLocation].angle.x && yRot == _locations[currentLocation].angle.y) {
 			rotate = false;
 		}
 
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 8b408ce6d8..4f51d76379 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -45,10 +45,7 @@ private:
 	bool isTriangleVisible(const Vertex *vertices) const;
 
 	struct Location {
-		// angles
-		uint16 x = 0;
-		uint16 y = 0;
-		uint16 z = 0;
+		Vec3 angle;
 		uint16 textIndex = 0;
 		char name[30] = "";
 	};
@@ -64,12 +61,8 @@ private:
 		ArmyBoat = 45,
 		HamalayiTransporter = 47
 	};
-	struct HolomapSurface {
-		int16 x = 0;
-		int16 y = 0;
-		int16 z = 0;
-	};
-	HolomapSurface _holomapSurface[561];
+
+	Vec3 _holomapSurface[561];
 
 	// original game size: 2244 (lba1)
 	struct HolomapSort {
@@ -91,9 +84,7 @@ private:
 		int16 locationIdx = -1;
 		int16 trajLocationIdx = -1;
 		int16 vehicleIdx = -1;
-		int16 x = 0;
-		int16 y = 0;
-		int16 z = 0;
+		Vec3 pos;
 		int16 numAnimFrames = 0;
 		struct TrajectoryPos {
 			int16 x = 0;


Commit: 3a6923795d8c8618a28bb0aec932e75151d7782f
    https://github.com/scummvm/scummvm/commit/3a6923795d8c8618a28bb0aec932e75151d7782f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: renamed Vec3 to IVec3

Changed paths:
    engines/twine/audio/sound.h
    engines/twine/debugger/console.cpp
    engines/twine/debugger/debug_scene.cpp
    engines/twine/debugger/debug_scene.h
    engines/twine/holomap.cpp
    engines/twine/holomap.h
    engines/twine/renderer/renderer.cpp
    engines/twine/renderer/renderer.h
    engines/twine/scene/actor.cpp
    engines/twine/scene/actor.h
    engines/twine/scene/collision.h
    engines/twine/scene/extra.h
    engines/twine/scene/grid.h
    engines/twine/scene/movements.cpp
    engines/twine/scene/movements.h
    engines/twine/scene/scene.cpp
    engines/twine/scene/scene.h
    engines/twine/script/script_life_v1.cpp
    engines/twine/script/script_move_v1.cpp
    engines/twine/shared.h


diff --git a/engines/twine/audio/sound.h b/engines/twine/audio/sound.h
index 9289eea8ea..43859eb974 100644
--- a/engines/twine/audio/sound.h
+++ b/engines/twine/audio/sound.h
@@ -96,7 +96,7 @@ public:
 	 * @param actorIdx
 	 */
 	void playSample(int32 index, int32 repeat = 1, int32 x = 128, int32 y = 128, int32 z = 128, int32 actorIdx = -1);
-	void playSample(int32 index, int32 repeat, const Vec3 &pos, int32 actorIdx = -1) {
+	void playSample(int32 index, int32 repeat, const IVec3 &pos, int32 actorIdx = -1) {
 		playSample(index, repeat, pos.x, pos.y, pos.z, actorIdx);
 	}
 
diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index b34dc792ca..c767ffcf73 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -306,7 +306,7 @@ bool TwinEConsole::doListMenuText(int argc, const char **argv) {
 }
 
 bool TwinEConsole::doSetHeroPosition(int argc, const char **argv) {
-	Vec3 &pos = _engine->_scene->sceneHero->pos;
+	IVec3 &pos = _engine->_scene->sceneHero->pos;
 	if (argc < 4) {
 		debugPrintf("Current hero position: %i:%i:%i\n", pos.x, pos.y, pos.z);
 		return true;
diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index 14e145e860..9654832178 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -41,7 +41,7 @@ void DebugScene::drawClip(const Common::Rect &rect) {
 	_engine->_menu->drawBox(rect);
 }
 
-void DebugScene::drawBoundingBoxProjectPoints(Vec3 *pPoint3d, Vec3 *pPoint3dProjected) {
+void DebugScene::drawBoundingBoxProjectPoints(IVec3 *pPoint3d, IVec3 *pPoint3dProjected) {
 	_engine->_renderer->projectPositionOnScreen(pPoint3d->x, pPoint3d->y, pPoint3d->z);
 
 	pPoint3dProjected->x = _engine->_renderer->projPos.x;
@@ -102,7 +102,7 @@ int32 DebugScene::checkZoneType(int32 type) const {
 	return 0;
 }
 
-DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const Vec3 &bottomLeft, const Vec3 &topRight) {
+DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec3 &bottomLeft, const IVec3 &topRight) {
 	ScenePositionsProjected positions;
 	// compute the points in 3D
 	positions.frontBottomLeftPoint.x = bottomLeft.x - _engine->_grid->camera.x;
@@ -188,7 +188,7 @@ bool DebugScene::displayActors() {
 		if (!actorPtr->staticFlags.bIsSpriteActor) {
 			continue;
 		}
-		const Vec3 &pos = actorPtr->pos;
+		const IVec3 &pos = actorPtr->pos;
 		const BoundingBox &bbox = actorPtr->boudingBox;
 		const ScenePositionsProjected &positions = calculateBoxPositions(pos + bbox.mins, pos + bbox.maxs);
 		if (!drawBox(positions, COLOR_WHITE)) {
diff --git a/engines/twine/debugger/debug_scene.h b/engines/twine/debugger/debug_scene.h
index e7e75093fa..ca30e43982 100644
--- a/engines/twine/debugger/debug_scene.h
+++ b/engines/twine/debugger/debug_scene.h
@@ -35,39 +35,39 @@ class DebugScene {
 private:
 	TwinEEngine *_engine;
 
-	void drawBoundingBoxProjectPoints(Vec3 *point3d, Vec3 *point3dProjected);
+	void drawBoundingBoxProjectPoints(IVec3 *point3d, IVec3 *point3dProjected);
 	int32 checkZoneType(int32 type) const;
 	bool displayZones();
 	bool displayActors();
 	bool displayTracks();
 
 	struct ScenePositionsProjected {
-		Vec3 frontBottomLeftPoint;
-		Vec3 frontBottomRightPoint;
+		IVec3 frontBottomLeftPoint;
+		IVec3 frontBottomRightPoint;
 
-		Vec3 frontTopLeftPoint;
-		Vec3 frontTopRightPoint;
+		IVec3 frontTopLeftPoint;
+		IVec3 frontTopRightPoint;
 
-		Vec3 backBottomLeftPoint;
-		Vec3 backBottomRightPoint;
+		IVec3 backBottomLeftPoint;
+		IVec3 backBottomRightPoint;
 
-		Vec3 backTopLeftPoint;
-		Vec3 backTopRightPoint;
+		IVec3 backTopLeftPoint;
+		IVec3 backTopRightPoint;
 
-		Vec3 frontBottomLeftPoint2D;
-		Vec3 frontBottomRightPoint2D;
+		IVec3 frontBottomLeftPoint2D;
+		IVec3 frontBottomRightPoint2D;
 
-		Vec3 frontTopLeftPoint2D;
-		Vec3 frontTopRightPoint2D;
+		IVec3 frontTopLeftPoint2D;
+		IVec3 frontTopRightPoint2D;
 
-		Vec3 backBottomLeftPoint2D;
-		Vec3 backBottomRightPoint2D;
+		IVec3 backBottomLeftPoint2D;
+		IVec3 backBottomRightPoint2D;
 
-		Vec3 backTopLeftPoint2D;
-		Vec3 backTopRightPoint2D;
+		IVec3 backTopLeftPoint2D;
+		IVec3 backTopRightPoint2D;
 	};
 
-	ScenePositionsProjected calculateBoxPositions(const Vec3 &bottomLeft, const Vec3 &topRight);
+	ScenePositionsProjected calculateBoxPositions(const IVec3 &bottomLeft, const IVec3 &topRight);
 	bool drawBox(const ScenePositionsProjected &positions, uint8 color);
 public:
 	DebugScene(TwinEEngine *engine);
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index c5757c8cfb..3431734a0a 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -126,7 +126,7 @@ void Holomap::prepareHolomapSurface() {
 		int rotation = 0;
 		for (int i = 0; i <= ANGLE_11_25; ++i, rotation += ANGLE_11_25) {
 			const int32 rotX = stream.readByte();
-			const Vec3& rotVec = _engine->_renderer->getHolomapRotation(rotX, angle, rotation);
+			const IVec3& rotVec = _engine->_renderer->getHolomapRotation(rotX, angle, rotation);
 			_holomapSurface[holomapSurfaceArrayIdx].x = rotVec.x;
 			_holomapSurface[holomapSurfaceArrayIdx].y = rotVec.y;
 			_holomapSurface[holomapSurfaceArrayIdx].z = rotVec.z;
@@ -170,7 +170,7 @@ void Holomap::prepareHolomapPolygons() {
 	for (int32 angle = -ANGLE_90; angle <= ANGLE_90; angle += ANGLE_11_25) {
 		int rotation = 0;
 		for (int32 stepWidth = 0; stepWidth < ANGLE_11_25; ++stepWidth) {
-			Vec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
+			IVec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
 			_engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
 			if (angle != ANGLE_90) {
 				_holomapSort[holomapSortArrayIdx].z = _engine->_renderer->destPos.z;
@@ -183,7 +183,7 @@ void Holomap::prepareHolomapPolygons() {
 			rotation += ANGLE_11_25;
 			++_projectedSurfaceIndex;
 		}
-		Vec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
+		IVec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
 		_engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
 		_engine->_renderer->projectXYPositionOnScreen(_engine->_renderer->destPos);
 		_projectedSurfacePositions[_projectedSurfaceIndex].x = _engine->_renderer->projPos.x;
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 4f51d76379..3abbb37390 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -45,7 +45,7 @@ private:
 	bool isTriangleVisible(const Vertex *vertices) const;
 
 	struct Location {
-		Vec3 angle;
+		IVec3 angle;
 		uint16 textIndex = 0;
 		char name[30] = "";
 	};
@@ -62,7 +62,7 @@ private:
 		HamalayiTransporter = 47
 	};
 
-	Vec3 _holomapSurface[561];
+	IVec3 _holomapSurface[561];
 
 	// original game size: 2244 (lba1)
 	struct HolomapSort {
@@ -84,7 +84,7 @@ private:
 		int16 locationIdx = -1;
 		int16 trajLocationIdx = -1;
 		int16 vehicleIdx = -1;
-		Vec3 pos;
+		IVec3 pos;
 		int16 numAnimFrames = 0;
 		struct TrajectoryPos {
 			int16 x = 0;
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 1cd1ce8828..4752641bad 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -211,7 +211,7 @@ void Renderer::setCameraAngle(int32 transPosX, int32 transPosY, int32 transPosZ,
 	baseTransPos = destPos;
 }
 
-Vec3 Renderer::getHolomapRotation(const int32 angleX, const int32 angleY, const int32 angleZ) const {
+IVec3 Renderer::getHolomapRotation(const int32 angleX, const int32 angleY, const int32 angleZ) const {
 	int32 rotX;
 	int32 rotY;
 	int32 rotZ;
@@ -238,7 +238,7 @@ Vec3 Renderer::getHolomapRotation(const int32 angleX, const int32 angleY, const
 	const int32 row3X = baseMatrix.row3[0] * rotX;
 	const int32 row3Y = baseMatrix.row3[1] * rotY;
 	const int32 row3Z = baseMatrix.row3[2] * rotZ;
-	Vec3 vec;
+	IVec3 vec;
 	vec.x = (row1X + row1Y + row1Z) / SCENE_SIZE_HALF;
 	vec.y = (row2X + row2Y + row2Z) / SCENE_SIZE_HALF;
 	vec.z = (row3X + row3Y + row3Z) / SCENE_SIZE_HALF;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 5bae463f7f..efa9138319 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -66,7 +66,7 @@ struct Matrix {
 	int32 row3[3]{0, 0, 0};
 };
 
-inline Matrix operator*(const Matrix &matrix, const Vec3 &vec) {
+inline Matrix operator*(const Matrix &matrix, const IVec3 &vec) {
 	Matrix out;
 	out.row1[0] = matrix.row1[0] * vec.x;
 	out.row1[1] = matrix.row1[1] * vec.x;
@@ -330,7 +330,7 @@ private:
 
 	// ---- variables ----
 
-	Vec3 baseTransPos;
+	IVec3 baseTransPos;
 
 	int32 cameraDepthOffset = 0; // cameraVar1
 	int32 cameraScaleY = 0; // cameraVar2
@@ -342,14 +342,14 @@ private:
 	int32 renderAngleY = 0; // _angleY
 	int32 renderAngleZ = 0; // _angleZ
 
-	Vec3 renderPos;
+	IVec3 renderPos;
 
 	// ---
 
 	Matrix baseMatrix;
 	Matrix matricesTable[30 + 1];
 	Matrix shadeMatrix;
-	Vec3 lightPos;
+	IVec3 lightPos;
 
 	RenderCommand _renderCmds[1000];
 	uint8 renderCoordinatesBuffer[10000]{0};
@@ -398,12 +398,12 @@ public:
 
 	void init(int32 w, int32 h);
 
-	Vec3 projPosScreen;
-	Vec3 projPos;
-	Vec3 baseRotPos;
-	Vec3 orthoProjPos;
-	Vec3 destPos;
-	Vec3 getHolomapRotation(const int32 angleX, const int32 angleY, const int32 angleZ) const;
+	IVec3 projPosScreen;
+	IVec3 projPos;
+	IVec3 baseRotPos;
+	IVec3 orthoProjPos;
+	IVec3 destPos;
+	IVec3 getHolomapRotation(const int32 angleX, const int32 angleY, const int32 angleZ) const;
 
 	void setLightVector(int32 angleX, int32 angleY, int32 angleZ);
 	void getBaseRotationPosition(int32 x, int32 y, int32 z);
@@ -411,13 +411,13 @@ public:
 	static void prepareIsoModel(uint8 *bodyPtr);
 	void renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices);
 
-	inline int32 projectPositionOnScreen(const Vec3& pos) {
+	inline int32 projectPositionOnScreen(const IVec3& pos) {
 		return projectPositionOnScreen(pos.x, pos.y, pos.z);
 	}
 
 	int32 projectPositionOnScreen(int32 cX, int32 cY, int32 cZ);
 
-	inline void projectXYPositionOnScreen(const Vec3& pos) {
+	inline void projectXYPositionOnScreen(const IVec3& pos) {
 		projectXYPositionOnScreen(pos.x, pos.y, pos.z);
 	}
 	void projectXYPositionOnScreen(int32 x,int32 y,int32 z);
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index d4a86e9fd6..6d73e91e5b 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -247,8 +247,8 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 		localActor->entity = -1;
 
 		BoundingBox &bbox = localActor->boudingBox;
-		bbox.mins = Vec3();
-		bbox.maxs = Vec3();
+		bbox.mins = IVec3();
+		bbox.maxs = IVec3();
 		debug("Failed to initialize body %i for actor %i", (int)bodyIdx, actorIdx);
 		return;
 	}
@@ -346,8 +346,8 @@ void Actor::resetActor(int16 actorIdx) {
 	actor->pos.z = 0;
 
 	BoundingBox &bbox = actor->boudingBox;
-	bbox.mins = Vec3();
-	bbox.maxs = Vec3();
+	bbox.mins = IVec3();
+	bbox.maxs = IVec3();
 
 	actor->angle = 0;
 	actor->speed = 40;
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 5e44c809c1..4c19fc0079 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -186,7 +186,7 @@ public:
 	bool isJumpAnimationActive() const;
 
 	int16 actorIdx = 0; // own actor index
-	Vec3 pos;
+	IVec3 pos;
 	int32 strengthOfHit = 0; // field_66
 	int32 hitBy = 0;
 	BonusParameter bonusParameter; // field_10
@@ -208,7 +208,7 @@ public:
 
 	void setLife(int32 val);
 
-	Vec3 collisionPos;
+	IVec3 collisionPos;
 
 	int32 positionInMoveScript = 0;
 	uint8 *moveScript = nullptr;
@@ -228,7 +228,7 @@ public:
 	int32 zone = 0;
 
 	int32 lastRotationAngle = ANGLE_0;
-	Vec3 lastPos;
+	IVec3 lastPos;
 	int32 previousAnimIdx = 0;
 	int32 doorStatus = 0;
 	int32 animPosition = 0;
@@ -291,7 +291,7 @@ public:
 	ActorStruct *processActorPtr = nullptr;
 
 	/** Actor shadow coordinate */
-	Vec3 shadowCoord;
+	IVec3 shadowCoord;
 	/** Actor shadow collition type - brick shape */
 	ShapeType shadowCollisionType = ShapeType::kNone;
 
diff --git a/engines/twine/scene/collision.h b/engines/twine/scene/collision.h
index b1e3b4e84e..87004e28bc 100644
--- a/engines/twine/scene/collision.h
+++ b/engines/twine/scene/collision.h
@@ -37,10 +37,10 @@ private:
 public:
 	Collision(TwinEEngine *engine);
 	/** Actor collision coordinate */
-	Vec3 collision;
+	IVec3 collision;
 
 	/** Actor collision coordinate */
-	Vec3 processCollision;
+	IVec3 processCollision;
 
 	/** Cause damage in current processed actor */
 	int32 causeActorDamage = 0; //fieldCauseDamage
diff --git a/engines/twine/scene/extra.h b/engines/twine/scene/extra.h
index a350e68f57..f412121de7 100644
--- a/engines/twine/scene/extra.h
+++ b/engines/twine/scene/extra.h
@@ -53,9 +53,9 @@ enum ExtraType {
 
 struct ExtraListStruct {
 	int16 info0 = 0; /**< a value of -1 indicates that this instance is free to use */
-	Vec3 pos;
-	Vec3 lastPos;
-	Vec3 destPos;
+	IVec3 pos;
+	IVec3 lastPos;
+	IVec3 destPos;
 
 	ActorMoveStruct trackActorMove;
 
diff --git a/engines/twine/scene/grid.h b/engines/twine/scene/grid.h
index 30c3342fa8..e2e544f65d 100644
--- a/engines/twine/scene/grid.h
+++ b/engines/twine/scene/grid.h
@@ -197,10 +197,10 @@ public:
 	const uint8 *getBlockBufferGround(int32 x, int32 y, int32 z, int32 &ground);
 
 	/** New grid camera x, y and z coordinates */
-	Vec3 newCamera;
+	IVec3 newCamera;
 
 	/** Current grid camera x, y and z coordinates */
-	Vec3 camera;
+	IVec3 camera;
 
 	/** Flag to know if the engine is using celling grids */
 	int16 useCellingGrid = 0; // useAnotherGrm
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 6fbd85051c..90afd9feb0 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -149,7 +149,7 @@ int32 Movements::getDistance2D(int32 x1, int32 z1, int32 x2, int32 z2) const {
 	return (int32)sqrt((float)((x2 - x1) * (x2 - x1) + (z2 - z1) * (z2 - z1)));
 }
 
-int32 Movements::getDistance2D(const Vec3 &v1, const Vec3 &v2) const {
+int32 Movements::getDistance2D(const IVec3 &v1, const IVec3 &v2) const {
 	return (int32)sqrt((float)((v2.x - v1.x) * (v2.x - v1.x) + (v2.z - v1.z) * (v2.z - v1.z)));
 }
 
@@ -157,7 +157,7 @@ int32 Movements::getDistance3D(int32 x1, int32 y1, int32 z1, int32 x2, int32 y2,
 	return (int32)sqrt((float)((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1)));
 }
 
-int32 Movements::getDistance3D(const Vec3 &v1, const Vec3 &v2) const {
+int32 Movements::getDistance3D(const IVec3 &v1, const IVec3 &v2) const {
 	return (int32)sqrt((float)((v2.x - v1.x) * (v2.x - v1.x) + (v2.y - v1.y) * (v2.y - v1.y) + (v2.z - v1.z) * (v2.z - v1.z)));
 }
 
diff --git a/engines/twine/scene/movements.h b/engines/twine/scene/movements.h
index 8004122216..3abdf234b6 100644
--- a/engines/twine/scene/movements.h
+++ b/engines/twine/scene/movements.h
@@ -128,10 +128,10 @@ public:
 	bool heroMoved = false; // twinsenMove
 
 	/** Process actor coordinate */
-	Vec3 processActor;
+	IVec3 processActor;
 
 	/** Previous process actor coordinate */
-	Vec3 previousActor;
+	IVec3 previousActor;
 
 	int32 targetActorDistance = 0; // DoTrackVar1
 
@@ -176,7 +176,7 @@ public:
 	 */
 	int32 getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2, int32 z2);
 
-	inline int32 getAngleAndSetTargetActorDistance(const Vec3& v1, const Vec3 &v2) {
+	inline int32 getAngleAndSetTargetActorDistance(const IVec3& v1, const IVec3 &v2) {
 		return getAngleAndSetTargetActorDistance(v1.x, v1.z, v2.x, v2.z);
 	}
 
@@ -196,7 +196,7 @@ public:
 	 * @param z2 Actor 2 Z coordinate
 	 */
 	int32 getDistance2D(int32 x1, int32 z1, int32 x2, int32 z2) const;
-	int32 getDistance2D(const Vec3 &v1, const Vec3 &v2) const;
+	int32 getDistance2D(const IVec3 &v1, const IVec3 &v2) const;
 
 	/**
 	 * Get distance value in 3D
@@ -208,7 +208,7 @@ public:
 	 * @param z2 Actor 2 Z coordinate
 	 */
 	int32 getDistance3D(int32 x1, int32 y1, int32 z1, int32 x2, int32 y2, int32 z2) const;
-	int32 getDistance3D(const Vec3 &v1, const Vec3 &v2) const;
+	int32 getDistance3D(const IVec3 &v1, const IVec3 &v2) const;
 
 	/**
 	 * Move actor around the scene
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index f78b33177f..aee754c6e9 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -262,7 +262,7 @@ bool Scene::loadSceneLBA2() {
 
 	sceneNumTracks = stream.readUint16LE();
 	for (int32 i = 0; i < sceneNumTracks; i++) {
-		Vec3 *point = &sceneTracks[i];
+		IVec3 *point = &sceneTracks[i];
 		point->x = stream.readSint32LE();
 		point->y = stream.readSint32LE();
 		point->z = stream.readSint32LE();
@@ -387,7 +387,7 @@ bool Scene::loadSceneLBA1() {
 
 	sceneNumTracks = stream.readUint16LE();
 	for (int32 i = 0; i < sceneNumTracks; i++) {
-		Vec3 *point = &sceneTracks[i];
+		IVec3 *point = &sceneTracks[i];
 		point->x = stream.readUint16LE();
 		point->y = stream.readUint16LE();
 		point->z = stream.readUint16LE();
diff --git a/engines/twine/scene/scene.h b/engines/twine/scene/scene.h
index ba4dfd8e55..42055690c3 100644
--- a/engines/twine/scene/scene.h
+++ b/engines/twine/scene/scene.h
@@ -49,8 +49,8 @@ enum class ScenePositionType {
  * Special actions, like change scene, climbing a ladder, ...
  */
 struct ZoneStruct {
-	Vec3 mins;
-	Vec3 maxs;
+	IVec3 mins;
+	IVec3 maxs;
 	int16 type = 0;
 	int16 snap = 0;
 	union {
@@ -293,8 +293,8 @@ private:
 
 	int16 _sceneMusic = 0;
 
-	Vec3 _sceneHeroPos;
-	Vec3 _zoneHeroPos;
+	IVec3 _sceneHeroPos;
+	IVec3 _zoneHeroPos;
 
 	int32 _currentGameOverScene = 0;
 
@@ -317,7 +317,7 @@ public:
 	int32 alphaLight = ANGLE_0;
 	int32 betaLight = ANGLE_0;
 
-	Vec3 newHeroPos;
+	IVec3 newHeroPos;
 
 	/** Hero Y coordinate before fall */
 	int16 heroYBeforeFall = 0;
@@ -345,7 +345,7 @@ public:
 	// TRACKS Tell the actor where to go
 
 	int32 sceneNumTracks = 0;
-	Vec3 sceneTracks[NUM_MAX_TRACKS];
+	IVec3 sceneTracks[NUM_MAX_TRACKS];
 
 	bool enableGridTileRendering = true;
 
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 516c19beec..f3736462b4 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1115,7 +1115,7 @@ static int32 lZOOM(TwinEEngine *engine, LifeScriptContext &ctx) {
 static int32 lPOS_POINT(TwinEEngine *engine, LifeScriptContext &ctx) {
 	int32 trackIdx = ctx.stream.readByte();
 
-	const Vec3 &sp = engine->_scene->sceneTracks[trackIdx];
+	const IVec3 &sp = engine->_scene->sceneTracks[trackIdx];
 	engine->_renderer->destPos.x = sp.x;
 	engine->_renderer->destPos.y = sp.y;
 	engine->_renderer->destPos.z = sp.z;
diff --git a/engines/twine/script/script_move_v1.cpp b/engines/twine/script/script_move_v1.cpp
index 44d3baaced..32197a8290 100644
--- a/engines/twine/script/script_move_v1.cpp
+++ b/engines/twine/script/script_move_v1.cpp
@@ -116,7 +116,7 @@ static int32 mANIM(TwinEEngine *engine, MoveScriptContext &ctx) {
 static int32 mGOTO_POINT(TwinEEngine *engine, MoveScriptContext &ctx) {
 	engine->_scene->currentScriptValue = ctx.stream.readByte();
 
-	const Vec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
+	const IVec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
 	engine->_renderer->destPos.x = sp.x;
 	engine->_renderer->destPos.y = sp.y;
 	engine->_renderer->destPos.z = sp.z;
@@ -188,7 +188,7 @@ static int32 mANGLE(TwinEEngine *engine, MoveScriptContext &ctx) {
 static int32 mPOS_POINT(TwinEEngine *engine, MoveScriptContext &ctx) {
 	engine->_scene->currentScriptValue = ctx.stream.readByte();
 
-	const Vec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
+	const IVec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
 	engine->_renderer->destPos.x = sp.x;
 	engine->_renderer->destPos.y = sp.y;
 	engine->_renderer->destPos.z = sp.z;
@@ -248,7 +248,7 @@ static int32 mSTOP(TwinEEngine *engine, MoveScriptContext &ctx) {
 static int32 mGOTO_SYM_POINT(TwinEEngine *engine, MoveScriptContext &ctx) {
 	engine->_scene->currentScriptValue = ctx.stream.readByte();
 
-	const Vec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
+	const IVec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
 	engine->_renderer->destPos.x = sp.x;
 	engine->_renderer->destPos.y = sp.y;
 	engine->_renderer->destPos.z = sp.z;
@@ -321,7 +321,7 @@ static int32 mGOTO_POINT_3D(TwinEEngine *engine, MoveScriptContext &ctx) {
 
 	engine->_scene->currentScriptValue = trackId;
 
-	const Vec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
+	const IVec3 &sp = engine->_scene->sceneTracks[engine->_scene->currentScriptValue];
 	engine->_renderer->destPos.x = sp.x;
 	engine->_renderer->destPos.y = sp.y;
 	engine->_renderer->destPos.z = sp.z;
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 8857c72c1a..d3ae0ac923 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -74,21 +74,21 @@
 
 namespace TwinE {
 
-struct Vec3 {
-	Vec3() : x(0), y(0), z(0) {}
-	Vec3(int32 _x, int32 _y, int32 _z) : x(_x), y(_y), z(_z) {}
+struct IVec3 {
+	IVec3() : x(0), y(0), z(0) {}
+	IVec3(int32 _x, int32 _y, int32 _z) : x(_x), y(_y), z(_z) {}
 	int32 x;
 	int32 y;
 	int32 z;
 
-	inline Vec3& operator+=(const Vec3 &other) {
+	inline IVec3& operator+=(const IVec3 &other) {
 		x += other.x;
 		y += other.y;
 		z += other.z;
 		return *this;
 	}
 
-	inline Vec3& operator-=(const Vec3 &other) {
+	inline IVec3& operator-=(const IVec3 &other) {
 		x -= other.x;
 		y -= other.y;
 		z -= other.z;
@@ -96,17 +96,17 @@ struct Vec3 {
 	}
 };
 
-inline Vec3 operator+(const Vec3 &lhs, const Vec3 &rhs) {
-	return Vec3{lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z};
+inline IVec3 operator+(const IVec3 &lhs, const IVec3 &rhs) {
+	return IVec3{lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z};
 }
 
-inline Vec3 operator-(const Vec3 &lhs, const Vec3 &rhs) {
-	return Vec3{lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z};
+inline IVec3 operator-(const IVec3 &lhs, const IVec3 &rhs) {
+	return IVec3{lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z};
 }
 
 struct BoundingBox {
-	Vec3 mins;
-	Vec3 maxs;
+	IVec3 mins;
+	IVec3 maxs;
 };
 
 struct ActorBoundingBox {


Commit: 8769c1cf0a584469f633ac2b714bf136f6d09558
    https://github.com/scummvm/scummvm/commit/8769c1cf0a584469f633ac2b714bf136f6d09558
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: renamed parameter

Changed paths:
    engines/twine/debugger/debug_scene.cpp
    engines/twine/debugger/debug_scene.h


diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index 9654832178..df04e1adf2 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -102,40 +102,40 @@ int32 DebugScene::checkZoneType(int32 type) const {
 	return 0;
 }
 
-DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec3 &bottomLeft, const IVec3 &topRight) {
+DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec3 &mins, const IVec3 &maxs) {
 	ScenePositionsProjected positions;
 	// compute the points in 3D
-	positions.frontBottomLeftPoint.x = bottomLeft.x - _engine->_grid->camera.x;
-	positions.frontBottomLeftPoint.y = bottomLeft.y - _engine->_grid->camera.y;
-	positions.frontBottomLeftPoint.z = topRight.z - _engine->_grid->camera.z;
+	positions.frontBottomLeftPoint.x = mins.x - _engine->_grid->camera.x;
+	positions.frontBottomLeftPoint.y = mins.y - _engine->_grid->camera.y;
+	positions.frontBottomLeftPoint.z = maxs.z - _engine->_grid->camera.z;
 
-	positions.frontBottomRightPoint.x = topRight.x - _engine->_grid->camera.x;
-	positions.frontBottomRightPoint.y = bottomLeft.y - _engine->_grid->camera.y;
-	positions.frontBottomRightPoint.z = topRight.z - _engine->_grid->camera.z;
+	positions.frontBottomRightPoint.x = maxs.x - _engine->_grid->camera.x;
+	positions.frontBottomRightPoint.y = mins.y - _engine->_grid->camera.y;
+	positions.frontBottomRightPoint.z = maxs.z - _engine->_grid->camera.z;
 
-	positions.frontTopLeftPoint.x = bottomLeft.x - _engine->_grid->camera.x;
-	positions.frontTopLeftPoint.y = topRight.y - _engine->_grid->camera.y;
-	positions.frontTopLeftPoint.z = topRight.z - _engine->_grid->camera.z;
+	positions.frontTopLeftPoint.x = mins.x - _engine->_grid->camera.x;
+	positions.frontTopLeftPoint.y = maxs.y - _engine->_grid->camera.y;
+	positions.frontTopLeftPoint.z = maxs.z - _engine->_grid->camera.z;
 
-	positions.frontTopRightPoint.x = topRight.x - _engine->_grid->camera.x;
-	positions.frontTopRightPoint.y = topRight.y - _engine->_grid->camera.y;
-	positions.frontTopRightPoint.z = topRight.z - _engine->_grid->camera.z;
+	positions.frontTopRightPoint.x = maxs.x - _engine->_grid->camera.x;
+	positions.frontTopRightPoint.y = maxs.y - _engine->_grid->camera.y;
+	positions.frontTopRightPoint.z = maxs.z - _engine->_grid->camera.z;
 
-	positions.backBottomLeftPoint.x = bottomLeft.x - _engine->_grid->camera.x;
-	positions.backBottomLeftPoint.y = bottomLeft.y - _engine->_grid->camera.y;
-	positions.backBottomLeftPoint.z = bottomLeft.z - _engine->_grid->camera.z;
+	positions.backBottomLeftPoint.x = mins.x - _engine->_grid->camera.x;
+	positions.backBottomLeftPoint.y = mins.y - _engine->_grid->camera.y;
+	positions.backBottomLeftPoint.z = mins.z - _engine->_grid->camera.z;
 
-	positions.backBottomRightPoint.x = topRight.x - _engine->_grid->camera.x;
-	positions.backBottomRightPoint.y = bottomLeft.y - _engine->_grid->camera.y;
-	positions.backBottomRightPoint.z = bottomLeft.z - _engine->_grid->camera.z;
+	positions.backBottomRightPoint.x = maxs.x - _engine->_grid->camera.x;
+	positions.backBottomRightPoint.y = mins.y - _engine->_grid->camera.y;
+	positions.backBottomRightPoint.z = mins.z - _engine->_grid->camera.z;
 
-	positions.backTopLeftPoint.x = bottomLeft.x - _engine->_grid->camera.x;
-	positions.backTopLeftPoint.y = topRight.y - _engine->_grid->camera.y;
-	positions.backTopLeftPoint.z = bottomLeft.z - _engine->_grid->camera.z;
+	positions.backTopLeftPoint.x = mins.x - _engine->_grid->camera.x;
+	positions.backTopLeftPoint.y = maxs.y - _engine->_grid->camera.y;
+	positions.backTopLeftPoint.z = mins.z - _engine->_grid->camera.z;
 
-	positions.backTopRightPoint.x = topRight.x - _engine->_grid->camera.x;
-	positions.backTopRightPoint.y = topRight.y - _engine->_grid->camera.y;
-	positions.backTopRightPoint.z = bottomLeft.z - _engine->_grid->camera.z;
+	positions.backTopRightPoint.x = maxs.x - _engine->_grid->camera.x;
+	positions.backTopRightPoint.y = maxs.y - _engine->_grid->camera.y;
+	positions.backTopRightPoint.z = mins.z - _engine->_grid->camera.z;
 
 	// project all points
 
diff --git a/engines/twine/debugger/debug_scene.h b/engines/twine/debugger/debug_scene.h
index ca30e43982..18e5db810d 100644
--- a/engines/twine/debugger/debug_scene.h
+++ b/engines/twine/debugger/debug_scene.h
@@ -67,7 +67,7 @@ private:
 		IVec3 backTopRightPoint2D;
 	};
 
-	ScenePositionsProjected calculateBoxPositions(const IVec3 &bottomLeft, const IVec3 &topRight);
+	ScenePositionsProjected calculateBoxPositions(const IVec3 &mins, const IVec3 &maxs);
 	bool drawBox(const ScenePositionsProjected &positions, uint8 color);
 public:
 	DebugScene(TwinEEngine *engine);


Commit: 3b6bad320c3e7e420909ca5822ea968873f105c7
    https://github.com/scummvm/scummvm/commit/3b6bad320c3e7e420909ca5822ea968873f105c7
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:03+01:00

Commit Message:
TWINE: renamed method

Changed paths:
    engines/twine/debugger/debug_scene.cpp
    engines/twine/debugger/debug_scene.h


diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index df04e1adf2..2ca8077fd9 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -41,7 +41,7 @@ void DebugScene::drawClip(const Common::Rect &rect) {
 	_engine->_menu->drawBox(rect);
 }
 
-void DebugScene::drawBoundingBoxProjectPoints(IVec3 *pPoint3d, IVec3 *pPoint3dProjected) {
+void DebugScene::projectBoundingBoxPoints(IVec3 *pPoint3d, IVec3 *pPoint3dProjected) {
 	_engine->_renderer->projectPositionOnScreen(pPoint3d->x, pPoint3d->y, pPoint3d->z);
 
 	pPoint3dProjected->x = _engine->_renderer->projPos.x;
@@ -139,14 +139,14 @@ DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec
 
 	// project all points
 
-	drawBoundingBoxProjectPoints(&positions.frontBottomLeftPoint, &positions.frontBottomLeftPoint2D);
-	drawBoundingBoxProjectPoints(&positions.frontBottomRightPoint, &positions.frontBottomRightPoint2D);
-	drawBoundingBoxProjectPoints(&positions.frontTopLeftPoint, &positions.frontTopLeftPoint2D);
-	drawBoundingBoxProjectPoints(&positions.frontTopRightPoint, &positions.frontTopRightPoint2D);
-	drawBoundingBoxProjectPoints(&positions.backBottomLeftPoint, &positions.backBottomLeftPoint2D);
-	drawBoundingBoxProjectPoints(&positions.backBottomRightPoint, &positions.backBottomRightPoint2D);
-	drawBoundingBoxProjectPoints(&positions.backTopLeftPoint, &positions.backTopLeftPoint2D);
-	drawBoundingBoxProjectPoints(&positions.backTopRightPoint, &positions.backTopRightPoint2D);
+	projectBoundingBoxPoints(&positions.frontBottomLeftPoint, &positions.frontBottomLeftPoint2D);
+	projectBoundingBoxPoints(&positions.frontBottomRightPoint, &positions.frontBottomRightPoint2D);
+	projectBoundingBoxPoints(&positions.frontTopLeftPoint, &positions.frontTopLeftPoint2D);
+	projectBoundingBoxPoints(&positions.frontTopRightPoint, &positions.frontTopRightPoint2D);
+	projectBoundingBoxPoints(&positions.backBottomLeftPoint, &positions.backBottomLeftPoint2D);
+	projectBoundingBoxPoints(&positions.backBottomRightPoint, &positions.backBottomRightPoint2D);
+	projectBoundingBoxPoints(&positions.backTopLeftPoint, &positions.backTopLeftPoint2D);
+	projectBoundingBoxPoints(&positions.backTopRightPoint, &positions.backTopRightPoint2D);
 
 	return positions;
 }
diff --git a/engines/twine/debugger/debug_scene.h b/engines/twine/debugger/debug_scene.h
index 18e5db810d..aacf53461e 100644
--- a/engines/twine/debugger/debug_scene.h
+++ b/engines/twine/debugger/debug_scene.h
@@ -35,7 +35,7 @@ class DebugScene {
 private:
 	TwinEEngine *_engine;
 
-	void drawBoundingBoxProjectPoints(IVec3 *point3d, IVec3 *point3dProjected);
+	void projectBoundingBoxPoints(IVec3 *point3d, IVec3 *point3dProjected);
 	int32 checkZoneType(int32 type) const;
 	bool displayZones();
 	bool displayActors();


Commit: 4726df938c4fdbf01a352da300c3149a54c60f42
    https://github.com/scummvm/scummvm/commit/4726df938c4fdbf01a352da300c3149a54c60f42
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: minor cleanup

Changed paths:
    engines/twine/debugger/debug_scene.cpp
    engines/twine/debugger/debug_scene.h


diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index 2ca8077fd9..b21394fcd2 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -65,41 +65,27 @@ void DebugScene::projectBoundingBoxPoints(IVec3 *pPoint3d, IVec3 *pPoint3dProjec
 	}
 }
 
-int32 DebugScene::checkZoneType(int32 type) const {
+bool DebugScene::checkZoneType(int32 type) const {
 	switch (type) {
 	case ZoneType::kCube:
-		if (typeZones & 0x01)
-			return 1;
-		break;
+		return (typeZones & 0x01) != 0;
 	case ZoneType::kCamera:
-		if (typeZones & 0x02)
-			return 1;
-		break;
+		return (typeZones & 0x02) != 0;
 	case ZoneType::kSceneric:
-		if (typeZones & 0x04)
-			return 1;
-		break;
+		return (typeZones & 0x04) != 0;
 	case ZoneType::kGrid:
-		if (typeZones & 0x08)
-			return 1;
-		break;
+		return (typeZones & 0x08) != 0;
 	case ZoneType::kObject:
-		if (typeZones & 0x10)
-			return 1;
-		break;
+		return (typeZones & 0x10) != 0;
 	case ZoneType::kText:
-		if (typeZones & 0x20)
-			return 1;
-		break;
+		return (typeZones & 0x20) != 0;
 	case ZoneType::kLadder:
-		if (typeZones & 0x40)
-			return 1;
-		break;
+		return (typeZones & 0x40) != 0;
 	default:
-		return 1;
+		return true;
 	}
 
-	return 0;
+	return false;
 }
 
 DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec3 &mins, const IVec3 &maxs) {
diff --git a/engines/twine/debugger/debug_scene.h b/engines/twine/debugger/debug_scene.h
index aacf53461e..6ca455ee3e 100644
--- a/engines/twine/debugger/debug_scene.h
+++ b/engines/twine/debugger/debug_scene.h
@@ -36,7 +36,7 @@ private:
 	TwinEEngine *_engine;
 
 	void projectBoundingBoxPoints(IVec3 *point3d, IVec3 *point3dProjected);
-	int32 checkZoneType(int32 type) const;
+	bool checkZoneType(int32 type) const;
 	bool displayZones();
 	bool displayActors();
 	bool displayTracks();


Commit: 8b909d0ebc4f769dcb8820afe5f05195681e7374
    https://github.com/scummvm/scummvm/commit/8b909d0ebc4f769dcb8820afe5f05195681e7374
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: moved enums into shared.h

Changed paths:
    engines/twine/debugger/debug_scene.cpp
    engines/twine/debugger/debug_scene.h
    engines/twine/scene/scene.cpp
    engines/twine/scene/scene.h
    engines/twine/shared.h


diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index b21394fcd2..2034b3f567 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -65,7 +65,7 @@ void DebugScene::projectBoundingBoxPoints(IVec3 *pPoint3d, IVec3 *pPoint3dProjec
 	}
 }
 
-bool DebugScene::checkZoneType(int32 type) const {
+bool DebugScene::checkZoneType(ZoneType type) const {
 	switch (type) {
 	case ZoneType::kCube:
 		return (typeZones & 0x01) != 0;
diff --git a/engines/twine/debugger/debug_scene.h b/engines/twine/debugger/debug_scene.h
index 6ca455ee3e..4a78a476b1 100644
--- a/engines/twine/debugger/debug_scene.h
+++ b/engines/twine/debugger/debug_scene.h
@@ -36,7 +36,7 @@ private:
 	TwinEEngine *_engine;
 
 	void projectBoundingBoxPoints(IVec3 *point3d, IVec3 *point3dProjected);
-	bool checkZoneType(int32 type) const;
+	bool checkZoneType(ZoneType type) const;
 	bool displayZones();
 	bool displayActors();
 	bool displayTracks();
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index aee754c6e9..2174590c15 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -256,7 +256,7 @@ bool Scene::loadSceneLBA2() {
 		zone->infoData.generic.info6 = stream.readSint32LE();
 		zone->infoData.generic.info7 = stream.readSint32LE();
 
-		zone->type = stream.readUint16LE();
+		zone->type = (ZoneType)stream.readUint16LE();
 		zone->snap = stream.readUint16LE();
 	}
 
@@ -375,7 +375,7 @@ bool Scene::loadSceneLBA1() {
 		zone->maxs.y = stream.readUint16LE();
 		zone->maxs.z = stream.readUint16LE();
 
-		zone->type = stream.readUint16LE();
+		zone->type = (ZoneType)stream.readUint16LE();
 
 		zone->infoData.generic.info0 = stream.readUint16LE();
 		zone->infoData.generic.info1 = stream.readUint16LE();
@@ -401,6 +401,7 @@ bool Scene::loadSceneLBA1() {
 			_sceneActors[21].pos.x = _sceneActors[21].collisionPos.x = 0x1b00;
 			_sceneActors[21].pos.z = _sceneActors[21].collisionPos.z = 0x300;
 			break;
+#if 0
 		case LBA1SceneId::Principal_Island_outside_the_fortress:
 			assert(sceneNumActors >= 30);
 			_sceneActors[29].pos.z = _sceneActors[29].collisionPos.z = 0x703;
@@ -426,6 +427,7 @@ bool Scene::loadSceneLBA1() {
 		case LBA1SceneId::Principal_Island_inside_the_fortress:
 			//(ushort*)puVar4[140] = 0x32;
 			break;
+#endif
 		}
 	}
 
diff --git a/engines/twine/scene/scene.h b/engines/twine/scene/scene.h
index 42055690c3..2b368b3d78 100644
--- a/engines/twine/scene/scene.h
+++ b/engines/twine/scene/scene.h
@@ -51,7 +51,7 @@ enum class ScenePositionType {
 struct ZoneStruct {
 	IVec3 mins;
 	IVec3 maxs;
-	int16 type = 0;
+	ZoneType type = ZoneType::kCube;
 	int16 snap = 0;
 	union {
 		struct {
@@ -100,141 +100,6 @@ struct ZoneStruct {
 	} infoData;
 };
 
-enum ZoneType {
-	kCube = 0,     // Change to another scene
-	kCamera = 1,   // Binds camera view
-	kSceneric = 2, // For use in Life Script
-	kGrid = 3,     // Set disappearing Grid fragment
-	kObject = 4,   // Give bonus
-	kText = 5,     // Displays text message
-	kLadder = 6    // Hero can climb on it
-};
-
-enum LBA1SceneId {
-	Citadel_Island_Prison = 0,
-	Citadel_Island_outside_the_citadel = 1,
-	Citadel_Island_near_the_tavern = 2,
-	Citadel_Island_near_the_pharmacy = 3,
-	Citadel_Island_near_twinsens_house = 4,
-	Citadel_Island_inside_Twinsens_house = 5,
-	Citadel_Island_Harbor = 6,
-	Citadel_Island_Pharmacy = 7,
-	White_Leaf_Desert_Temple_of_Bu_1st_scene = 8,
-	Hamalayi_Mountains_landing_place = 9,
-	Principal_Island_Library = 10,
-	Principal_Island_Harbor = 11,
-	Principal_Island_outside_the_fortress = 12,
-	Principal_Island_Old_Burg = 13,
-	Citadel_Island_Tavern = 14,
-	Hamalayi_Mountains_Rabbibunny_village = 15,
-	Citadel_Island_inside_a_Rabbibunny_house = 16,
-	Principal_Island_Ruins = 17,
-	Principal_Island_outside_the_library = 18,
-	Principal_Island_Militairy_camp = 19,
-	Citadel_Island_Architects_house = 20,
-	Citadel_Island_secret_chamber_in_the_house = 21,
-	Principal_Island_Ticket_office = 22,
-	Principal_Island_Prison = 23,
-	Principal_Island_Port_Belooga = 24,
-	Principal_Island_Peg_Leg_Street = 25,
-	Principal_Island_Shop = 26,
-	Principal_Island_Locksmith = 27,
-	Principal_Island_inside_a_Rabbibunny_house = 28,
-	Principal_Island_Astronimers_House = 29,
-	Principal_Island_Tavern = 30,
-	Principal_Island_Basement_of_the_Astronomer = 31,
-	Principal_Island_Stables = 32,
-	Citadel_Island_Cellar_of_the_Tavern = 33,
-	Citadel_Island_Sewer_of_the_1st_scene = 34,
-	Citadel_Island_Warehouse = 35,
-	White_Leaf_Desert_outside_the_Temple_of_Bu = 36,
-	Principal_Island_outside_the_water_tower = 37,
-	Principal_Island_inside_the_water_tower = 38,
-	White_Leaf_Desert_Militairy_camp = 39,
-	White_Leaf_Desert_Temple_of_Bu_2nd_scene = 40,
-	White_Leaf_Desert_Temple_of_Bu_3rd_scene = 41,
-	Proxima_Island_Proxim_City = 42,
-	Proxima_Island_Museum = 43,
-	Proxima_Island_near_the_Inventors_house = 44,
-	Proxima_Island_upper_rune_stone = 45,
-	Proxima_Island_lower_rune_stone = 46,
-	Proxima_Island_befor_the_upper_rune_stone = 47,
-	Proxima_Island_Forgers_house = 48,
-	Proxima_Island_Prison = 49,
-	Proxima_Island_Shop = 50,
-	Proxima_Island_Sewer = 51,
-	Principal_Island_house_at_Peg_Leg_Street = 52,
-	Proxima_Island_Grobo_house = 53,
-	Proxima_Island_Inventors_house = 54,
-	Citadel_Island_Sewer_secret = 55,
-	Principal_Island_Sewer_secret = 56,
-	White_Leaf_Desert_Maze = 57,
-	Principal_Island_House_with_the_TV = 58,
-	Rebelion_Island_Harbor = 59,
-	Rebelion_Island_Rebel_camp = 60,
-	Some_room_cut_out = 61,
-	Hamalayi_Mountains_1st_fighting_scene = 62,
-	Hamalayi_Mountains_2nd_fighting_scene = 63,
-	Hamalayi_Mountains_Prison = 64,
-	Hamalayi_Mountains_outside_the_transporter = 65,
-	Hamalayi_Mountains_inside_the_transporter = 66,
-	Hamalayi_Mountains_Mutation_centre_1st_scene = 67,
-	Hamalayi_Mountains_Mutation_centre_2nd_scene = 68,
-	Hamalayi_Mountains_3rd_fighting_scene = 69,
-	Hamalayi_Mountains_Entrance_to_the_prison = 70,
-	Hamalayi_Mountains_outside_the_prison = 71,
-	Hamalayi_Mountains_Catamaran_dock = 72,
-	Hamalayi_Mountains_Bunker_near_clear_water = 73,
-	Tippet_Island_Village = 74,
-	Tippet_Island_Secret_passage_scene_2 = 75,
-	Tippet_Island_near_the_bar = 76,
-	Tippet_Island_Secret_passage_scene_1 = 77,
-	Tippet_Island_near_the_Dino_Fly = 78,
-	Tippet_Island_Secret_passage_scene_3 = 79,
-	Tippet_Island_Twinsun_Cafe = 80,
-	Hamalayi_Mountains_Sacret_Carrot = 81,
-	Hamalayi_Mountains_Backdoor_of_the_prison = 82,
-	Fortress_Island_inside_the_fortress = 83,
-	Fortress_Island_outside_the_forstress = 84,
-	Fortress_Island_Secret_passage_scene_1 = 85,
-	Fortress_Island_Secret_in_the_fortress = 86,
-	Fortress_Island_near_Zoes_cell = 87,
-	Fortress_Island_Swimming_pool = 88,
-	Fortress_Island_Cloning_centre = 89,
-	Fortress_Island_Rune_stone = 90,
-	Hamalayi_Mountains_Behind_the_sacret_carrot = 91,
-	Hamalayi_Mountains_Clear_water_lake = 92,
-	Fortress_Island_outside_fortress_destroyed = 93,
-	Brundle_Island_outside_the_teleportation = 94,
-	Brundle_Island_inside_the_teleportation = 95,
-	Hamalayi_Mountains_Ski_resort = 96,
-	Brundle_Island_Docks = 97,
-	Brundle_Island_Secret_room = 98,
-	Brundle_Island_near_the_telepods = 99,
-	Fortress_Island_Docks = 100,
-	Tippet_Island_Shop = 101,
-	Principal_Island_house_in_port_Belooga = 102,
-	Brundle_Island_Painters_house = 103,
-	Citadel_Island_Ticket_Office = 104,
-	Principal_Island_inside_the_fortress = 105,
-	Polar_Island_2nd_scene = 106,
-	Polar_Island_3rd_scene = 107,
-	Polar_Island_Before_the_rocky_peak = 108,
-	Polar_Island_4th_scene = 109,
-	Polar_Island_The_rocky_peak = 110,
-	Polar_Island_on_the_rocky_peak = 111,
-	Polar_Island_Before_the_end_room = 112,
-	Polar_Island_Final_Battle = 113,
-	Polar_Island_end_scene = 114,
-	Polar_Island_1st_scene = 115,
-	Citadel_Island_end_sequence_1 = 116,
-	Citadel_Island_end_sequence_2 = 117,
-	Citadel_Island_Twinsens_house_destroyed = 118,
-	Credits_List_Sequence = 119,
-
-	SceneIdMax = 120
-};
-
 #define OWN_ACTOR_SCENE_INDEX 0
 #define IS_HERO(x) (x) == OWN_ACTOR_SCENE_INDEX
 
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index d3ae0ac923..4a16b0fb54 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -262,6 +262,141 @@ enum class ExtraSpecialType {
 	kExplodeCloud = 1
 };
 
+enum ZoneType {
+	kCube = 0,     // Change to another scene
+	kCamera = 1,   // Binds camera view
+	kSceneric = 2, // For use in Life Script
+	kGrid = 3,     // Set disappearing Grid fragment
+	kObject = 4,   // Give bonus
+	kText = 5,     // Displays text message
+	kLadder = 6    // Hero can climb on it
+};
+
+enum LBA1SceneId {
+	Citadel_Island_Prison = 0,
+	Citadel_Island_outside_the_citadel = 1,
+	Citadel_Island_near_the_tavern = 2,
+	Citadel_Island_near_the_pharmacy = 3,
+	Citadel_Island_near_twinsens_house = 4,
+	Citadel_Island_inside_Twinsens_house = 5,
+	Citadel_Island_Harbor = 6,
+	Citadel_Island_Pharmacy = 7,
+	White_Leaf_Desert_Temple_of_Bu_1st_scene = 8,
+	Hamalayi_Mountains_landing_place = 9,
+	Principal_Island_Library = 10,
+	Principal_Island_Harbor = 11,
+	Principal_Island_outside_the_fortress = 12,
+	Principal_Island_Old_Burg = 13,
+	Citadel_Island_Tavern = 14,
+	Hamalayi_Mountains_Rabbibunny_village = 15,
+	Citadel_Island_inside_a_Rabbibunny_house = 16,
+	Principal_Island_Ruins = 17,
+	Principal_Island_outside_the_library = 18,
+	Principal_Island_Militairy_camp = 19,
+	Citadel_Island_Architects_house = 20,
+	Citadel_Island_secret_chamber_in_the_house = 21,
+	Principal_Island_Ticket_office = 22,
+	Principal_Island_Prison = 23,
+	Principal_Island_Port_Belooga = 24,
+	Principal_Island_Peg_Leg_Street = 25,
+	Principal_Island_Shop = 26,
+	Principal_Island_Locksmith = 27,
+	Principal_Island_inside_a_Rabbibunny_house = 28,
+	Principal_Island_Astronimers_House = 29,
+	Principal_Island_Tavern = 30,
+	Principal_Island_Basement_of_the_Astronomer = 31,
+	Principal_Island_Stables = 32,
+	Citadel_Island_Cellar_of_the_Tavern = 33,
+	Citadel_Island_Sewer_of_the_1st_scene = 34,
+	Citadel_Island_Warehouse = 35,
+	White_Leaf_Desert_outside_the_Temple_of_Bu = 36,
+	Principal_Island_outside_the_water_tower = 37,
+	Principal_Island_inside_the_water_tower = 38,
+	White_Leaf_Desert_Militairy_camp = 39,
+	White_Leaf_Desert_Temple_of_Bu_2nd_scene = 40,
+	White_Leaf_Desert_Temple_of_Bu_3rd_scene = 41,
+	Proxima_Island_Proxim_City = 42,
+	Proxima_Island_Museum = 43,
+	Proxima_Island_near_the_Inventors_house = 44,
+	Proxima_Island_upper_rune_stone = 45,
+	Proxima_Island_lower_rune_stone = 46,
+	Proxima_Island_befor_the_upper_rune_stone = 47,
+	Proxima_Island_Forgers_house = 48,
+	Proxima_Island_Prison = 49,
+	Proxima_Island_Shop = 50,
+	Proxima_Island_Sewer = 51,
+	Principal_Island_house_at_Peg_Leg_Street = 52,
+	Proxima_Island_Grobo_house = 53,
+	Proxima_Island_Inventors_house = 54,
+	Citadel_Island_Sewer_secret = 55,
+	Principal_Island_Sewer_secret = 56,
+	White_Leaf_Desert_Maze = 57,
+	Principal_Island_House_with_the_TV = 58,
+	Rebelion_Island_Harbor = 59,
+	Rebelion_Island_Rebel_camp = 60,
+	Some_room_cut_out = 61,
+	Hamalayi_Mountains_1st_fighting_scene = 62,
+	Hamalayi_Mountains_2nd_fighting_scene = 63,
+	Hamalayi_Mountains_Prison = 64,
+	Hamalayi_Mountains_outside_the_transporter = 65,
+	Hamalayi_Mountains_inside_the_transporter = 66,
+	Hamalayi_Mountains_Mutation_centre_1st_scene = 67,
+	Hamalayi_Mountains_Mutation_centre_2nd_scene = 68,
+	Hamalayi_Mountains_3rd_fighting_scene = 69,
+	Hamalayi_Mountains_Entrance_to_the_prison = 70,
+	Hamalayi_Mountains_outside_the_prison = 71,
+	Hamalayi_Mountains_Catamaran_dock = 72,
+	Hamalayi_Mountains_Bunker_near_clear_water = 73,
+	Tippet_Island_Village = 74,
+	Tippet_Island_Secret_passage_scene_2 = 75,
+	Tippet_Island_near_the_bar = 76,
+	Tippet_Island_Secret_passage_scene_1 = 77,
+	Tippet_Island_near_the_Dino_Fly = 78,
+	Tippet_Island_Secret_passage_scene_3 = 79,
+	Tippet_Island_Twinsun_Cafe = 80,
+	Hamalayi_Mountains_Sacret_Carrot = 81,
+	Hamalayi_Mountains_Backdoor_of_the_prison = 82,
+	Fortress_Island_inside_the_fortress = 83,
+	Fortress_Island_outside_the_forstress = 84,
+	Fortress_Island_Secret_passage_scene_1 = 85,
+	Fortress_Island_Secret_in_the_fortress = 86,
+	Fortress_Island_near_Zoes_cell = 87,
+	Fortress_Island_Swimming_pool = 88,
+	Fortress_Island_Cloning_centre = 89,
+	Fortress_Island_Rune_stone = 90,
+	Hamalayi_Mountains_Behind_the_sacret_carrot = 91,
+	Hamalayi_Mountains_Clear_water_lake = 92,
+	Fortress_Island_outside_fortress_destroyed = 93,
+	Brundle_Island_outside_the_teleportation = 94,
+	Brundle_Island_inside_the_teleportation = 95,
+	Hamalayi_Mountains_Ski_resort = 96,
+	Brundle_Island_Docks = 97,
+	Brundle_Island_Secret_room = 98,
+	Brundle_Island_near_the_telepods = 99,
+	Fortress_Island_Docks = 100,
+	Tippet_Island_Shop = 101,
+	Principal_Island_house_in_port_Belooga = 102,
+	Brundle_Island_Painters_house = 103,
+	Citadel_Island_Ticket_Office = 104,
+	Principal_Island_inside_the_fortress = 105,
+	Polar_Island_2nd_scene = 106,
+	Polar_Island_3rd_scene = 107,
+	Polar_Island_Before_the_rocky_peak = 108,
+	Polar_Island_4th_scene = 109,
+	Polar_Island_The_rocky_peak = 110,
+	Polar_Island_on_the_rocky_peak = 111,
+	Polar_Island_Before_the_end_room = 112,
+	Polar_Island_Final_Battle = 113,
+	Polar_Island_end_scene = 114,
+	Polar_Island_1st_scene = 115,
+	Citadel_Island_end_sequence_1 = 116,
+	Citadel_Island_end_sequence_2 = 117,
+	Citadel_Island_Twinsens_house_destroyed = 118,
+	Credits_List_Sequence = 119,
+
+	SceneIdMax = 120
+};
+
 // lba2 does from 0 to 0x1000
 // lba1 angles
 // TODO: wrap in a class to be able to handle lba1 and lba2


Commit: f2e69b3f9c27d2748f6e2354b94df2bfe94e128a
    https://github.com/scummvm/scummvm/commit/f2e69b3f9c27d2748f6e2354b94df2bfe94e128a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: converted to enum class

Changed paths:
    engines/twine/debugger/debug_scene.cpp
    engines/twine/shared.h


diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index 2034b3f567..d0dc41b38a 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -103,13 +103,8 @@ DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec
 	positions.frontTopLeftPoint.y = maxs.y - _engine->_grid->camera.y;
 	positions.frontTopLeftPoint.z = maxs.z - _engine->_grid->camera.z;
 
-	positions.frontTopRightPoint.x = maxs.x - _engine->_grid->camera.x;
-	positions.frontTopRightPoint.y = maxs.y - _engine->_grid->camera.y;
-	positions.frontTopRightPoint.z = maxs.z - _engine->_grid->camera.z;
-
-	positions.backBottomLeftPoint.x = mins.x - _engine->_grid->camera.x;
-	positions.backBottomLeftPoint.y = mins.y - _engine->_grid->camera.y;
-	positions.backBottomLeftPoint.z = mins.z - _engine->_grid->camera.z;
+	positions.frontTopRightPoint = maxs - _engine->_grid->camera;
+	positions.backBottomLeftPoint = mins - _engine->_grid->camera;
 
 	positions.backBottomRightPoint.x = maxs.x - _engine->_grid->camera.x;
 	positions.backBottomRightPoint.y = mins.y - _engine->_grid->camera.y;
@@ -214,7 +209,7 @@ bool DebugScene::displayZones() {
 		}
 
 		const ScenePositionsProjected &positions = calculateBoxPositions(zonePtr->mins, zonePtr->maxs);
-		const uint8 color = 15 * 3 + zonePtr->type * 16;
+		const uint8 color = 15 * 3 + (int)zonePtr->type * 16;
 		if (!drawBox(positions, color)) {
 			continue;
 		}
@@ -225,7 +220,7 @@ bool DebugScene::displayZones() {
 		const Common::Rect filledRect(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, positions.frontTopRightPoint2D.x + boxwidth, positions.frontTopRightPoint2D.y + boxheight);
 		_engine->_interface->drawFilledRect(filledRect, COLOR_WHITE);
 		_engine->_menu->drawBox(filledRect);
-		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, Common::String::format("Type: %i (%i)", zonePtr->type, i), true, false, boxwidth);
+		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, Common::String::format("Type: %i (%i)", (int)zonePtr->type, i), true, false, boxwidth);
 		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y + lineHeight, Common::String::format("pos: %i:%i:%i", positions.frontTopRightPoint.x, positions.frontTopRightPoint.y, positions.frontTopRightPoint.z), true, false, boxwidth);
 		state = true;
 	}
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 4a16b0fb54..14f9ab9eda 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -104,6 +104,9 @@ inline IVec3 operator-(const IVec3 &lhs, const IVec3 &rhs) {
 	return IVec3{lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z};
 }
 
+/**
+ * @brief Axis aligned bounding box
+ */
 struct BoundingBox {
 	IVec3 mins;
 	IVec3 maxs;
@@ -262,7 +265,7 @@ enum class ExtraSpecialType {
 	kExplodeCloud = 1
 };
 
-enum ZoneType {
+enum class ZoneType {
 	kCube = 0,     // Change to another scene
 	kCamera = 1,   // Binds camera view
 	kSceneric = 2, // For use in Life Script


Commit: d0cff45a9377f6caab088069beb75cd81a5dcb03
    https://github.com/scummvm/scummvm/commit/d0cff45a9377f6caab088069beb75cd81a5dcb03
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: renamed ActorBoundingBox members

Changed paths:
    engines/twine/parser/entity.cpp
    engines/twine/scene/actor.cpp
    engines/twine/shared.h


diff --git a/engines/twine/parser/entity.cpp b/engines/twine/parser/entity.cpp
index 7db28cae35..e9880f2a9f 100644
--- a/engines/twine/parser/entity.cpp
+++ b/engines/twine/parser/entity.cpp
@@ -34,12 +34,12 @@ bool EntityData::loadBody(Common::SeekableReadStream &stream) {
 	body.actorBoundingBox.hasBoundingBox = stream.readByte();
 	if (body.actorBoundingBox.hasBoundingBox) {
 		if (stream.readByte() == ActionType::ACTION_ZV) {
-			body.actorBoundingBox.bottomLeftX = stream.readUint16LE();
-			body.actorBoundingBox.bottomLeftY = stream.readUint16LE();
-			body.actorBoundingBox.bottomLeftZ = stream.readUint16LE();
-			body.actorBoundingBox.topRightX = stream.readUint16LE();
-			body.actorBoundingBox.topRightY = stream.readUint16LE();
-			body.actorBoundingBox.topRightZ = stream.readUint16LE();
+			body.actorBoundingBox.minsx = stream.readUint16LE();
+			body.actorBoundingBox.minsy = stream.readUint16LE();
+			body.actorBoundingBox.minsz = stream.readUint16LE();
+			body.actorBoundingBox.maxsx = stream.readUint16LE();
+			body.actorBoundingBox.maxsy = stream.readUint16LE();
+			body.actorBoundingBox.maxsz = stream.readUint16LE();
 		}
 	}
 	_bodies.push_back(body);
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 6d73e91e5b..34a25fcea6 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -213,13 +213,13 @@ int32 Actor::initBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorB
 					return index;
 				}
 
-				actorBoundingBox.bottomLeftX = stream.readUint16LE();
-				actorBoundingBox.bottomLeftY = stream.readUint16LE();
-				actorBoundingBox.bottomLeftZ = stream.readUint16LE();
+				actorBoundingBox.minsx = stream.readUint16LE();
+				actorBoundingBox.minsy = stream.readUint16LE();
+				actorBoundingBox.minsz = stream.readUint16LE();
 
-				actorBoundingBox.topRightX = stream.readUint16LE();
-				actorBoundingBox.topRightY = stream.readUint16LE();
-				actorBoundingBox.topRightZ = stream.readUint16LE();
+				actorBoundingBox.maxsx = stream.readUint16LE();
+				actorBoundingBox.maxsy = stream.readUint16LE();
+				actorBoundingBox.maxsz = stream.readUint16LE();
 
 				return index;
 			}
@@ -262,12 +262,12 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 
 	if (actorBoundingBox.hasBoundingBox) {
 		BoundingBox &bbox = localActor->boudingBox;
-		bbox.mins.x = actorBoundingBox.bottomLeftX;
-		bbox.maxs.x = actorBoundingBox.topRightX;
-		bbox.mins.y = actorBoundingBox.bottomLeftY;
-		bbox.maxs.y = actorBoundingBox.topRightY;
-		bbox.mins.z = actorBoundingBox.bottomLeftZ;
-		bbox.maxs.z = actorBoundingBox.topRightZ;
+		bbox.mins.x = actorBoundingBox.minsx;
+		bbox.maxs.x = actorBoundingBox.maxsx;
+		bbox.mins.y = actorBoundingBox.minsy;
+		bbox.maxs.y = actorBoundingBox.maxsy;
+		bbox.mins.z = actorBoundingBox.minsz;
+		bbox.maxs.z = actorBoundingBox.maxsz;
 	} else {
 		BoundingBox &bbox = localActor->boudingBox;
 		const BodyData &bd = bodyData[localActor->entity];
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 14f9ab9eda..ad8ff63781 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -114,17 +114,17 @@ struct BoundingBox {
 
 struct ActorBoundingBox {
 	/** Bottom left X coordinate */
-	int16 bottomLeftX = 0;
+	int16 minsx = 0;
 	/** Bottom left Y coordinate */
-	int16 bottomLeftY = 0;
+	int16 minsy = 0;
 	/** Bottom left Z coordinate */
-	int16 bottomLeftZ = 0;
+	int16 minsz = 0;
 	/** Top left X coordinate */
-	int16 topRightX = 0;
+	int16 maxsx = 0;
 	/** Top left Y coordinate */
-	int16 topRightY = 0;
+	int16 maxsy = 0;
 	/** Top left Z coordinate */
-	int16 topRightZ = 0;
+	int16 maxsz = 0;
 	bool hasBoundingBox = false;
 };
 


Commit: f6555148ffba423068b705f8047637cab2626dc9
    https://github.com/scummvm/scummvm/commit/f6555148ffba423068b705f8047637cab2626dc9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: use BoundingBox struct in ActorBoundingBox

Changed paths:
    engines/twine/parser/entity.cpp
    engines/twine/scene/actor.cpp
    engines/twine/shared.h


diff --git a/engines/twine/parser/entity.cpp b/engines/twine/parser/entity.cpp
index e9880f2a9f..518c815c52 100644
--- a/engines/twine/parser/entity.cpp
+++ b/engines/twine/parser/entity.cpp
@@ -34,12 +34,12 @@ bool EntityData::loadBody(Common::SeekableReadStream &stream) {
 	body.actorBoundingBox.hasBoundingBox = stream.readByte();
 	if (body.actorBoundingBox.hasBoundingBox) {
 		if (stream.readByte() == ActionType::ACTION_ZV) {
-			body.actorBoundingBox.minsx = stream.readUint16LE();
-			body.actorBoundingBox.minsy = stream.readUint16LE();
-			body.actorBoundingBox.minsz = stream.readUint16LE();
-			body.actorBoundingBox.maxsx = stream.readUint16LE();
-			body.actorBoundingBox.maxsy = stream.readUint16LE();
-			body.actorBoundingBox.maxsz = stream.readUint16LE();
+			body.actorBoundingBox.bbox.mins.x = stream.readSint16LE();
+			body.actorBoundingBox.bbox.mins.y = stream.readSint16LE();
+			body.actorBoundingBox.bbox.mins.z = stream.readSint16LE();
+			body.actorBoundingBox.bbox.maxs.x = stream.readSint16LE();
+			body.actorBoundingBox.bbox.maxs.y = stream.readSint16LE();
+			body.actorBoundingBox.bbox.maxs.z = stream.readSint16LE();
 		}
 	}
 	_bodies.push_back(body);
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 34a25fcea6..3bd8d874ff 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -213,13 +213,12 @@ int32 Actor::initBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorB
 					return index;
 				}
 
-				actorBoundingBox.minsx = stream.readUint16LE();
-				actorBoundingBox.minsy = stream.readUint16LE();
-				actorBoundingBox.minsz = stream.readUint16LE();
-
-				actorBoundingBox.maxsx = stream.readUint16LE();
-				actorBoundingBox.maxsy = stream.readUint16LE();
-				actorBoundingBox.maxsz = stream.readUint16LE();
+				actorBoundingBox.bbox.mins.x = stream.readSint16LE();
+				actorBoundingBox.bbox.mins.y = stream.readSint16LE();
+				actorBoundingBox.bbox.mins.z = stream.readSint16LE();
+				actorBoundingBox.bbox.maxs.x = stream.readSint16LE();
+				actorBoundingBox.bbox.maxs.y = stream.readSint16LE();
+				actorBoundingBox.bbox.maxs.z = stream.readSint16LE();
 
 				return index;
 			}
@@ -262,12 +261,12 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 
 	if (actorBoundingBox.hasBoundingBox) {
 		BoundingBox &bbox = localActor->boudingBox;
-		bbox.mins.x = actorBoundingBox.minsx;
-		bbox.maxs.x = actorBoundingBox.maxsx;
-		bbox.mins.y = actorBoundingBox.minsy;
-		bbox.maxs.y = actorBoundingBox.maxsy;
-		bbox.mins.z = actorBoundingBox.minsz;
-		bbox.maxs.z = actorBoundingBox.maxsz;
+		bbox.mins.x = actorBoundingBox.bbox.mins.x;
+		bbox.maxs.x = actorBoundingBox.bbox.maxs.x;
+		bbox.mins.y = actorBoundingBox.bbox.mins.y;
+		bbox.maxs.y = actorBoundingBox.bbox.maxs.y;
+		bbox.mins.z = actorBoundingBox.bbox.mins.z;
+		bbox.maxs.z = actorBoundingBox.bbox.maxs.z;
 	} else {
 		BoundingBox &bbox = localActor->boudingBox;
 		const BodyData &bd = bodyData[localActor->entity];
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index ad8ff63781..e25101740a 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -113,18 +113,7 @@ struct BoundingBox {
 };
 
 struct ActorBoundingBox {
-	/** Bottom left X coordinate */
-	int16 minsx = 0;
-	/** Bottom left Y coordinate */
-	int16 minsy = 0;
-	/** Bottom left Z coordinate */
-	int16 minsz = 0;
-	/** Top left X coordinate */
-	int16 maxsx = 0;
-	/** Top left Y coordinate */
-	int16 maxsy = 0;
-	/** Top left Z coordinate */
-	int16 maxsz = 0;
+	BoundingBox bbox;
 	bool hasBoundingBox = false;
 };
 


Commit: 5383d9ff4b5544b370a75046c3af6f5c2879967a
    https://github.com/scummvm/scummvm/commit/5383d9ff4b5544b370a75046c3af6f5c2879967a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: use BoundingBox in BodyData

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


diff --git a/engines/twine/parser/body.cpp b/engines/twine/parser/body.cpp
index 4d3f6e98cf..2a5f51c299 100644
--- a/engines/twine/parser/body.cpp
+++ b/engines/twine/parser/body.cpp
@@ -149,12 +149,12 @@ void BodyData::loadSpheres(Common::SeekableReadStream &stream) {
 
 bool BodyData::loadFromStream(Common::SeekableReadStream &stream) {
 	bodyFlag.value = stream.readUint16LE();
-	minsx = stream.readSint16LE();
-	maxsx = stream.readSint16LE();
-	minsy = stream.readSint16LE();
-	maxsy = stream.readSint16LE();
-	minsz = stream.readSint16LE();
-	maxsz = stream.readSint16LE();
+	bbox.mins.x = stream.readSint16LE();
+	bbox.maxs.x = stream.readSint16LE();
+	bbox.mins.y = stream.readSint16LE();
+	bbox.maxs.y = stream.readSint16LE();
+	bbox.mins.z = stream.readSint16LE();
+	bbox.maxs.z = stream.readSint16LE();
 
 	stream.seek(0x1A);
 	loadVertices(stream);
diff --git a/engines/twine/parser/body.h b/engines/twine/parser/body.h
index bbc46f4f44..87234bfded 100644
--- a/engines/twine/parser/body.h
+++ b/engines/twine/parser/body.h
@@ -119,12 +119,7 @@ public:
 		uint16 value;
 	} bodyFlag;
 
-	int16 minsx = 0;
-	int16 maxsx = 0;
-	int16 minsy = 0;
-	int16 maxsy = 0;
-	int16 minsz = 0;
-	int16 maxsz = 0;
+	BoundingBox bbox;
 	int16 offsetToData = 0;
 
 	inline bool isAnimated() const {
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 3bd8d874ff..578fc64477 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -270,12 +270,12 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 	} else {
 		BoundingBox &bbox = localActor->boudingBox;
 		const BodyData &bd = bodyData[localActor->entity];
-		bbox.mins.y = bd.minsy;
-		bbox.maxs.y = bd.maxsy;
+		bbox.mins.y = bd.bbox.mins.y;
+		bbox.maxs.y = bd.bbox.maxs.y;
 
 		int32 result = 0;
-		const int32 distX = bd.maxsx - bd.minsx;
-		const int32 distZ = bd.maxsz - bd.minsz;
+		const int32 distX = bd.bbox.maxs.x - bd.bbox.mins.x;
+		const int32 distZ = bd.bbox.maxs.z - bd.bbox.mins.z;
 		if (localActor->staticFlags.bUseMiniZv) {
 			// take smaller for bound
 			result = MIN(distX, distZ);


Commit: 2fecba8fdd6ec70491a307338603b159e08f9e58
    https://github.com/scummvm/scummvm/commit/2fecba8fdd6ec70491a307338603b159e08f9e58
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: use nullptr

Changed paths:
    engines/twine/menu/menu.h


diff --git a/engines/twine/menu/menu.h b/engines/twine/menu/menu.h
index 09ea164707..c9edc85f72 100644
--- a/engines/twine/menu/menu.h
+++ b/engines/twine/menu/menu.h
@@ -137,7 +137,7 @@ class Menu {
 private:
 	TwinEEngine *_engine;
 	/** Hero behaviour menu entity */
-	uint8 *behaviourEntity = 0;
+	uint8 *behaviourEntity = nullptr;
 	/** Behaviour menu anim state */
 	uint behaviourAnimState[4]; // winTab
 	/** Behaviour menu anim data pointer */


Commit: df31075eccc3c213463a46b74b9901b3c91f7ed2
    https://github.com/scummvm/scummvm/commit/df31075eccc3c213463a46b74b9901b3c91f7ed2
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: comment on sample idx

Changed paths:
    engines/twine/menu/menu.cpp


diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index c94906afa4..18c006badf 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -671,7 +671,7 @@ int32 Menu::optionsMenu() {
 	_engine->flip();
 
 	_engine->_sound->stopSamples();
-	_engine->_music->playTrackMusic(9);
+	_engine->_music->playTrackMusic(9); // LBA's Theme
 
 	ScopedCursor scoped(_engine);
 	for (;;) {


Commit: abae3e440a8ea7b78d6b1ea6f7cf3fb6201cbd58
    https://github.com/scummvm/scummvm/commit/abae3e440a8ea7b78d6b1ea6f7cf3fb6201cbd58
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: refactored extra shape

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


diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index a380b1da67..424b370f83 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -41,68 +41,40 @@
 namespace TwinE {
 
 /** Hit Stars shape info */
-static const int16 hitStarsShapeTable[] = {
-    10, // num entries of x and z rotation values
-    0,
-    -20,
-    4,
-    -6,
-    19,
-    -6,
-    7,
-    2,
-    12,
-    16,
-    0,
-    7,
-    -12,
-    16,
-    -7,
-    2,
-    -19,
-    -6,
-    -4,
-    -6};
+static const ShapeData hitStarsData[]{
+	{4, -6},
+	{19, -6},
+	{7, 2},
+	{12, 16},
+	{0, 7},
+	{-12, 16},
+	{-7, 2},
+	{-19, -6},
+	{-4, -6}};
 
 /** Explode Cloud shape info */
-static const int16 explodeCloudShapeTable[] = {
-    18, // num entries of x and z rotation values
-    0,
-    -20,
-    6,
-    -16,
-    8,
-    -10,
-    14,
-    -12,
-    20,
-    -4,
-    18,
-    4,
-    12,
-    4,
-    16,
-    8,
-    8,
-    16,
-    2,
-    12,
-    -4,
-    18,
-    -10,
-    16,
-    -12,
-    8,
-    -16,
-    10,
-    -20,
-    4,
-    -12,
-    -8,
-    -6,
-    -6,
-    -10,
-    -12};
+static const ShapeData explodeCloudData[]{
+	{0, -20},
+	{6, -16},
+	{8, -10},
+	{14, -12},
+	{20, -4},
+	{18, 4},
+	{12, 4},
+	{16, 8},
+	{8, 16},
+	{2, 12},
+	{-4, 18},
+	{-10, 16},
+	{-12, 8},
+	{-16, 10},
+	{-20, 4},
+	{-12, -8},
+	{-6, -6},
+	{-10, -12}};
+
+const ExtraShape hitStarsShape { ARRAYSIZE(hitStarsData), hitStarsData };
+const ExtraShape explodeCloudShape { ARRAYSIZE(explodeCloudData), explodeCloudData };
 
 Extra::Extra(TwinEEngine *engine) : _engine(engine) {}
 
@@ -430,11 +402,12 @@ void Extra::addExtraThrowMagicball(int32 x, int32 y, int32 z, int32 xAngle, int3
 	}
 }
 
-void Extra::drawSpecialShape(const int16 *shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 size) {
-	int16 currentShapeTable = *shapeTable++;
+void Extra::drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 size) {
+	int shapeDataIndex = 0;
+	int16 var_x = shapeTable.data[shapeDataIndex].x * size / 16;
+	int16 var_z = shapeTable.data[shapeDataIndex].x * size / 16;
 
-	int16 var_x = (*shapeTable++) * size / 16;
-	int16 var_z = (*shapeTable++) * size / 16;
+	++shapeDataIndex;
 
 	_engine->_redraw->renderRect.left = 0x7D00;
 	_engine->_redraw->renderRect.right = -0x7D00;
@@ -465,9 +438,10 @@ void Extra::drawSpecialShape(const int16 *shapeTable, int32 x, int32 y, int32 co
 	int32 currentX = computedX;
 	int32 currentY = computedY;
 
-	for (int32 numEntries = 1; numEntries < currentShapeTable; ++numEntries) {
-		var_x = (*shapeTable++) * size / 16;
-		var_z = (*shapeTable++) * size / 16;
+	for (int32 numEntries = 1; numEntries < shapeTable.n; ++numEntries) {
+		var_x = shapeTable.data[shapeDataIndex].x * size / 16;
+		var_z = shapeTable.data[shapeDataIndex].x * size / 16;
+		++shapeDataIndex;
 
 		const int32 oldComputedX = currentX;
 		const int32 oldComputedY = currentY;
@@ -516,7 +490,7 @@ void Extra::drawExtraSpecial(int32 extraIdx, int32 x, int32 y) {
 
 	switch (specialType) {
 	case ExtraSpecialType::kHitStars:
-		drawSpecialShape(hitStarsShapeTable, x, y, COLOR_WHITE, (_engine->lbaTime * 32) & ANGLE_270, 4);
+		drawSpecialShape(hitStarsShape, x, y, COLOR_WHITE, (_engine->lbaTime * 32) & ANGLE_270, 4);
 		break;
 	case ExtraSpecialType::kExplodeCloud: {
 		int32 cloudTime = 1 + _engine->lbaTime - extra->spawnTime;
@@ -525,7 +499,7 @@ void Extra::drawExtraSpecial(int32 extraIdx, int32 x, int32 y) {
 			cloudTime = 32;
 		}
 
-		drawSpecialShape(explodeCloudShapeTable, x, y, COLOR_WHITE, 0, cloudTime);
+		drawSpecialShape(explodeCloudShape, x, y, COLOR_WHITE, 0, cloudTime);
 		break;
 	}
 	}
diff --git a/engines/twine/scene/extra.h b/engines/twine/scene/extra.h
index f412121de7..a5f668bfc6 100644
--- a/engines/twine/scene/extra.h
+++ b/engines/twine/scene/extra.h
@@ -32,6 +32,16 @@ namespace TwinE {
 
 #define EXTRA_SPECIAL_MASK 0x8000
 
+struct ShapeData {
+	int16 x;
+	int16 z;
+};
+
+struct ExtraShape {
+	int n;
+	const ShapeData *data;
+};
+
 enum ExtraType {
 	TIME_OUT = 1 << 0,     // 0x0001
 	FLY = 1 << 1,          // 0x0002
@@ -82,7 +92,7 @@ private:
 	void processMagicballBounce(ExtraListStruct *extra, int32 x, int32 y, int32 z);
 	int32 findExtraKey();
 	int32 addExtraAimingAtKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx);
-	void drawSpecialShape(const int16 *shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 size);
+	void drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 size);
 
 public:
 	Extra(TwinEEngine *engine);


Commit: 110d324ae9e663b2b973252a513aabc8577d7e93
    https://github.com/scummvm/scummvm/commit/110d324ae9e663b2b973252a513aabc8577d7e93
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: renamed constants

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


diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 424b370f83..fd8ab477ce 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -324,7 +324,7 @@ int32 Extra::addExtraAimingAtKey(int32 actorIdx, int32 x, int32 y, int32 z, int3
 			continue;
 		}
 		extra->info0 = spriteIdx;
-		extra->type = ExtraType::UNK9;
+		extra->type = ExtraType::MAGIC_BALL_KEY;
 		extra->info1 = 0;
 		extra->pos.x = x;
 		extra->pos.y = y;
@@ -544,7 +544,7 @@ void Extra::processExtras() {
 			}
 		}
 		// reset extra
-		if (extra->type & ExtraType::UNK11) {
+		if (extra->type & ExtraType::RESET_EXTRA) {
 			extra->info0 = -1;
 			continue;
 		}
@@ -652,8 +652,8 @@ void Extra::processExtras() {
 			}
 		}
 		// process magic ball extra aiming for key
-		if (extra->type & ExtraType::UNK9) {
-			//				int32 actorIdxAttacked = extra->lifeTime;
+		if (extra->type & ExtraType::MAGIC_BALL_KEY) {
+			// int32 actorIdxAttacked = extra->lifeTime;
 			ExtraListStruct *extraKey = &extraList[extra->payload.extraIdx];
 			const int32 extraIdx = extra->payload.extraIdx;
 
diff --git a/engines/twine/scene/extra.h b/engines/twine/scene/extra.h
index a5f668bfc6..859805985d 100644
--- a/engines/twine/scene/extra.h
+++ b/engines/twine/scene/extra.h
@@ -43,22 +43,22 @@ struct ExtraShape {
 };
 
 enum ExtraType {
-	TIME_OUT = 1 << 0,     // 0x0001
-	FLY = 1 << 1,          // 0x0002
-	UNK2 = 1 << 2,         // 0x0004
-	UNK3 = 1 << 3,         // 0x0008
-	STOP_COL = 1 << 4,     // 0x0010
-	TAKABLE = 1 << 5,      // 0x0020
-	FLASH = 1 << 6,        // 0x0040
-	UNK7 = 1 << 7,         // 0x0080
-	UNK8 = 1 << 8,         // 0x0100
-	UNK9 = 1 << 9,         // 0x0200
-	TIME_IN = 1 << 10,     // 0x0400
-	UNK11 = 1 << 11,       // 0x0800
-	EXPLOSION = 1 << 12,   // 0x1000
-	WAIT_NO_COL = 1 << 13, // 0x2000
-	BONUS = 1 << 14,       // 0x4000
-	UNK15 = 1 << 15        // 0x8000
+	TIME_OUT = 1 << 0,       // 0x0001
+	FLY = 1 << 1,            // 0x0002
+	UNK2 = 1 << 2,           // 0x0004
+	UNK3 = 1 << 3,           // 0x0008
+	STOP_COL = 1 << 4,       // 0x0010
+	TAKABLE = 1 << 5,        // 0x0020
+	FLASH = 1 << 6,          // 0x0040
+	UNK7 = 1 << 7,           // 0x0080
+	UNK8 = 1 << 8,           // 0x0100
+	MAGIC_BALL_KEY = 1 << 9, // 0x0200
+	TIME_IN = 1 << 10,       // 0x0400
+	RESET_EXTRA = 1 << 11,   // 0x0800
+	EXPLOSION = 1 << 12,     // 0x1000
+	WAIT_NO_COL = 1 << 13,   // 0x2000
+	BONUS = 1 << 14,         // 0x4000
+	UNK15 = 1 << 15          // 0x8000
 };
 
 struct ExtraListStruct {


Commit: b0411c3bf29b2da5d2546b7da805654508044e72
    https://github.com/scummvm/scummvm/commit/b0411c3bf29b2da5d2546b7da805654508044e72
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:25:04+01:00

Commit Message:
TWINE: const

Changed paths:
    engines/twine/script/script_life_v1.cpp


diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index f3736462b4..b6b0cc9038 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1504,8 +1504,8 @@ static int32 lFADE_PAL_ALARM(TwinEEngine *engine, LifeScriptContext &ctx) {
  * @note Opcode @c 0x58
  */
 static int32 lEXPLODE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
-	int32 otherActorIdx = ctx.stream.readByte();
-	ActorStruct *otherActor = engine->_scene->getActor(otherActorIdx);
+	const int32 otherActorIdx = ctx.stream.readByte();
+	const ActorStruct *otherActor = engine->_scene->getActor(otherActorIdx);
 
 	engine->_extra->addExtraExplode(otherActor->pos.x, otherActor->pos.y, otherActor->pos.z); // RECHECK this
 
@@ -1535,8 +1535,8 @@ static int32 lBUBBLE_OFF(TwinEEngine *engine, LifeScriptContext &ctx) {
  * @note Opcode @c 0x5B
  */
 static int32 lASK_CHOICE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
-	int32 otherActorIdx = ctx.stream.readByte();
-	int32 choiceIdx = ctx.stream.readSint16LE();
+	const int32 otherActorIdx = ctx.stream.readByte();
+	const int32 choiceIdx = ctx.stream.readSint16LE();
 
 	engine->freezeTime();
 	if (engine->_text->showDialogueBubble) {
@@ -1557,6 +1557,7 @@ static int32 lASK_CHOICE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
  */
 static int32 lSET_DARK_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
 	ScopedEngineFreeze scoped(engine);
+	// TODO: allocation in the game frame... cache it in Resource class
 	HQR::getEntry(engine->_screens->palette, Resources::HQR_RESS_FILE, RESSHQR_DARKPAL);
 	if (!engine->_screens->lockPalette) {
 		engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
@@ -1609,7 +1610,7 @@ static int32 lMESSAGE_SENDELL(TwinEEngine *engine, LifeScriptContext &ctx) {
  * @note Opcode @c 0x5F
  */
 static int32 lANIM_SET(TwinEEngine *engine, LifeScriptContext &ctx) {
-	AnimationTypes animIdx = (AnimationTypes)ctx.stream.readByte();
+	const AnimationTypes animIdx = (AnimationTypes)ctx.stream.readByte();
 
 	ctx.actor->anim = AnimationTypes::kAnimNone;
 	ctx.actor->previousAnimIdx = -1;
@@ -1669,7 +1670,7 @@ static int32 lMIDI_OFF(TwinEEngine *engine, LifeScriptContext &ctx) {
  * @note Opcode @c 0x64
  */
 static int32 lPLAY_CD_TRACK(TwinEEngine *engine, LifeScriptContext &ctx) {
-	int32 track = ctx.stream.readByte();
+	const int32 track = ctx.stream.readByte();
 	engine->_music->playTrackMusic(track);
 	return 0;
 }
@@ -1719,9 +1720,9 @@ static int32 lTEXT(TwinEEngine *engine, LifeScriptContext &ctx) {
 
 		char textStr[256];
 		engine->_text->getMenuText(textIdx, textStr, sizeof(textStr));
-		int32 textSize = engine->_text->getTextSize(textStr);
+		const int32 textSize = engine->_text->getTextSize(textStr);
 		int32 textBoxRight = textSize;
-		int32 textBoxBottom = lTextYPos + textHeight;
+		const int32 textBoxBottom = lTextYPos + textHeight;
 		engine->_text->setFontColor(COLOR_WHITE);
 		engine->_text->drawText(0, lTextYPos, textStr);
 		if (textSize > engine->width() - 1) {


Commit: a0175e1b696a11cafdec17dbb92e74d99dac99fd
    https://github.com/scummvm/scummvm/commit/a0175e1b696a11cafdec17dbb92e74d99dac99fd
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-17T18:27:29+01:00

Commit Message:
TWINE: const

Changed paths:
    engines/twine/renderer/redraw.cpp


diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 2858ce59e9..b200eb7965 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -623,7 +623,7 @@ void Redraw::renderOverlays() {
 				_engine->_interface->drawFilledRect(rect, COLOR_BLACK);
 				_engine->_interface->setClip(rect);
 
-				uint8* bodyPtr = _engine->_resources->inventoryTable[item];
+				const uint8* bodyPtr = _engine->_resources->inventoryTable[item];
 				overlayRotation += 1; // overlayRotation += 8;
 				_engine->_renderer->renderInventoryItem(40, 40, bodyPtr, overlayRotation, 16000);
 				_engine->_menu->drawBox(rect);




More information about the Scummvm-git-logs mailing list