[Scummvm-git-logs] scummvm master -> 486c7fffd06817061fa2f0d905e9b8d94913ce9e
mgerhardy
noreply at scummvm.org
Sat Jun 11 08:01:37 UTC 2022
This automated email contains information about 10 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
11e5b11f82 TWINE: removed duplicated call to initSceneTextBank()
6dd64584d8 TWINE: added warning
23815c35a8 TWINE: fixed typo
7bcbc5d7b6 TWINE: hasBoundingBox is now only true if the action type is ACTION_ZV
c9604d7926 TWINE: fixed invisible check in checkCollisionWithActors
ff1de24376 TWINE: renamed member to match original source code
ae4d701790 TWINE: fixed reajustActorPosition
049c6a63eb TWINE: activate else branch as found in the original sources
91341f443b TWINE: renamed variables to match original sources
486c7fffd0 TWINE: fixed invalid to-angle in processRandomAction
Commit: 11e5b11f8241c62e0ea4b3560836acd3f49fec07
https://github.com/scummvm/scummvm/commit/11e5b11f8241c62e0ea4b3560836acd3f49fec07
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: removed duplicated call to initSceneTextBank()
Changed paths:
engines/twine/menu/menu.cpp
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 24515e4270e..f4ec5f1fd7a 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1121,7 +1121,6 @@ void Menu::processBehaviourMenu() {
char text[256];
_engine->_text->getMenuText(_engine->_actor->getTextIdForBehaviour(), text, sizeof(text));
_engine->_redraw->setRenderText(text);
- _engine->_text->initSceneTextBank();
} else {
const int32 left = _engine->width() / 2 - 220;
const int32 top = _engine->height() / 2 - 140;
Commit: 6dd64584d8b3d8f3b0d2a567bf7e845aca84364f
https://github.com/scummvm/scummvm/commit/6dd64584d8b3d8f3b0d2a567bf7e845aca84364f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: added warning
Changed paths:
engines/twine/scene/actor.cpp
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index af058ec5a2c..ce9203a052a 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -156,6 +156,7 @@ int32 Actor::initBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorB
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
const EntityBody *body = actor->_entityDataPtr->getBody((int)bodyIdx);
if (body == nullptr) {
+ warning("Failed to get entity body for body idx %i", (int)bodyIdx);
return -1;
}
actorBoundingBox = body->actorBoundingBox;
Commit: 23815c35a86ba901eb8d5bb7c69699b76c528bf5
https://github.com/scummvm/scummvm/commit/23815c35a86ba901eb8d5bb7c69699b76c528bf5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: fixed typo
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/scene.cpp
diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index 65d883463b5..78a995668e8 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -145,7 +145,7 @@ bool DebugScene::displayActors() {
for (int32 a = 0; a < _engine->_scene->_sceneNumActors; a++) {
const ActorStruct *actorPtr = _engine->_scene->getActor(a);
const IVec3 &pos = actorPtr->pos();
- const BoundingBox &bbox = actorPtr->_boudingBox;
+ const BoundingBox &bbox = actorPtr->_boundingBox;
const ScenePositionsProjected &positions = calculateBoxPositions(pos + bbox.mins, pos + bbox.maxs);
if (!drawBox(positions, COLOR_WHITE)) {
continue;
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 0255f9dc8dd..f967b01cc9e 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -423,9 +423,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.maxs.x + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpX = (actor->_pos.x + actor->_boundingBox.maxs.x + BRICK_HEIGHT) / BRICK_SIZE;
int32 tmpY = actor->_pos.y / BRICK_HEIGHT;
- const int32 tmpZ = (actor->_pos.z + actor->_boudingBox.maxs.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpZ = (actor->_pos.z + actor->_boundingBox.maxs.z + BRICK_HEIGHT) / BRICK_SIZE;
if (actor->brickShape() != ShapeType::kNone) {
tmpY++;
}
@@ -515,7 +515,7 @@ void Redraw::renderOverlays() {
case OverlayPosType::koFollowActor: {
ActorStruct *actor2 = _engine->_scene->getActor(overlay->info1);
- const IVec3 &projPos = _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);
+ const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor2->_pos.x - _engine->_grid->_camera.x, actor2->_pos.y + actor2->_boundingBox.maxs.y - _engine->_grid->_camera.y, actor2->_pos.z - _engine->_grid->_camera.z);
overlay->x = projPos.x;
overlay->y = projPos.y;
@@ -746,7 +746,7 @@ void Redraw::drawBubble(int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
// get actor position on screen
- const IVec3 &projPos = _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);
+ const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->_pos.x - _engine->_grid->_camera.x, actor->_pos.y + actor->_boundingBox.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 ce9203a052a..779e602a66f 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -137,7 +137,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;
- localActor->_boudingBox = *spritebbox;
+ localActor->_boundingBox = *spritebbox;
}
}
@@ -180,7 +180,7 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
if (entityIdx == -1) {
localActor->_body = BodyType::btNone;
localActor->_entity = -1;
- localActor->_boudingBox = BoundingBox();
+ localActor->_boundingBox = BoundingBox();
debug("Failed to initialize body %i for actor %i", (int)bodyIdx, actorIdx);
return;
}
@@ -193,14 +193,14 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
localActor->_body = bodyIdx;
if (actorBoundingBox.hasBoundingBox) {
- localActor->_boudingBox = actorBoundingBox.bbox;
+ localActor->_boundingBox = actorBoundingBox.bbox;
} else {
const BodyData &bd = _engine->_resources->_bodyData[localActor->_entity];
- localActor->_boudingBox = bd.bbox;
+ localActor->_boundingBox = bd.bbox;
int32 size = 0;
- const int32 distX = localActor->_boudingBox.maxs.x - localActor->_boudingBox.mins.x;
- const int32 distZ = localActor->_boudingBox.maxs.z - localActor->_boudingBox.mins.z;
+ const int32 distX = localActor->_boundingBox.maxs.x - localActor->_boundingBox.mins.x;
+ const int32 distZ = localActor->_boundingBox.maxs.z - localActor->_boundingBox.mins.z;
if (localActor->_staticFlags.bUseMiniZv) {
// take smaller for bound
if (distX < distZ)
@@ -212,10 +212,10 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
size = (distZ + distX) / 4;
}
- localActor->_boudingBox.mins.x = -size;
- localActor->_boudingBox.maxs.x = size;
- localActor->_boudingBox.mins.z = -size;
- localActor->_boudingBox.maxs.z = size;
+ localActor->_boundingBox.mins.x = -size;
+ localActor->_boundingBox.maxs.x = size;
+ localActor->_boundingBox.mins.z = -size;
+ localActor->_boundingBox.maxs.z = size;
}
}
@@ -266,7 +266,7 @@ void Actor::resetActor(int16 actorIdx) {
actor->_pos = IVec3(0, -1, 0);
actor->_spriteActorRotation = 0;
- actor->_boudingBox = BoundingBox();
+ actor->_boundingBox = BoundingBox();
actor->_angle = 0;
actor->_speed = 40;
@@ -374,7 +374,7 @@ void Actor::processActorExtraBonus(int32 actorIdx) {
} else {
const ActorStruct *sceneHero = _engine->_scene->_sceneHero;
const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->pos(), sceneHero->pos());
- const IVec3 pos(actor->_pos.x, actor->_pos.y + actor->_boudingBox.maxs.y, actor->_pos.z);
+ const IVec3 pos(actor->_pos.x, actor->_pos.y + actor->_boundingBox.maxs.y, actor->_pos.z);
_engine->_extra->addExtraBonus(pos, ANGLE_70, angle, bonusSprite, actor->_bonusAmount);
_engine->_sound->playSample(Samples::ItemPopup, 1, pos, actorIdx);
}
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 27d0564412f..dbc427ebefa 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -227,7 +227,7 @@ public:
int32 _spriteActorRotation = 0;
uint8 _brickSound = 0U;
- BoundingBox _boudingBox;
+ BoundingBox _boundingBox;
ActorMoveStruct _move;
AnimTimerDataStruct _animTimerData;
};
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index bfa2fa4eaff..d01af8cf942 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -674,22 +674,22 @@ void Animations::processActorAnimations(int32 actorIdx) {
if (IS_HERO(actorIdx) && !actor->_staticFlags.bComputeLowCollision) {
// check hero collisions with bricks
- _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);
+ _engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
+ _engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
+ _engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
+ _engine->_collision->checkHeroCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
} else {
// check other actors collisions with bricks
- _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);
+ _engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
+ _engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
+ _engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
+ _engine->_collision->checkActorCollisionWithBricks(actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
}
processActor = processActorSave;
// process wall hit while running
if (_engine->_collision->_causeActorDamage && !actor->_dynamicFlags.bIsFalling && IS_HERO(_currentlyProcessedActorIdx) && _engine->_actor->_heroBehaviour == HeroBehaviourType::kAthletic && actor->_anim == AnimationTypes::kForward) {
- IVec3 destPos = _engine->_movements->rotateActor(actor->_boudingBox.mins.x, actor->_boudingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
+ IVec3 destPos = _engine->_movements->rotateActor(actor->_boundingBox.mins.x, actor->_boundingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
destPos.x += processActor.x;
destPos.z += processActor.z;
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 04292922263..0b6639dc6a5 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -45,11 +45,11 @@ bool Collision::standingOnActor(int32 actorIdx1, int32 actorIdx2) const {
const ActorStruct *actor2 = _engine->_scene->getActor(actorIdx2);
const IVec3 &processActor = _engine->_movements->_processActor;
- const IVec3 &mins1 = processActor + actor1->_boudingBox.mins;
- const IVec3 &maxs1 = processActor + actor1->_boudingBox.maxs;
+ const IVec3 &mins1 = processActor + actor1->_boundingBox.mins;
+ const IVec3 &maxs1 = processActor + actor1->_boundingBox.maxs;
- const IVec3 &mins2 = actor2->pos() + actor2->_boudingBox.mins;
- const IVec3 &maxs2 = actor2->pos() + actor2->_boudingBox.maxs;
+ const IVec3 &mins2 = actor2->pos() + actor2->_boundingBox.mins;
+ const IVec3 &maxs2 = actor2->pos() + actor2->_boundingBox.maxs;
if (mins1.x >= maxs2.x) {
return false;
@@ -220,19 +220,19 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, cons
}
}
- 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 ((actorTest->_boundingBox.maxs.x - actorTest->_boundingBox.mins.x == actorTest->_boundingBox.maxs.z - actorTest->_boundingBox.mins.z) &&
+ (actor->_boundingBox.maxs.x - actor->_boundingBox.mins.x == actor->_boundingBox.maxs.z - actor->_boundingBox.mins.z)) {
if (newAngle >= ANGLE_45 && newAngle < ANGLE_135) {
- processActor.x = minsTest.x - actor->_boudingBox.maxs.x;
+ processActor.x = minsTest.x - actor->_boundingBox.maxs.x;
}
if (newAngle >= ANGLE_135 && newAngle < ANGLE_225) {
- processActor.z = maxsTest.z - actor->_boudingBox.mins.z;
+ processActor.z = maxsTest.z - actor->_boundingBox.mins.z;
}
if (newAngle >= ANGLE_225 && newAngle < ANGLE_315) {
- processActor.x = maxsTest.x - actor->_boudingBox.mins.x;
+ processActor.x = maxsTest.x - actor->_boundingBox.mins.x;
}
if (newAngle >= ANGLE_315 || newAngle < ANGLE_45) {
- processActor.z = minsTest.z - actor->_boudingBox.maxs.z;
+ processActor.z = minsTest.z - actor->_boundingBox.maxs.z;
}
} else if (!actor->_dynamicFlags.bIsFalling) {
processActor = previousActor;
@@ -243,8 +243,8 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
IVec3 &processActor = _engine->_movements->_processActor;
- IVec3 mins = processActor + actor->_boudingBox.mins;
- IVec3 maxs = processActor + actor->_boudingBox.maxs;
+ IVec3 mins = processActor + actor->_boundingBox.mins;
+ IVec3 maxs = processActor + actor->_boundingBox.maxs;
actor->_collision = -1;
@@ -253,15 +253,15 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
// avoid current processed actor
if (a != actorIdx && actorTest->_entity != -1 && !actor->_staticFlags.bComputeLowCollision && actorTest->_carryBy != actorIdx) {
- const IVec3 &minsTest = actorTest->pos() + actorTest->_boudingBox.mins;
- const IVec3 &maxsTest = actorTest->pos() + actorTest->_boudingBox.maxs;
+ const IVec3 &minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
+ const IVec3 &maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
if (mins.x < maxsTest.x && maxs.x > minsTest.x && mins.y < maxsTest.y && maxs.y > minsTest.y && mins.z < maxsTest.z && maxs.z > minsTest.z) {
actor->_collision = a; // mark as collision with actor a
if (actorTest->_staticFlags.bIsCarrierActor) {
if (actor->_dynamicFlags.bIsFalling || standingOnActor(actorIdx, a)) {
- processActor.y = maxsTest.y - actor->_boudingBox.mins.y + 1;
+ processActor.y = maxsTest.y - actor->_boundingBox.mins.y + 1;
actor->_carryBy = a;
} else {
handlePushing(minsTest, maxsTest, actor, actorTest);
@@ -278,11 +278,11 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
if (actor->_dynamicFlags.bIsHitting) {
const IVec3 &destPos = _engine->_movements->rotateActor(0, 200, actor->_angle);
- mins = processActor + actor->_boudingBox.mins;
+ mins = processActor + actor->_boundingBox.mins;
mins.x += destPos.x;
mins.z += destPos.z;
- maxs = processActor + actor->_boudingBox.maxs;
+ maxs = processActor + actor->_boundingBox.maxs;
maxs.x += destPos.x;
maxs.z += destPos.z;
@@ -291,8 +291,8 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
// avoid current processed actor
if (a != actorIdx && actorTest->_entity != -1 && !actorTest->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
- const IVec3 minsTest = actorTest->pos() + actorTest->_boudingBox.mins;
- const IVec3 maxsTest = actorTest->pos() + actorTest->_boudingBox.maxs;
+ const IVec3 minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
+ const IVec3 maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
if (mins.x < maxsTest.x && maxs.x > minsTest.x && mins.y < maxsTest.y && maxs.y > minsTest.y && mins.z < maxsTest.z && maxs.z > minsTest.z) {
_engine->_actor->hitActor(actorIdx, a, actor->_strengthOfHit, actor->_angle + ANGLE_180);
actor->_dynamicFlags.bIsHitting = 0;
@@ -314,7 +314,7 @@ void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 da
processActor.z += z;
if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= SCENE_SIZE_MAX && processActor.z <= SCENE_SIZE_MAX) {
- const BoundingBox &bbox = _engine->_actor->_processActorPtr->_boudingBox;
+ const BoundingBox &bbox = _engine->_actor->_processActorPtr->_boundingBox;
reajustActorPosition(brickShape);
brickShape = _engine->_grid->getBrickShapeFull(processActor, bbox.maxs.y);
@@ -412,8 +412,8 @@ int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 act
const ActorStruct *actorTest = _engine->_scene->getActor(a);
if (a != actorIdx && actorTest->_entity != -1) {
- const IVec3 minsTest = actorTest->pos() + actorTest->_boudingBox.mins;
- const IVec3 maxsTest = actorTest->pos() + actorTest->_boudingBox.maxs;
+ const IVec3 minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
+ const IVec3 maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
if (mins.x < maxsTest.x && maxs.x > minsTest.x && mins.y < maxsTest.y && maxs.y > minsTest.y && mins.z < maxsTest.z && maxs.z > minsTest.z) {
if (extra->strengthOfHit != 0) {
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 6d6bc68bbcd..77ff51644a7 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -770,7 +770,7 @@ 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)) {
- IVec3 destPos = _engine->_movements->rotateActor(actor->_boudingBox.mins.x, actor->_boudingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
+ IVec3 destPos = _engine->_movements->rotateActor(actor->_boundingBox.mins.x, actor->_boundingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
destPos.x += _engine->_movements->_processActor.x;
destPos.z += _engine->_movements->_processActor.z;
Commit: 7bcbc5d7b60cd2bfc40082988698a87c4f7efc0f
https://github.com/scummvm/scummvm/commit/7bcbc5d7b60cd2bfc40082988698a87c4f7efc0f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: hasBoundingBox is now only true if the action type is ACTION_ZV
Changed paths:
engines/twine/parser/entity.cpp
diff --git a/engines/twine/parser/entity.cpp b/engines/twine/parser/entity.cpp
index f392e011a26..2f0f7c3bd96 100644
--- a/engines/twine/parser/entity.cpp
+++ b/engines/twine/parser/entity.cpp
@@ -30,9 +30,10 @@ bool EntityData::loadBody(Common::SeekableReadStream &stream) {
const int32 pos = stream.pos();
uint8 size = stream.readByte();
body.bodyIndex = (int16)stream.readUint16LE();
- body.actorBoundingBox.hasBoundingBox = stream.readByte();
- if (body.actorBoundingBox.hasBoundingBox) {
+ const uint8 numActions = stream.readByte();
+ for (uint8 i = 0U; i < numActions; ++i) {
if ((ActionType)stream.readByte() == ActionType::ACTION_ZV) {
+ body.actorBoundingBox.hasBoundingBox = true;
body.actorBoundingBox.bbox.mins.x = stream.readSint16LE();
body.actorBoundingBox.bbox.mins.y = stream.readSint16LE();
body.actorBoundingBox.bbox.mins.z = stream.readSint16LE();
Commit: c9604d7926c771e1ea4e225401642cd919748e00
https://github.com/scummvm/scummvm/commit/c9604d7926c771e1ea4e225401642cd919748e00
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: fixed invisible check in checkCollisionWithActors
Changed paths:
engines/twine/scene/collision.cpp
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 0b6639dc6a5..85b3f7e9143 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -252,7 +252,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
ActorStruct *actorTest = _engine->_scene->getActor(a);
// avoid current processed actor
- if (a != actorIdx && actorTest->_entity != -1 && !actor->_staticFlags.bComputeLowCollision && actorTest->_carryBy != actorIdx) {
+ if (a != actorIdx && actorTest->_entity != -1 && !actor->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
const IVec3 &minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
const IVec3 &maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
Commit: ff1de243762f584e8dea44194d57bef728cb9507
https://github.com/scummvm/scummvm/commit/ff1de243762f584e8dea44194d57bef728cb9507
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: renamed member to match original source code
Changed paths:
engines/twine/renderer/redraw.cpp
engines/twine/scene/actor.cpp
engines/twine/scene/actor.h
engines/twine/scene/animations.cpp
engines/twine/scene/collision.cpp
engines/twine/script/script_life_v1.cpp
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index f967b01cc9e..aca6e8c8056 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -227,7 +227,7 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
drawList[drawListPos].type = DrawListType::DrawActorSprites;
drawList[drawListPos].actorIdx = a;
if (actor->_staticFlags.bUsesClipping) {
- tmpVal = actor->_lastPos.x - _engine->_grid->_camera.x + actor->_lastPos.z - _engine->_grid->_camera.z;
+ tmpVal = actor->_animStep.x - _engine->_grid->_camera.x + actor->_animStep.z - _engine->_grid->_camera.z;
}
} else {
drawList[drawListPos].type = 0;
@@ -418,9 +418,9 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
actor->_dynamicFlags.bIsVisible = 1;
if (actor->_staticFlags.bUsesClipping) {
- const int32 tmpX = (actor->_lastPos.x + BRICK_HEIGHT) / BRICK_SIZE;
- const int32 tmpY = actor->_lastPos.y / BRICK_HEIGHT;
- const int32 tmpZ = (actor->_lastPos.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpX = (actor->_animStep.x + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpY = actor->_animStep.y / BRICK_HEIGHT;
+ const int32 tmpZ = (actor->_animStep.z + BRICK_HEIGHT) / BRICK_SIZE;
_engine->_grid->drawOverSpriteActor(tmpX, tmpY, tmpZ);
} else {
const int32 tmpX = (actor->_pos.x + actor->_boundingBox.maxs.x + BRICK_HEIGHT) / BRICK_SIZE;
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 779e602a66f..cfb9e18bada 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -234,7 +234,7 @@ void Actor::initActor(int16 actorIdx) {
_engine->_movements->setActorAngleSafe(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_move);
if (actor->_staticFlags.bUsesClipping) {
- actor->_lastPos = actor->pos();
+ actor->_animStep = actor->pos();
}
} else {
actor->_entity = -1;
@@ -290,7 +290,7 @@ void Actor::resetActor(int16 actorIdx) {
actor->_armor = 1;
actor->_hitBy = -1;
actor->_lastRotationAngle = ANGLE_0;
- actor->_lastPos = IVec3();
+ actor->_animStep = IVec3();
actor->_entity = -1;
actor->_previousAnimIdx = -1;
actor->_animType = AnimType::kAnimationTypeLoop;
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index dbc427ebefa..35417e4a782 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -219,7 +219,7 @@ public:
int32 _zone = 0;
int32 _lastRotationAngle = ANGLE_0;
- IVec3 _lastPos;
+ IVec3 _animStep;
int32 _previousAnimIdx = 0;
int32 _doorStatus = 0;
int32 _animPosition = 0;
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index d01af8cf942..39d8dc4afdd 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -451,7 +451,7 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType animType, AnimationTy
processAnimActions(actorIdx);
actor->_lastRotationAngle = ANGLE_0;
- actor->_lastPos = IVec3();
+ actor->_animStep = IVec3();
return true;
}
@@ -502,15 +502,15 @@ void Animations::processActorAnimations(int32 actorIdx) {
// AUTO_STOP_DOOR
if (actor->_dynamicFlags.bIsSpriteMoving) {
if (actor->_doorStatus) { // open door
- if (getDistance2D(processActor.x, processActor.z, actor->_lastPos.x, actor->_lastPos.z) >= actor->_doorStatus) {
+ if (getDistance2D(processActor.x, processActor.z, actor->_animStep.x, actor->_animStep.z) >= actor->_doorStatus) {
if (actor->_angle == ANGLE_0) { // down
- processActor.z = actor->_lastPos.z + actor->_doorStatus;
+ processActor.z = actor->_animStep.z + actor->_doorStatus;
} else if (actor->_angle == ANGLE_90) { // right
- processActor.x = actor->_lastPos.x + actor->_doorStatus;
+ processActor.x = actor->_animStep.x + actor->_doorStatus;
} else if (actor->_angle == ANGLE_180) { // up
- processActor.z = actor->_lastPos.z - actor->_doorStatus;
+ processActor.z = actor->_animStep.z - actor->_doorStatus;
} else if (actor->_angle == ANGLE_270) { // left
- processActor.x = actor->_lastPos.x - actor->_doorStatus;
+ processActor.x = actor->_animStep.x - actor->_doorStatus;
}
actor->_dynamicFlags.bIsSpriteMoving = 0;
@@ -520,25 +520,25 @@ void Animations::processActorAnimations(int32 actorIdx) {
bool updatePos = false;
if (actor->_angle == ANGLE_0) { // down
- if (processActor.z <= actor->_lastPos.z) {
+ if (processActor.z <= actor->_animStep.z) {
updatePos = true;
}
} else if (actor->_angle == ANGLE_90) { // right
- if (processActor.x <= actor->_lastPos.x) {
+ if (processActor.x <= actor->_animStep.x) {
updatePos = true;
}
} else if (actor->_angle == ANGLE_180) { // up
- if (processActor.z >= actor->_lastPos.z) {
+ if (processActor.z >= actor->_animStep.z) {
updatePos = true;
}
} else if (actor->_angle == ANGLE_270) { // left
- if (processActor.x >= actor->_lastPos.x) {
+ if (processActor.x >= actor->_animStep.x) {
updatePos = true;
}
}
if (updatePos) {
- processActor = actor->_lastPos;
+ processActor = actor->_animStep;
actor->_dynamicFlags.bIsSpriteMoving = 0;
actor->_speed = 0;
@@ -548,14 +548,14 @@ void Animations::processActorAnimations(int32 actorIdx) {
}
if (actor->_staticFlags.bCanBePushed) {
- processActor += actor->_lastPos;
+ processActor += actor->_animStep;
if (actor->_staticFlags.bUseMiniZv) {
processActor.x = ((processActor.x / (BRICK_SIZE / 4)) * (BRICK_SIZE / 4));
processActor.z = ((processActor.z / (BRICK_SIZE / 4)) * (BRICK_SIZE / 4));
}
- actor->_lastPos = IVec3();
+ actor->_animStep = IVec3();
}
}
} else { // 3D actor
@@ -581,9 +581,9 @@ void Animations::processActorAnimations(int32 actorIdx) {
_currentStep.x = destPos.x;
_currentStep.z = destPos.z;
- processActor = actor->pos() + _currentStep - actor->_lastPos;
+ processActor = actor->pos() + _currentStep - actor->_animStep;
- actor->_lastPos = _currentStep;
+ actor->_animStep = _currentStep;
actor->_dynamicFlags.bAnimEnded = 0;
actor->_dynamicFlags.bAnimFrameReached = 0;
@@ -624,7 +624,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
actor->_lastRotationAngle = ANGLE_0;
- actor->_lastPos = IVec3();
+ actor->_animStep = IVec3();
}
}
}
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 85b3f7e9143..05fdd9a7169 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -199,24 +199,24 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, cons
const int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(processActor, actorTest->pos());
if (actorTest->_staticFlags.bCanBePushed && !actor->_staticFlags.bCanBePushed) {
- actorTest->_lastPos.y = 0;
+ actorTest->_animStep.y = 0;
if (actorTest->_staticFlags.bUseMiniZv) {
if (newAngle >= ANGLE_45 && newAngle < ANGLE_135 && actor->_angle >= ANGLE_45 && actor->_angle < ANGLE_135) {
- actorTest->_lastPos.x = BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.x = BRICK_SIZE / 4 + BRICK_SIZE / 8;
}
if (newAngle >= ANGLE_135 && newAngle < ANGLE_225 && actor->_angle >= ANGLE_135 && actor->_angle < ANGLE_225) {
- actorTest->_lastPos.z = -BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.z = -BRICK_SIZE / 4 + BRICK_SIZE / 8;
}
if (newAngle >= ANGLE_225 && newAngle < ANGLE_315 && actor->_angle >= ANGLE_225 && actor->_angle < ANGLE_315) {
- actorTest->_lastPos.x = -BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.x = -BRICK_SIZE / 4 + BRICK_SIZE / 8;
}
if ((newAngle >= ANGLE_315 || newAngle < ANGLE_45) && (actor->_angle >= ANGLE_315 || actor->_angle < ANGLE_45)) {
- actorTest->_lastPos.z = BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.z = BRICK_SIZE / 4 + BRICK_SIZE / 8;
}
} else {
- actorTest->_lastPos.x = processActor.x - actor->_collisionPos.x;
- actorTest->_lastPos.z = processActor.z - actor->_collisionPos.z;
+ actorTest->_animStep.x = processActor.x - actor->_collisionPos.x;
+ actorTest->_animStep.z = processActor.z - actor->_collisionPos.z;
}
}
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 0d47e923a7f..10038cd0b6e 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1052,7 +1052,7 @@ static int32 lSET_DOOR_LEFT(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_LEFT(%i)", (int)distance);
ctx.actor->_angle = ANGLE_270;
- ctx.actor->_pos.x = ctx.actor->_lastPos.x - distance;
+ ctx.actor->_pos.x = ctx.actor->_animStep.x - distance;
ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
ctx.actor->_speed = 0;
@@ -1068,7 +1068,7 @@ static int32 lSET_DOOR_RIGHT(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_RIGHT(%i)", (int)distance);
ctx.actor->_angle = ANGLE_90;
- ctx.actor->_pos.x = ctx.actor->_lastPos.x + distance;
+ ctx.actor->_pos.x = ctx.actor->_animStep.x + distance;
ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
ctx.actor->_speed = 0;
@@ -1084,7 +1084,7 @@ static int32 lSET_DOOR_UP(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_UP(%i)", (int)distance);
ctx.actor->_angle = ANGLE_180;
- ctx.actor->_pos.z = ctx.actor->_lastPos.z - distance;
+ ctx.actor->_pos.z = ctx.actor->_animStep.z - distance;
ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
ctx.actor->_speed = 0;
@@ -1100,7 +1100,7 @@ static int32 lSET_DOOR_DOWN(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_DOWN(%i)", (int)distance);
ctx.actor->_angle = ANGLE_0;
- ctx.actor->_pos.z = ctx.actor->_lastPos.z + distance;
+ ctx.actor->_pos.z = ctx.actor->_animStep.z + distance;
ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
ctx.actor->_speed = 0;
Commit: ae4d70179051470cdce2492090ffa19610458585
https://github.com/scummvm/scummvm/commit/ae4d70179051470cdce2492090ffa19610458585
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: fixed reajustActorPosition
Changed paths:
engines/twine/scene/collision.cpp
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 05fdd9a7169..7894d020ddd 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -99,96 +99,88 @@ void Collision::reajustActorPosition(ShapeType brickShape) {
return;
}
- const int32 brkX = (_collision.x * BRICK_SIZE) - BRICK_HEIGHT;
- const int32 brkY = _collision.y * BRICK_HEIGHT;
- const int32 brkZ = (_collision.z * BRICK_SIZE) - BRICK_HEIGHT;
+ const int32 xw = (_collision.x * BRICK_SIZE) - BRICK_HEIGHT;
+ const int32 yw = _collision.y * BRICK_HEIGHT;
+ const int32 zw = (_collision.z * BRICK_SIZE) - BRICK_HEIGHT;
IVec3 &processActor = _engine->_movements->_processActor;
- // double-side stairs
- if (brickShape >= ShapeType::kDoubleSideStairsTop1 && brickShape <= ShapeType::kDoubleSideStairsRight2) {
- switch (brickShape) {
- case ShapeType::kDoubleSideStairsTop1:
- if (processActor.z - _collision.z <= processActor.x - _collision.x) {
- brickShape = ShapeType::kStairsTopLeft;
- } else {
- brickShape = ShapeType::kStairsTopRight;
- }
- break;
- case ShapeType::kDoubleSideStairsBottom1:
- if (processActor.z - _collision.z <= processActor.x - _collision.x) {
- brickShape = ShapeType::kStairsBottomLeft;
- } else {
- brickShape = ShapeType::kStairsBottomRight;
- }
- break;
- case ShapeType::kDoubleSideStairsLeft1:
- if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
- brickShape = ShapeType::kStairsTopLeft;
- } else {
- brickShape = ShapeType::kStairsBottomLeft;
- }
- break;
- case ShapeType::kDoubleSideStairsRight1:
- if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
- brickShape = ShapeType::kStairsTopRight;
- } else {
- brickShape = ShapeType::kStairsBottomRight;
- }
- break;
- case ShapeType::kDoubleSideStairsTop2:
- if (processActor.x - _collision.x >= processActor.z - _collision.z) {
- brickShape = ShapeType::kStairsTopRight;
- } else {
- brickShape = ShapeType::kStairsTopLeft;
- }
- break;
- case ShapeType::kDoubleSideStairsBottom2:
- if (processActor.z - _collision.z <= processActor.x - _collision.x) {
- brickShape = ShapeType::kStairsBottomRight;
- } else {
- brickShape = ShapeType::kStairsBottomLeft;
- }
- break;
- case ShapeType::kDoubleSideStairsLeft2:
- if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
- brickShape = ShapeType::kStairsBottomLeft;
- } else {
- brickShape = ShapeType::kStairsTopLeft;
- }
- break;
- case ShapeType::kDoubleSideStairsRight2:
- if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
- brickShape = ShapeType::kStairsBottomRight;
- } else {
- brickShape = ShapeType::kStairsTopRight;
- }
- break;
- default:
- if (_engine->_cfgfile.Debug) {
- debug("Brick Shape %d unsupported", (int)brickShape);
- }
- break;
+ switch (brickShape) {
+ case ShapeType::kDoubleSideStairsTop1:
+ if (processActor.x - xw < processActor.z - zw) {
+ brickShape = ShapeType::kStairsTopRight;
+ } else {
+ brickShape = ShapeType::kStairsTopLeft;
+ }
+ break;
+ case ShapeType::kDoubleSideStairsBottom1:
+ if (processActor.x - xw < processActor.z - zw) {
+ brickShape = ShapeType::kStairsBottomRight;
+ } else {
+ brickShape = ShapeType::kStairsBottomLeft;
+ }
+ break;
+ case ShapeType::kDoubleSideStairsTop2:
+ if (processActor.x - xw < processActor.z - zw) {
+ brickShape = ShapeType::kStairsTopLeft;
+ } else {
+ brickShape = ShapeType::kStairsTopRight;
+ }
+ break;
+ case ShapeType::kDoubleSideStairsBottom2:
+ if (processActor.x - xw < processActor.z - zw) {
+ brickShape = ShapeType::kStairsBottomLeft;
+ } else {
+ brickShape = ShapeType::kStairsBottomRight;
+ }
+ break;
+ case ShapeType::kDoubleSideStairsLeft1:
+ if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ brickShape = ShapeType::kStairsBottomLeft;
+ } else {
+ brickShape = ShapeType::kStairsTopLeft;
+ }
+ break;
+ case ShapeType::kDoubleSideStairsRight1:
+ if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ brickShape = ShapeType::kStairsBottomRight;
+ } else {
+ brickShape = ShapeType::kStairsTopRight;
+ }
+ break;
+ case ShapeType::kDoubleSideStairsLeft2:
+ if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ brickShape = ShapeType::kStairsTopLeft;
+ } else {
+ brickShape = ShapeType::kStairsBottomLeft;
+ }
+ break;
+ case ShapeType::kDoubleSideStairsRight2:
+ if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ brickShape = ShapeType::kStairsTopRight;
+ } else {
+ brickShape = ShapeType::kStairsBottomRight;
}
+ break;
+ default:
+ break;
}
- if (brickShape >= ShapeType::kStairsTopLeft && brickShape <= ShapeType::kStairsBottomRight) {
- switch (brickShape) {
- case ShapeType::kStairsTopLeft:
- processActor.y = brkY + getAverageValue(0, BRICK_HEIGHT, BRICK_SIZE, processActor.x - brkX);
- break;
- case ShapeType::kStairsTopRight:
- processActor.y = brkY + getAverageValue(0, BRICK_HEIGHT, BRICK_SIZE, processActor.z - brkZ);
- break;
- case ShapeType::kStairsBottomLeft:
- processActor.y = brkY + getAverageValue(BRICK_HEIGHT, 0, BRICK_SIZE, processActor.z - brkZ);
- break;
- case ShapeType::kStairsBottomRight:
- processActor.y = brkY + getAverageValue(BRICK_HEIGHT, 0, BRICK_SIZE, processActor.x - brkX);
- break;
- default:
- break;
- }
+ switch (brickShape) {
+ case ShapeType::kStairsTopLeft:
+ processActor.y = yw + getAverageValue(0, BRICK_HEIGHT, BRICK_SIZE, processActor.x - xw);
+ break;
+ case ShapeType::kStairsTopRight:
+ processActor.y = yw + getAverageValue(0, BRICK_HEIGHT, BRICK_SIZE, processActor.z - zw);
+ break;
+ case ShapeType::kStairsBottomLeft:
+ processActor.y = yw + getAverageValue(BRICK_HEIGHT, 0, BRICK_SIZE, processActor.z - zw);
+ break;
+ case ShapeType::kStairsBottomRight:
+ processActor.y = yw + getAverageValue(BRICK_HEIGHT, 0, BRICK_SIZE, processActor.x - xw);
+ break;
+ default:
+ break;
}
}
Commit: 049c6a63eb306e13ef14d56b1591d39bd3049700
https://github.com/scummvm/scummvm/commit/049c6a63eb306e13ef14d56b1591d39bd3049700
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T09:56:54+02:00
Commit Message:
TWINE: activate else branch as found in the original sources
Changed paths:
engines/twine/scene/animations.cpp
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 39d8dc4afdd..7d42a163eda 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -655,9 +655,9 @@ void Animations::processActorAnimations(int32 actorIdx) {
if (brickShape != ShapeType::kNone) {
if (brickShape != ShapeType::kSolid) {
_engine->_collision->reajustActorPosition(brickShape);
- } /*else { // this shouldn't happen (collision should avoid it)
- actor->y = processActor.y = (processActor.y / BRICK_HEIGHT) * BRICK_HEIGHT + BRICK_HEIGHT; // go upper
- }*/
+ } else { // this shouldn't happen (collision should avoid it)
+ actor->_pos.y = processActor.y = (processActor.y / BRICK_HEIGHT) * BRICK_HEIGHT + BRICK_HEIGHT; // go upper
+ }
}
if (actor->_staticFlags.bComputeCollisionWithObj) {
Commit: 91341f443bcdb443783af42f3431a5bf932e2f1c
https://github.com/scummvm/scummvm/commit/91341f443bcdb443783af42f3431a5bf932e2f1c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T10:00:25+02:00
Commit Message:
TWINE: renamed variables to match original sources
Changed paths:
engines/twine/scene/grid.cpp
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 5015b17c4b6..3a24e16246b 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -744,27 +744,27 @@ ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
return ShapeType::kNone;
}
- uint8 *blockBufferPtr = _blockBuffer;
- blockBufferPtr += collision.x * GRID_SIZE_Y * 2;
- blockBufferPtr += collision.y * 2;
- blockBufferPtr += collision.z * (GRID_SIZE_X * GRID_SIZE_Y * 2);
+ uint8 *pCube = _blockBuffer;
+ pCube += collision.x * GRID_SIZE_Y * 2;
+ pCube += collision.y * 2;
+ pCube += collision.z * (GRID_SIZE_X * GRID_SIZE_Y * 2);
- uint8 blockIdx = *blockBufferPtr;
+ uint8 block = *pCube;
ShapeType brickShape;
- if (blockIdx) {
- const uint8 tmpBrickIdx = *(blockBufferPtr + 1);
- const BlockDataEntry *blockPtr = getBlockPointer(blockIdx, tmpBrickIdx);
+ if (block) {
+ const uint8 tmpBrickIdx = *(pCube + 1);
+ const BlockDataEntry *blockPtr = getBlockPointer(block, tmpBrickIdx);
brickShape = (ShapeType)blockPtr->brickShape;
} else {
- brickShape = (ShapeType) * (blockBufferPtr + 1);
+ brickShape = (ShapeType) * (pCube + 1);
}
int32 ymax = (y2 + (BRICK_HEIGHT - 1)) / BRICK_HEIGHT;
// check full height
for (y = collision.y; ymax > 0 && y < (GRID_SIZE_Y - 1); --ymax, y++) {
- blockBufferPtr += 2;
- if (READ_LE_INT16(blockBufferPtr)) {
+ pCube += 2;
+ if (READ_LE_INT16(pCube)) {
return ShapeType::kSolid;
}
}
Commit: 486c7fffd06817061fa2f0d905e9b8d94913ce9e
https://github.com/scummvm/scummvm/commit/486c7fffd06817061fa2f0d905e9b8d94913ce9e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T10:00:25+02:00
Commit Message:
TWINE: fixed invalid to-angle in processRandomAction
found in original source code OBJECT.C lines 1995 and 2005
Changed paths:
engines/twine/scene/movements.cpp
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 7c1b6a21e11..acf9d398226 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -397,7 +397,8 @@ void Movements::processRandomAction(int actorIdx) {
}
if (actor->brickCausesDamage()) {
- moveActor(actor->_angle, ClampAngle((_engine->getRandomNumber() & ANGLE_90) + (actor->_angle - ANGLE_90)), actor->_speed, &actor->_move);
+ const int32 angle = ClampAngle(actor->_angle + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90 + ANGLE_180);
+ moveActor(actor->_angle, angle, actor->_speed, &actor->_move);
actor->_delayInMillis = _engine->getRandomNumber(300) + _engine->_lbaTime + 300;
_engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
}
@@ -405,7 +406,8 @@ void Movements::processRandomAction(int actorIdx) {
if (!actor->_move.numOfStep) {
_engine->_animations->initAnim(AnimationTypes::kForward, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
if (_engine->_lbaTime > actor->_delayInMillis) {
- moveActor(actor->_angle, ClampAngle((_engine->getRandomNumber() & ANGLE_90) + (actor->_angle - ANGLE_90)), actor->_speed, &actor->_move);
+ const int32 angle = ClampAngle(actor->_angle + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90);
+ moveActor(actor->_angle, angle, actor->_speed, &actor->_move);
actor->_delayInMillis = _engine->getRandomNumber(300) + _engine->_lbaTime + 300;
}
}
More information about the Scummvm-git-logs
mailing list